Documentation
¶
Overview ¶
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Native Tool Use support for Moonshot (Kimi) * Moonshot API is OpenAI-compatible for tool calling. * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
Index ¶
- type MoonshotClient
- func (c *MoonshotClient) GetModelName() string
- func (c *MoonshotClient) LastStopReason() string
- func (c *MoonshotClient) LastUsage() *models.UsageInfo
- func (c *MoonshotClient) ListModels(ctx context.Context) ([]client.ModelInfo, error)
- func (c *MoonshotClient) SendPrompt(ctx context.Context, prompt string, history []models.Message, maxTokens int) (string, error)
- func (c *MoonshotClient) SendPromptWithTools(ctx context.Context, prompt string, history []models.Message, ...) (*models.LLMResponse, error)
- func (c *MoonshotClient) SupportsNativeTools() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MoonshotClient ¶
type MoonshotClient struct {
// contains filtered or unexported fields
}
MoonshotClient implementa o cliente para a API Moonshot (Kimi). A API é OpenAI-compatible (chat/completions) com extensões opcionais:
- `extra_body.thinking.type` aceita "enabled"/"disabled" para chavear entre o modo "Thinking" (reasoning explícito) e o modo "Instant".
- cache automático de contexto (cache_hit reflete no preço, não no payload).
Modelo default: kimi-k2.6 (256K contexto, multimodal, thinking).
func NewMoonshotClient ¶
func NewMoonshotClient(provider auth.TokenProvider, model string, logger *zap.Logger, maxAttempts int, backoff time.Duration) *MoonshotClient
NewMoonshotClient cria uma nova instância de MoonshotClient.
func (*MoonshotClient) GetModelName ¶
func (c *MoonshotClient) GetModelName() string
GetModelName retorna o nome amigável do modelo Moonshot via catálogo.
func (*MoonshotClient) LastStopReason ¶
func (c *MoonshotClient) LastStopReason() string
LastStopReason returns the stop reason from the most recent API call.
func (*MoonshotClient) LastUsage ¶
func (c *MoonshotClient) LastUsage() *models.UsageInfo
LastUsage returns the token usage from the most recent API call.
func (*MoonshotClient) ListModels ¶
ListModels fetches available models from the Moonshot /models endpoint. Registers any unknown Kimi/Moonshot models into the catalog so they become auto-completable without a code change.
func (*MoonshotClient) SendPrompt ¶
func (c *MoonshotClient) SendPrompt(ctx context.Context, prompt string, history []models.Message, maxTokens int) (string, error)
SendPrompt envia um prompt para o modelo Moonshot (Kimi) e retorna a resposta.
func (*MoonshotClient) SendPromptWithTools ¶
func (c *MoonshotClient) SendPromptWithTools(ctx context.Context, prompt string, history []models.Message, tools []models.ToolDefinition, maxTokens int) (*models.LLMResponse, error)
SendPromptWithTools sends a prompt with tool definitions via Moonshot's native tool calling API.
func (*MoonshotClient) SupportsNativeTools ¶
func (c *MoonshotClient) SupportsNativeTools() bool
SupportsNativeTools returns true — Moonshot supports native tool calling (OpenAI-compatible format) across the Kimi K2.x and moonshot-v1 families.