Documentation
¶
Overview ¶
Package interfaces defines the core interfaces and shared structures for the CLI Proxy API server. These interfaces provide a common contract for different components of the application, such as AI service clients, API handlers, and data models.
Package interfaces defines the core interfaces and shared structures for the CLI Proxy API server. These interfaces provide a common contract for different components of the application, such as AI service clients, API handlers, and data models.
Package interfaces defines the core interfaces and shared structures for the CLI Proxy API server. These interfaces provide a common contract for different components of the application, such as AI service clients, API handlers, and data models.
Package interfaces provides type aliases for backwards compatibility with translator functions. It defines common interface types used throughout the CLI Proxy API for request and response transformation operations, maintaining compatibility with the SDK translator package.
Index ¶
- type APIHandler
- 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
- type TranslateRequestFunc
- type TranslateResponse
- type TranslateResponseFunc
- type TranslateResponseNonStreamFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIHandler ¶
type APIHandler interface { // HandlerType returns the type identifier for this API handler. // This is used to determine which request/response translators to use. HandlerType() string // Models returns a list of supported models for this API handler. // Each model is represented as a map containing model metadata. Models() []map[string]any }
APIHandler defines the interface that all API handlers must implement. This interface provides methods for identifying handler types and retrieving supported models for different AI service endpoints.
type Content ¶
type Content struct { // Role indicates who sent the message ("user", "model", or "tool"). Role string `json:"role"` // Parts is a collection of content parts that make up the message. Parts []Part `json:"parts"` }
Content represents a single message in a conversation, with a role and parts. This structure models a message exchange between a user and an AI model.
type ErrorMessage ¶
type ErrorMessage struct { // StatusCode is the HTTP status code returned by the API. StatusCode int // Error is the underlying error that occurred. Error error // Addon contains additional headers to be added to the response. Addon http.Header }
ErrorMessage encapsulates an error with an associated HTTP status code. This structure is used to provide detailed error information including both the HTTP status and the underlying error.
type FunctionCall ¶
type FunctionCall struct { // Name is the identifier of the function to be called. Name string `json:"name"` // Args contains the arguments to pass to the function. Args map[string]interface{} `json:"args"` }
FunctionCall represents a tool call requested by the model. It includes the function name and its arguments that the model wants to execute.
type FunctionResponse ¶
type FunctionResponse struct { // Name is the identifier of the function that was called. Name string `json:"name"` // Response contains the result data from the function execution. Response map[string]interface{} `json:"response"` }
FunctionResponse represents the result of a tool execution. This is sent back to the model after a tool call has been processed.
type GCPProject ¶
type GCPProject struct { // Projects is a list of Google Cloud projects accessible by the user. Projects []GCPProjectProjects `json:"projects"` }
GCPProject represents the response structure for a Google Cloud project list request. This structure is used when fetching available projects for a Google Cloud account.
type GCPProjectLabels ¶
type GCPProjectLabels struct { // GenerativeLanguage indicates if the project has generative language APIs enabled. GenerativeLanguage string `json:"generative-language"` }
GCPProjectLabels defines the labels associated with a GCP project. These labels can contain metadata about the project's purpose or configuration.
type GCPProjectProjects ¶
type GCPProjectProjects struct { // ProjectNumber is the unique numeric identifier for the project. ProjectNumber string `json:"projectNumber"` // ProjectID is the unique string identifier for the project. ProjectID string `json:"projectId"` // LifecycleState indicates the current state of the project (e.g., "ACTIVE"). LifecycleState string `json:"lifecycleState"` // Name is the human-readable name of the project. Name string `json:"name"` // Labels contains metadata labels associated with the project. Labels GCPProjectLabels `json:"labels"` // CreateTime is the timestamp when the project was created. CreateTime time.Time `json:"createTime"` }
GCPProjectProjects contains details about a single Google Cloud project. This includes identifying information, metadata, and configuration details.
type GenerateContentRequest ¶
type GenerateContentRequest struct { // SystemInstruction provides system-level instructions that guide the model's behavior. SystemInstruction *Content `json:"systemInstruction,omitempty"` // Contents is the conversation history between the user and the model. Contents []Content `json:"contents"` // Tools defines the available tools/functions that the model can call. Tools []ToolDeclaration `json:"tools,omitempty"` // GenerationConfig contains parameters that control the model's generation behavior. GenerationConfig `json:"generationConfig"` }
GenerateContentRequest is the top-level request structure for the streamGenerateContent endpoint. This structure defines all the parameters needed for generating content from an AI model.
type GenerationConfig ¶
type GenerationConfig struct { // ThinkingConfig specifies configuration for the model's "thinking" process. ThinkingConfig GenerationConfigThinkingConfig `json:"thinkingConfig,omitempty"` // Temperature controls the randomness of the model's responses. // Values closer to 0 make responses more deterministic, while values closer to 1 increase randomness. Temperature float64 `json:"temperature,omitempty"` // TopP controls nucleus sampling, which affects the diversity of responses. // It limits the model to consider only the top P% of probability mass. TopP float64 `json:"topP,omitempty"` // TopK limits the model to consider only the top K most likely tokens. // This can help control the quality and diversity of generated text. TopK float64 `json:"topK,omitempty"` }
GenerationConfig defines parameters that control the model's generation behavior. These parameters affect the creativity, randomness, and reasoning of the model's responses.
type GenerationConfigThinkingConfig ¶
type GenerationConfigThinkingConfig struct { // IncludeThoughts determines whether the model should output its reasoning process. // When enabled, the model will include its step-by-step thinking in the response. IncludeThoughts bool `json:"include_thoughts,omitempty"` }
GenerationConfigThinkingConfig specifies configuration for the model's "thinking" process. This controls whether the model should output its reasoning process along with the final answer.
type InlineData ¶
type InlineData struct { // MimeType specifies the media type of the embedded data (e.g., "image/png"). MimeType string `json:"mime_type,omitempty"` // Data contains the base64-encoded binary data. Data string `json:"data,omitempty"` }
InlineData represents base64-encoded data with its MIME type. This is typically used for embedding images or other binary data in requests.
type Part ¶
type Part struct { // Text contains plain text content. Text string `json:"text,omitempty"` // InlineData contains base64-encoded data with its MIME type (e.g., images). InlineData *InlineData `json:"inlineData,omitempty"` // FunctionCall represents a tool call requested by the model. FunctionCall *FunctionCall `json:"functionCall,omitempty"` // FunctionResponse represents the result of a tool execution. FunctionResponse *FunctionResponse `json:"functionResponse,omitempty"` }
Part represents a distinct piece of content within a message. A part can be text, inline data (like an image), a function call, or a function response.
type ToolDeclaration ¶
type ToolDeclaration struct {
// FunctionDeclarations is a list of available functions that the model can call.
FunctionDeclarations []interface{} `json:"functionDeclarations"`
}
ToolDeclaration defines the structure for declaring tools (like functions) that the model can call during content generation.
type TranslateRequestFunc ¶
type TranslateRequestFunc = sdktranslator.RequestTransform
Backwards compatible aliases for translator function types.
type TranslateResponse ¶
type TranslateResponse = sdktranslator.ResponseTransform
type TranslateResponseFunc ¶
type TranslateResponseFunc = sdktranslator.ResponseStreamTransform
type TranslateResponseNonStreamFunc ¶
type TranslateResponseNonStreamFunc = sdktranslator.ResponseNonStreamTransform