feat: update examples for AI SDK ManagedResult and tracker factory APIs#26
Open
jsonbailey wants to merge 2 commits intomainfrom
Open
feat: update examples for AI SDK ManagedResult and tracker factory APIs#26jsonbailey wants to merge 2 commits intomainfrom
jsonbailey wants to merge 2 commits intomainfrom
Conversation
Migrate examples to the AI SDK API surface introduced by the upcoming ldai 0.18 / openai 0.4 / langchain 0.5 release stack: - ManagedModel.invoke() -> .run(); ModelResponse.message.content -> ManagedResult.content - chat_response.evaluations is a single asyncio.Task[List[JudgeResult]]; await it directly instead of asyncio.gather over a list - JudgeResult is a single value (not List); access .sampled / .success / .metric_key / .score / .reasoning / .error_message directly - AIConfig.tracker (field) -> AIConfig.create_tracker() (factory) - track_metrics_of(metrics_extractor, func) parameter order; use track_metrics_of_async for awaited callables (langchain example) - aiclient.create_judge() is sync; drop the unnecessary `await` - direct_judge default key updated to `sample-ai-judge` (configured) - chat_observability now declares launchdarkly-server-sdk-ai-openai as a dependency since it uses aiclient.create_model() which loads providers via the runner factory Bumps published version pins to ^0.18 / ^0.4 / ^0.5 to match the new API. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
c0e0eac to
0c57793
Compare
keelerm84
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
launchdarkly-server-sdk-ai0.18 /-openai0.4 /-langchain0.5 release stack^0.17→^0.18,^0.3→^0.4,^0.4→^0.5)launchdarkly-server-sdk-ai-openaidependency tochat_observability(the example callsaiclient.create_model()which dispatches via the runner factory)API changes covered
ManagedModel.invoke()→.run();ModelResponse.message.content→ManagedResult.contentchat_response.evaluationsis now a singleasyncio.Task[List[JudgeResult]]—awaitit directly instead ofasyncio.gatherover a listJudgeResultis a single value with direct fields (sampled,success,metric_key,score,reasoning,error_message)AIConfig.trackerfield →AIConfig.create_tracker()factorytracker.track_metrics_of(metrics_extractor, func)parameter order; usetrack_metrics_of_asyncfor awaited callables (langchain example)aiclient.create_judge()is sync — drop the unnecessaryawaitdirect-judgedefault judge key updated tosample-ai-judge(the prior default key isn't configured in the shared LD project)Test plan
chat-judge-example— PASS (chat + judge eval with score + reasoning)direct-judge-example— PASS (judge eval with score + reasoning)chat-observability-example— PASS (two chat turns + awaited judge tasks)openai-example— PASS (sync OpenAI completion via tracker)langchain-example— PASS (async LangChainainvokeviatrack_metrics_of_async)langgraph-agent-example— PASS (single-agent React agent with tool call)langgraph-multi-agent-example— PASS (multi-node graph; final report generated)All seven verified end-to-end against the upstream SDK worktree.
🤖 Generated with Claude Code