Enha: get func name from oai tool call

This commit is contained in:
Grail Finder
2025-08-08 13:14:06 +03:00
parent c3a5de7a0d
commit 972d9cdbff
2 changed files with 5 additions and 1 deletions

4
llm.go
View File

@@ -146,6 +146,10 @@ func (op OpenAIer) ParseChunk(data []byte) (*models.TextChunk, error) {
}
if len(llmchunk.Choices[len(llmchunk.Choices)-1].Delta.ToolCalls) > 0 {
resp.ToolChunk = llmchunk.Choices[len(llmchunk.Choices)-1].Delta.ToolCalls[0].Function.Arguments
fname := llmchunk.Choices[len(llmchunk.Choices)-1].Delta.ToolCalls[0].Function.Name
if fname != "" {
resp.FuncName = fname
}
}
if llmchunk.Choices[len(llmchunk.Choices)-1].FinishReason == "stop" {
if resp.Chunk != "" {