Commit 96847b9
fix(langchain): wrap tools with StructuredTool before bind_tools
Raw Python callables passed to bind_tools() lack the schema metadata
required to generate a valid OpenAI tools[].function spec, causing a
400 "Missing required parameter: 'tools[0].function'" error.
Wrapping each callable with StructuredTool.from_function(name=config_key)
also ensures the model response carries the config key as the tool name,
fixing a separate bug where function.__name__ was being tracked instead
of the LaunchDarkly config key.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 56ce0fd commit 96847b9
1 file changed
Lines changed: 13 additions & 5 deletions
File tree
- packages/ai-providers/server-ai-langchain/src/ldai_langchain
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
82 | 90 | | |
83 | 91 | | |
84 | 92 | | |
| |||
0 commit comments