Add metadata json field to Message, store generation model/provider
This commit is contained in:
@@ -248,7 +248,11 @@ func (a *AppModel) ExecuteToolCalls(toolCalls []api.ToolCall) ([]api.ToolResult,
|
||||
return agents.ExecuteToolCalls(toolCalls, agent.Toolbox)
|
||||
}
|
||||
|
||||
func (a *AppModel) PromptLLM(messages []api.Message, chatReplyChunks chan provider.Chunk, stopSignal chan struct{}) (*api.Message, error) {
|
||||
func (a *AppModel) Prompt(
|
||||
messages []api.Message,
|
||||
chatReplyChunks chan provider.Chunk,
|
||||
stopSignal chan struct{},
|
||||
) (*api.Message, error) {
|
||||
model, _, p, err := a.Ctx.GetModelProvider(a.Model, a.ProviderName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -274,7 +278,12 @@ func (a *AppModel) PromptLLM(messages []api.Message, chatReplyChunks chan provid
|
||||
}
|
||||
}()
|
||||
|
||||
return p.CreateChatCompletionStream(
|
||||
msg, err := p.CreateChatCompletionStream(
|
||||
ctx, params, messages, chatReplyChunks,
|
||||
)
|
||||
if msg != nil {
|
||||
msg.Metadata.GenerationProvider = &a.ProviderName
|
||||
msg.Metadata.GenerationModel = &a.Model
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user