#Gemini Client 🧵

1 messages · Page 1 of 1 (latest)

violet slate
#

@stone pasture I might have some questions for you as I work on wiring this in

stone pasture
#

Sure 🙏

violet slate
#

first difference I ran into is that the gemini constructor is like NewClient(ctx, opts...) (*Client, error). No problem bubbling up the error but I didn't see a clear way to wire through the ctx. For now I just have ctx := context.Background() //FIXME

violet slate
#

Next hurdle, the tool schema does not have an easy conversion like openai and anthropic so I'm building a converter

violet slate
#

tool schema mapped ✅

violet slate
#

In

type ModelMessage struct {
    Role        string     `json:"role"`
    Content     any        `json:"content"`
    ToolCalls   []ToolCall `json:"tool_calls,omitempty"`
    ToolCallID  string     `json:"tool_call_id,omitempty"`
    ToolErrored bool       `json:"tool_errored,omitempty"`
}

will the output from the tool call be in Content? What is it's format?

#

I guess this implies yes?

if msg.ToolCallID != "" {
            blocks = append(blocks, anthropic.NewToolResultBlock(
                msg.ToolCallID,
                content,
                msg.ToolErrored,
            ))
        }
#

also, does that mean ToolCallID should exist as a ToolCall.ID in ModelMessage.ToolCalls?

stone pasture
#

yes 👍