mirror of
https://github.com/alibaba/higress.git
synced 2026-06-26 10:45:25 +08:00
fix(ai-proxy): preserve Vertex thoughtSignature in OpenAI tool calls (#3973)
Signed-off-by: DENG <33118163+XinhhD@users.noreply.github.com>
This commit is contained in:
@@ -871,7 +871,9 @@ func (v *vertexProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, re
|
||||
args, _ := json.Marshal(part.FunctionCall.Args)
|
||||
choice.Message.ToolCalls = []toolCall{
|
||||
{
|
||||
Type: "function",
|
||||
Type: "function",
|
||||
ThoughtSignature: part.ThoughtSignature,
|
||||
ExtraContent: buildGoogleThoughtSignatureExtraContent(part.ThoughtSignature),
|
||||
Function: functionCall{
|
||||
Name: part.FunctionCall.Name,
|
||||
Arguments: string(args),
|
||||
@@ -979,7 +981,9 @@ func (v *vertexProvider) buildChatCompletionStreamResponse(ctx wrapper.HttpConte
|
||||
choice.Delta = &chatMessage{
|
||||
ToolCalls: []toolCall{
|
||||
{
|
||||
Type: "function",
|
||||
Type: "function",
|
||||
ThoughtSignature: part.ThoughtSignature,
|
||||
ExtraContent: buildGoogleThoughtSignatureExtraContent(part.ThoughtSignature),
|
||||
Function: functionCall{
|
||||
Name: part.FunctionCall.Name,
|
||||
Arguments: string(args),
|
||||
@@ -1143,6 +1147,7 @@ func (v *vertexProvider) buildVertexChatRequest(request *chatCompletionRequest)
|
||||
Name: lastFunctionName,
|
||||
Args: args,
|
||||
},
|
||||
ThoughtSignature: message.ToolCalls[0].getThoughtSignature(),
|
||||
})
|
||||
} else {
|
||||
for _, part := range message.ParseContent() {
|
||||
@@ -1359,6 +1364,7 @@ type vertexPart struct {
|
||||
FunctionCall *vertexFunctionCall `json:"functionCall,omitempty"`
|
||||
FunctionResponse *vertexFunctionResponse `json:"functionResponse,omitempty"`
|
||||
Thounght *bool `json:"thought,omitempty"`
|
||||
ThoughtSignature string `json:"thoughtSignature,omitempty"`
|
||||
}
|
||||
|
||||
type blob struct {
|
||||
|
||||
Reference in New Issue
Block a user