fix(types): agent processing stuff
This commit is contained in:
@ -73,7 +73,7 @@ type ChatAiMessage struct {
|
||||
Role string `json:"role"`
|
||||
ToolCalls *[]ToolCall `json:"tool_calls,omitempty"`
|
||||
|
||||
MessageContent `json:"content"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
func (m ChatAiMessage) IsResponse() bool {
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
|
@ -161,16 +161,15 @@ func (agent EventLocationAgent) GetLocations(userId uuid.UUID, imageId uuid.UUID
|
||||
ResponseFormat: client.ResponseFormat{
|
||||
Type: "text",
|
||||
},
|
||||
Chat: client.Chat{
|
||||
Messages: make([]client.ChatMessage, 0),
|
||||
},
|
||||
}
|
||||
|
||||
err = request.AddSystem(eventLocationPrompt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
request.Chat.AddSystem(eventLocationPrompt)
|
||||
request.Chat.AddImage(imageName, imageData)
|
||||
|
||||
request.AddImage(imageName, imageData)
|
||||
|
||||
_, err = agent.client.Request(&request)
|
||||
_, err = agent.client.Request(&request.Chat)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -180,7 +179,7 @@ func (agent EventLocationAgent) GetLocations(userId uuid.UUID, imageId uuid.UUID
|
||||
UserId: userId,
|
||||
}
|
||||
|
||||
return agent.client.Process(toolHandlerInfo, request)
|
||||
return agent.client.Process(toolHandlerInfo, &request.Chat)
|
||||
}
|
||||
|
||||
func NewLocationEventAgent(locationModel models.LocationModel, eventModel models.EventModel, contactModel models.ContactModel) (EventLocationAgent, error) {
|
||||
|
@ -32,15 +32,15 @@ func (agent NoteAgent) GetNotes(userId uuid.UUID, imageId uuid.UUID, imageName s
|
||||
ResponseFormat: client.ResponseFormat{
|
||||
Type: "text",
|
||||
},
|
||||
Chat: client.Chat{
|
||||
Messages: make([]client.ChatMessage, 0),
|
||||
},
|
||||
}
|
||||
|
||||
err := request.AddSystem(noteAgentPrompt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
request.Chat.AddSystem(noteAgentPrompt)
|
||||
request.Chat.AddImage(imageName, imageData)
|
||||
|
||||
request.AddImage(imageName, imageData)
|
||||
resp, err := agent.client.Request(&request)
|
||||
resp, err := agent.client.Request(&request.Chat)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -101,15 +101,16 @@ func (agent OrchestratorAgent) Orchestrate(userId uuid.UUID, imageId uuid.UUID,
|
||||
},
|
||||
ToolChoice: &toolChoice,
|
||||
Tools: &tools,
|
||||
|
||||
Chat: client.Chat{
|
||||
Messages: make([]client.ChatMessage, 0),
|
||||
},
|
||||
}
|
||||
|
||||
err = request.AddSystem(orchestratorPrompt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
request.Chat.AddSystem(orchestratorPrompt)
|
||||
request.Chat.AddImage(imageName, imageData)
|
||||
|
||||
request.AddImage(imageName, imageData)
|
||||
_, err = agent.client.Request(&request)
|
||||
_, err = agent.client.Request(&request.Chat)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -119,7 +120,7 @@ func (agent OrchestratorAgent) Orchestrate(userId uuid.UUID, imageId uuid.UUID,
|
||||
UserId: userId,
|
||||
}
|
||||
|
||||
return agent.client.Process(toolHandlerInfo, request)
|
||||
return agent.client.Process(toolHandlerInfo, &request.Chat)
|
||||
}
|
||||
|
||||
func NewOrchestratorAgent(eventLocationAgent EventLocationAgent, noteAgent NoteAgent, imageName string, imageData []byte) (OrchestratorAgent, error) {
|
||||
|
@ -25,10 +25,10 @@ import (
|
||||
)
|
||||
|
||||
type TestAiClient struct {
|
||||
ImageInfo client.ImageInfo
|
||||
ImageInfo client.ImageMessageContent
|
||||
}
|
||||
|
||||
func (client TestAiClient) GetImageInfo(imageName string, imageData []byte) (client.ImageInfo, error) {
|
||||
func (client TestAiClient) GetImageInfo(imageName string, imageData []byte) (client.ImageMessageContent, error) {
|
||||
return client.ImageInfo, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user