Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) GetBaseURL() string
- func (c *Client) GetMaxTokens() int
- func (c *Client) GetModel() string
- func (c *Client) SendMessage(ctx context.Context, message string) (string, error)
- func (c *Client) SendMessageWithHistory(ctx context.Context, messages []types.Message) (string, error)
- func (c *Client) SendMessageWithSystemPromptAndTools(ctx context.Context, systemPrompt string, atmosMemory string, ...) (*types.Response, error)
- func (c *Client) SendMessageWithTools(ctx context.Context, message string, availableTools []tools.Tool) (*types.Response, error)
- func (c *Client) SendMessageWithToolsAndHistory(ctx context.Context, messages []types.Message, availableTools []tools.Tool) (*types.Response, error)
Constants ¶
const ( // ProviderName is the name of this provider for configuration lookup. ProviderName = "zai" // DefaultMaxTokens is the default maximum number of tokens in AI responses. DefaultMaxTokens = 4096 // DefaultModel is the default Z.AI (Zhipu GLM) model. DefaultModel = "glm-5.3" // DefaultAPIKeyEnvVar is the default environment variable name for the API key (used in error hints). DefaultAPIKeyEnvVar = "ZAI_API_KEY" // DefaultBaseURL is the default Z.AI API endpoint (OpenAI-compatible). DefaultBaseURL = "https://api.z.ai/api/paas/v4" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a simplified interface to the Z.AI (Zhipu GLM) API for Atmos. Z.AI's API is OpenAI-compatible, so we use the OpenAI SDK with a custom base URL.
func NewClient ¶
func NewClient(atmosConfig *schema.AtmosConfiguration) (*Client, error)
NewClient creates a new Z.AI client from Atmos configuration.
func (*Client) GetBaseURL ¶
GetBaseURL returns the configured base URL.
func (*Client) GetMaxTokens ¶
GetMaxTokens returns the configured max tokens.
func (*Client) SendMessage ¶
SendMessage sends a message to the AI and returns the response.
func (*Client) SendMessageWithHistory ¶
func (c *Client) SendMessageWithHistory(ctx context.Context, messages []types.Message) (string, error)
SendMessageWithHistory sends messages with full conversation history.
func (*Client) SendMessageWithSystemPromptAndTools ¶
func (c *Client) SendMessageWithSystemPromptAndTools( ctx context.Context, systemPrompt string, atmosMemory string, messages []types.Message, availableTools []tools.Tool, ) (*types.Response, error)
SendMessageWithSystemPromptAndTools sends messages with system prompt, conversation history, and available tools. The system prompt and atmosMemory are prepended as system messages.