mirror of
https://github.com/katanemo/plano.git
synced 2026-04-28 02:23:56 +02:00
fixed bug in Bedrock translation code and dramatically improved tracing for outbound LLM traffic (#601)
* dramatically improve LLM traces and fixed bug with Bedrock translation from claude code * addressing comments --------- Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-288.local>
This commit is contained in:
parent
0ee0912a73
commit
566e7b9c09
8 changed files with 149 additions and 61 deletions
|
|
@ -97,21 +97,24 @@ impl TryFrom<AnthropicMessagesRequest> for ConverseRequest {
|
|||
});
|
||||
|
||||
// Convert tools and tool choice to ToolConfiguration
|
||||
let tool_config = if req.tools.is_some() || req.tool_choice.is_some() {
|
||||
let tools = req.tools.map(|anthropic_tools| {
|
||||
anthropic_tools
|
||||
.into_iter()
|
||||
.map(|tool| BedrockTool::ToolSpec {
|
||||
tool_spec: ToolSpecDefinition {
|
||||
name: tool.name,
|
||||
description: tool.description,
|
||||
input_schema: ToolInputSchema {
|
||||
json: tool.input_schema,
|
||||
},
|
||||
// Only include toolConfig if we have actual tools (Bedrock requires at least 1 tool)
|
||||
let tool_config = req.tools.and_then(|anthropic_tools| {
|
||||
if anthropic_tools.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let tools = anthropic_tools
|
||||
.into_iter()
|
||||
.map(|tool| BedrockTool::ToolSpec {
|
||||
tool_spec: ToolSpecDefinition {
|
||||
name: tool.name,
|
||||
description: tool.description,
|
||||
input_schema: ToolInputSchema {
|
||||
json: tool.input_schema,
|
||||
},
|
||||
})
|
||||
.collect()
|
||||
});
|
||||
},
|
||||
})
|
||||
.collect();
|
||||
|
||||
let tool_choice = req.tool_choice.map(|choice| {
|
||||
match choice.kind {
|
||||
|
|
@ -136,10 +139,11 @@ impl TryFrom<AnthropicMessagesRequest> for ConverseRequest {
|
|||
}
|
||||
});
|
||||
|
||||
Some(ToolConfiguration { tools, tool_choice })
|
||||
} else {
|
||||
None
|
||||
};
|
||||
Some(ToolConfiguration {
|
||||
tools: Some(tools),
|
||||
tool_choice,
|
||||
})
|
||||
});
|
||||
|
||||
Ok(ConverseRequest {
|
||||
model_id: req.model,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue