-// functionCall holds the fields of a function call output item.
-type functionCall struct {
- Type string `json:"type"`
- Name string `json:"name"`
- Arguments string `json:"arguments"`
- CallID string `json:"call_id"`
-}
-
-// functionCallOutput is the input item with the result of a function call.
-type functionCallOutput struct {
- Type string `json:"type"`
- CallID string `json:"call_id"`
- Output string `json:"output"`
-}
-
-// newLoop returns the loop of agent with its memory. Its calls go through
-// client, and notify gets each event. The clock gives the date of a turn.
-func newLoop(agent *Agent, memory *Memory, client modelClient, clock func() time.Time, notify func(Event)) (*loop, error) {
- layout, err := loadLayout(filepath.Join(agent.dir, layoutFileName))
- if err != nil {
- return nil, err
- }
-
- l := &loop{
- agent: agent,
- memory: memory,
- client: client,
- layout: layout,
- clock: clock,
- notify: notify,
- wake: make(chan struct{}, 1),
- }
-
- l.tools = &toolbox{
- log: l,
- chat: memory,
- workdir: agent.config.Workdir,
- }
-
- return l, nil
-}
-