Documentation
¶
Overview ¶
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: MIT
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: MIT
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstrumentedClient ¶ added in v1.57.1
type InstrumentedClient struct {
// contains filtered or unexported fields
}
InstrumentedClient wraps an LLMClient and records metrics for each call.
func NewInstrumentedClient ¶ added in v1.57.1
func NewInstrumentedClient(inner LLMClient, recorder MetricsRecorder, provider string) *InstrumentedClient
NewInstrumentedClient creates a new metrics-recording wrapper around an LLMClient.
func (*InstrumentedClient) GetModelName ¶ added in v1.57.1
func (c *InstrumentedClient) GetModelName() string
GetModelName delegates to the inner client.
type LLMClient ¶
type LLMClient interface {
// GetModelName retorna o nome do modelo de linguagem utilizado pelo cliente.
GetModelName() string
// SendPrompt envia um prompt para o modelo de linguagem e retorna a resposta.
// O contexto (ctx) pode ser usado para controlar o tempo de execução e cancelamento.
// O histórico (history) contém as mensagens anteriores da conversa.
// Retorna uma string com a resposta do modelo e um erro, caso ocorra.
SendPrompt(ctx context.Context, prompt string, history []models.Message, maxTokens int) (string, error)
}
LLMClient define os métodos que um cliente LLM deve implementar
type MetricsRecorder ¶ added in v1.57.1
type MetricsRecorder interface {
RecordRequest(provider, model, status string, duration time.Duration)
RecordError(provider, model, errorType string)
}
MetricsRecorder is the interface for recording LLM call metrics. Implemented by the server-side metrics adapter to avoid importing metrics/ here.
type MockLLMClient ¶
MockLLMClient é um mock que implementa a interface LLMClient
func (*MockLLMClient) GetModelName ¶
func (m *MockLLMClient) GetModelName() string