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