You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/ai-providers/server-ai-langchain/CHANGELOG.md
+53Lines changed: 53 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,59 @@
2
2
3
3
All notable changes to the LaunchDarkly Python AI LangChain provider package will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
* Narrow AgentGraphRunner.run input from Any to str ([#177](https://github.com/launchdarkly/python-server-sdk-ai/issues/177))
29
+
* Rename LDAIMetrics.usage and AIGraphMetrics.usage to .tokens ([#175](https://github.com/launchdarkly/python-server-sdk-ai/issues/175))
30
+
* rename GraphMetrics/GraphMetricSummary to AIGraphMetrics/AIGraphMetricSummary ([#173](https://github.com/launchdarkly/python-server-sdk-ai/issues/173))
31
+
32
+
### Features
33
+
34
+
* Narrow AgentGraphRunner.run input from Any to str ([#177](https://github.com/launchdarkly/python-server-sdk-ai/issues/177)) ([cc7a0fe](https://github.com/launchdarkly/python-server-sdk-ai/commit/cc7a0fe64549337c71036cd67973bf0af91c7a42))
35
+
* rename GraphMetrics/GraphMetricSummary to AIGraphMetrics/AIGraphMetricSummary ([#173](https://github.com/launchdarkly/python-server-sdk-ai/issues/173)) ([583939d](https://github.com/launchdarkly/python-server-sdk-ai/commit/583939dbe5c11c3c11ed960ee0b46ec377f1bb70))
36
+
* Rename LDAIMetrics.usage and AIGraphMetrics.usage to .tokens ([#175](https://github.com/launchdarkly/python-server-sdk-ai/issues/175)) ([d8c4a70](https://github.com/launchdarkly/python-server-sdk-ai/commit/d8c4a702d4b68f146de7ca520bc35f2aa0b155f6))
*`LangChainModelRunner.invoke_model()` and `invoke_structured_model()` have been removed. Use the unified `run(input, output_type=...)` method instead, which returns `RunnerResult` in place of `ModelResponse` / `StructuredResponse`.
44
+
45
+
46
+
### Features
47
+
48
+
* Add judge evaluation support to agent graphs ([#142](https://github.com/launchdarkly/python-server-sdk-ai/issues/142)) ([3d5a6a9](https://github.com/launchdarkly/python-server-sdk-ai/commit/3d5a6a91a87c7475a83a7e440cd4b71337cfd56f))
49
+
* Migrate LangGraph runner to AgentGraphRunnerResult; clean up legacy shape detection ([#156](https://github.com/launchdarkly/python-server-sdk-ai/issues/156)) ([efa8e00](https://github.com/launchdarkly/python-server-sdk-ai/commit/efa8e00103d3870d379167769ae38f438b019ec4))
50
+
* Support conversation history directly in AI Provider model runners ([#166](https://github.com/launchdarkly/python-server-sdk-ai/issues/166)) ([4bb3e78](https://github.com/launchdarkly/python-server-sdk-ai/commit/4bb3e7813f7c087302ba8446dea6a4a41f012c2e))
# Create a LangChain provider from the AI configuration
62
-
provider =await LangChainProvider.create(config)
63
-
64
-
# Use the provider to invoke the model
65
-
from ldai.models import LDMessage
66
-
messages = [
67
-
LDMessage(role="system", content="You are a helpful assistant."),
68
-
LDMessage(role="user", content="Hello, how are you?"),
69
-
]
70
-
71
-
response =await provider.invoke_model(messages)
72
-
print(response.message.content)
50
+
# Create a ManagedModel backed by the LangChain provider
51
+
model = ai_client.create_model(
52
+
"ai-config-key",
53
+
context,
54
+
AICompletionConfigDefault(
55
+
enabled=True,
56
+
model=ModelConfig("gpt-4"),
57
+
provider=ProviderConfig("langchain"),
58
+
),
59
+
)
60
+
61
+
if model:
62
+
result =await model.run("Hello, how are you?")
63
+
print(result.content)
73
64
74
65
asyncio.run(main())
75
66
```
76
67
77
68
## Usage
78
69
79
-
### Using LangChainProvider with the Create Factory
70
+
### Using `create_model` (recommended)
80
71
81
-
The simplest way to use the LangChain provider is with the static `create` factory method, which automatically creates the appropriate LangChain model based on your LaunchDarkly AI configuration:
72
+
The recommended entry point is `LDAIClient.create_model`, which evaluates a
73
+
LaunchDarkly AI config flag, selects the LangChain runner automatically, and
0 commit comments