Documentation
¶
Index ¶
- type Client
- func (c *Client) GetProjectList(ctx context.Context) (*GCPProject, error)
- func (c *Client) SendMessageStream(ctx context.Context, rawJson []byte, model string, contents []Content, ...) (<-chan []byte, <-chan *ErrorMessage)
- func (c *Client) SetupUser(ctx context.Context, email, projectID string, auto bool) (string, error)
- func (c *Client) StreamAPIRequest(ctx context.Context, endpoint string, body interface{}) (io.ReadCloser, *ErrorMessage)
- type Content
- type ErrorMessage
- type FunctionCall
- type FunctionResponse
- type GCPProject
- type GCPProjectLabels
- type GCPProjectProjects
- type GenerateContentRequest
- type GenerationConfig
- type GenerationConfigThinkingConfig
- type InlineData
- type Part
- type ToolDeclaration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
ProjectID string
RequestMutex sync.Mutex
Email string
// contains filtered or unexported fields
}
Client is the main client for interacting with the CLI API.
func (*Client) GetProjectList ¶
func (c *Client) GetProjectList(ctx context.Context) (*GCPProject, error)
func (*Client) SendMessageStream ¶
func (c *Client) SendMessageStream(ctx context.Context, rawJson []byte, model string, contents []Content, tools []ToolDeclaration) (<-chan []byte, <-chan *ErrorMessage)
SendMessageStream handles a single conversational turn, including tool calls.
func (*Client) StreamAPIRequest ¶
func (c *Client) StreamAPIRequest(ctx context.Context, endpoint string, body interface{}) (io.ReadCloser, *ErrorMessage)
StreamAPIRequest handles making streaming requests to the CLI API endpoints.
type ErrorMessage ¶ added in v1.2.0
type FunctionCall ¶
FunctionCall represents a tool call requested by the model.
type FunctionResponse ¶
type FunctionResponse struct {
Name string `json:"name"`
Response map[string]interface{} `json:"response"`
}
FunctionResponse represents the result of a tool execution.
type GCPProject ¶
type GCPProject struct {
Projects []GCPProjectProjects `json:"projects"`
}
type GCPProjectLabels ¶
type GCPProjectLabels struct {
GenerativeLanguage string `json:"generative-language"`
}
type GCPProjectProjects ¶
type GenerateContentRequest ¶
type GenerateContentRequest struct {
Contents []Content `json:"contents"`
Tools []ToolDeclaration `json:"tools,omitempty"`
GenerationConfig `json:"generationConfig"`
}
GenerateContentRequest is the request payload for the streamGenerateContent endpoint.
type GenerationConfig ¶
type GenerationConfig struct {
ThinkingConfig GenerationConfigThinkingConfig `json:"thinkingConfig,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopP float64 `json:"topP,omitempty"`
TopK float64 `json:"topK,omitempty"`
}
GenerationConfig defines model generation parameters.
type GenerationConfigThinkingConfig ¶
type GenerationConfigThinkingConfig struct {
IncludeThoughts bool `json:"include_thoughts,omitempty"`
}
type InlineData ¶
type Part ¶
type Part struct {
Text string `json:"text,omitempty"`
InlineData *InlineData `json:"inlineData,omitempty"`
FunctionCall *FunctionCall `json:"functionCall,omitempty"`
FunctionResponse *FunctionResponse `json:"functionResponse,omitempty"`
}
Part represents a single part of a message's content.
type ToolDeclaration ¶
type ToolDeclaration struct {
FunctionDeclarations []interface{} `json:"functionDeclarations"`
}
ToolDeclaration is the structure for declaring tools to the API. For now, we'll assume a simple structure. A more complete implementation would mirror the OpenAPI schema definition.