client

package
v1.43.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

* 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 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 LLMError

type LLMError struct {
	Code    int
	Message string
}

LLMError representa um erro personalizado para o cliente LLM

func (*LLMError) Error

func (e *LLMError) Error() string

Error implementa a interface de erro para LLMError

type MockLLMClient

type MockLLMClient struct {
	Response string
	Err      error
}

MockLLMClient é um mock que implementa a interface LLMClient

func (*MockLLMClient) GetModelName

func (m *MockLLMClient) GetModelName() string

func (*MockLLMClient) SendPrompt

func (m *MockLLMClient) SendPrompt(ctx context.Context, prompt string, history []models.Message, maxTokens int) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL