mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 20:57:32 +08:00
[bugfix] add claude usage & bedrock tool_call index (#3095)
This commit is contained in:
@@ -108,6 +108,7 @@ func (b *bedrockProvider) convertEventFromBedrockToOpenAI(ctx wrapper.HttpContex
|
|||||||
chatChoice.Delta.ToolCalls = []toolCall{
|
chatChoice.Delta.ToolCalls = []toolCall{
|
||||||
{
|
{
|
||||||
Id: bedrockEvent.Start.ToolUse.ToolUseID,
|
Id: bedrockEvent.Start.ToolUse.ToolUseID,
|
||||||
|
Index: 0,
|
||||||
Type: "function",
|
Type: "function",
|
||||||
Function: functionCall{
|
Function: functionCall{
|
||||||
Name: bedrockEvent.Start.ToolUse.Name,
|
Name: bedrockEvent.Start.ToolUse.Name,
|
||||||
@@ -137,6 +138,7 @@ func (b *bedrockProvider) convertEventFromBedrockToOpenAI(ctx wrapper.HttpContex
|
|||||||
if bedrockEvent.Delta.ToolUse != nil {
|
if bedrockEvent.Delta.ToolUse != nil {
|
||||||
chatChoice.Delta.ToolCalls = []toolCall{
|
chatChoice.Delta.ToolCalls = []toolCall{
|
||||||
{
|
{
|
||||||
|
Index: 0,
|
||||||
Type: "function",
|
Type: "function",
|
||||||
Function: functionCall{
|
Function: functionCall{
|
||||||
Arguments: bedrockEvent.Delta.ToolUse.Input,
|
Arguments: bedrockEvent.Delta.ToolUse.Input,
|
||||||
|
|||||||
@@ -440,12 +440,17 @@ func (c *ClaudeToOpenAIConverter) ConvertOpenAIStreamResponseToClaude(ctx wrappe
|
|||||||
|
|
||||||
// buildClaudeStreamResponse builds Claude streaming responses from OpenAI streaming response
|
// buildClaudeStreamResponse builds Claude streaming responses from OpenAI streaming response
|
||||||
func (c *ClaudeToOpenAIConverter) buildClaudeStreamResponse(ctx wrapper.HttpContext, openaiResponse *chatCompletionResponse) []*claudeTextGenStreamResponse {
|
func (c *ClaudeToOpenAIConverter) buildClaudeStreamResponse(ctx wrapper.HttpContext, openaiResponse *chatCompletionResponse) []*claudeTextGenStreamResponse {
|
||||||
|
var choice chatCompletionChoice
|
||||||
if len(openaiResponse.Choices) == 0 {
|
if len(openaiResponse.Choices) == 0 {
|
||||||
log.Debugf("[OpenAI->Claude] No choices in OpenAI response, skipping")
|
choice = chatCompletionChoice{
|
||||||
return nil
|
Index: 0,
|
||||||
|
Delta: &chatMessage{
|
||||||
|
Content: "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
choice = openaiResponse.Choices[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
choice := openaiResponse.Choices[0]
|
|
||||||
var responses []*claudeTextGenStreamResponse
|
var responses []*claudeTextGenStreamResponse
|
||||||
|
|
||||||
// Log what we're processing
|
// Log what we're processing
|
||||||
|
|||||||
Reference in New Issue
Block a user