-
Notifications
You must be signed in to change notification settings - Fork 2
chore: Addressing blitz feedback #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
96847b9
daa5d7b
26f1665
7800e52
957747d
a71657c
fb647ae
c5a494b
58d4414
c8318a2
69ba99f
c9cc0a9
45ac282
51f3ba6
2897288
4a975dd
8d99035
700083c
f461501
35c2eec
4a459ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| """LangGraph agent graph runner for LaunchDarkly AI SDK.""" | ||
|
|
||
| import operator | ||
| import time | ||
| from typing import Annotated, Any, List | ||
|
|
@@ -10,7 +8,9 @@ | |
| from ldai.providers.types import LDAIMetrics | ||
|
|
||
| from ldai_langchain.langchain_helper import ( | ||
| build_tools, | ||
| create_langchain_model, | ||
| extract_last_message_content, | ||
| get_ai_metrics_from_response, | ||
| get_ai_usage_from_response, | ||
| get_tool_calls_from_response, | ||
|
|
@@ -20,6 +20,11 @@ | |
|
|
||
| class LangGraphAgentGraphRunner(AgentGraphRunner): | ||
| """ | ||
| CAUTION: | ||
| This feature is experimental and should NOT be considered ready for production use. | ||
| It may change or be removed without notice and is not subject to backwards | ||
| compatibility guarantees. | ||
|
|
||
| AgentGraphRunner implementation for LangGraph. | ||
|
|
||
| Compiles and runs the agent graph with LangGraph and automatically records | ||
|
|
@@ -73,12 +78,7 @@ def handle_traversal(node: AgentGraphNode, ctx: dict) -> None: | |
| model = None | ||
| if node_config.model: | ||
| lc_model = create_langchain_model(node_config) | ||
| tool_defs = node_config.model.get_parameter('tools') or [] | ||
| tool_fns = [ | ||
| tools_ref[t.get('name', '')] | ||
| for t in tool_defs | ||
| if t.get('name', '') in tools_ref | ||
| ] | ||
| tool_fns = build_tools(node_config, tools_ref) | ||
| model = lc_model.bind_tools(tool_fns) if tool_fns else lc_model | ||
|
|
||
| def invoke(state: WorkflowState) -> WorkflowState: | ||
|
|
@@ -124,12 +124,8 @@ def invoke(state: WorkflowState) -> WorkflowState: | |
| ) | ||
| duration = (time.perf_counter_ns() - start_ns) // 1_000_000 | ||
|
|
||
| output = '' | ||
| messages = result.get('messages', []) | ||
| if messages: | ||
| last = messages[-1] | ||
| if hasattr(last, 'content'): | ||
| output = str(last.content) | ||
| output = extract_last_message_content(messages) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shared helper silently drops non-string langgraph outputLow Severity The Additional Locations (1)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will look into this in a follow up PR. |
||
|
|
||
| if tracker: | ||
| tracker.track_path(exec_path) | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.