Skip to content

Commit e2465ba

Browse files
committed
fixes
1 parent 7e21a98 commit e2465ba

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

packages/ai-providers/server-ai-langchain/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ packages = [{ include = "ldai_langchain", from = "src" }]
2424

2525
[tool.poetry.dependencies]
2626
python = ">=3.9,<4"
27+
# TODO: Before publishing, change to PyPI version: launchdarkly-server-sdk-ai = ">=X.Y.Z"
28+
# Path dependency is used for development because the published version doesn't yet export
29+
# the required types (LDMessage, AIConfigKind, etc.). Release server-ai first, then update.
2730
launchdarkly-server-sdk-ai = { path = "../../sdk/server-ai", develop = true }
2831
langchain-core = ">=0.2.0"
2932
langchain = ">=0.2.0"

packages/ai-providers/server-ai-langchain/src/ldai_langchain/langchain_provider.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,12 @@
44

55
from langchain_core.language_models.chat_models import BaseChatModel
66
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage, SystemMessage
7-
from ldai import (
8-
AIAgentConfig,
9-
AICompletionConfig,
10-
AIJudgeConfig,
11-
LDMessage,
12-
)
7+
from ldai import LDMessage
8+
from ldai.models import AIConfigKind
139
from ldai.providers import AIProvider
1410
from ldai.providers.types import ChatResponse, LDAIMetrics, StructuredResponse
1511
from ldai.tracker import TokenUsage
1612

17-
# Type alias matching the one in ldai.models
18-
AIConfigKind = Union[AIAgentConfig, AICompletionConfig, AIJudgeConfig]
19-
2013

2114
class LangChainProvider(AIProvider):
2215
"""
@@ -44,7 +37,7 @@ async def create(ai_config: AIConfigKind, logger: Optional[Any] = None) -> 'Lang
4437
:param logger: Optional logger for the provider
4538
:return: Configured LangChainProvider instance
4639
"""
47-
llm = await LangChainProvider.create_langchain_model(ai_config)
40+
llm = LangChainProvider.create_langchain_model(ai_config)
4841
return LangChainProvider(llm, logger)
4942

5043
async def invoke_model(self, messages: List[LDMessage]) -> ChatResponse:
@@ -253,7 +246,7 @@ def convert_messages_to_langchain(
253246
return result
254247

255248
@staticmethod
256-
async def create_langchain_model(ai_config: AIConfigKind) -> BaseChatModel:
249+
def create_langchain_model(ai_config: AIConfigKind) -> BaseChatModel:
257250
"""
258251
Create a LangChain model from an AI configuration.
259252

0 commit comments

Comments
 (0)