services

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileService added in v0.16.0

func NewFileService() domain.FileService

NewFileService creates a new file service

Types

type FileServiceImpl added in v0.16.0

type FileServiceImpl struct{}

FileServiceImpl implements domain.FileService

func (*FileServiceImpl) GetFileInfo added in v0.16.0

func (s *FileServiceImpl) GetFileInfo(path string) (domain.FileInfo, error)

GetFileInfo returns information about a file

func (*FileServiceImpl) ListProjectFiles added in v0.16.0

func (s *FileServiceImpl) ListProjectFiles() ([]string, error)

ListProjectFiles returns a list of all files in the current directory and subdirectories

func (*FileServiceImpl) ReadFile added in v0.16.0

func (s *FileServiceImpl) ReadFile(path string) (string, error)

ReadFile reads the content of a file

func (*FileServiceImpl) ReadFileLines added in v0.16.0

func (s *FileServiceImpl) ReadFileLines(path string, startLine, endLine int) (string, error)

ReadFileLines reads specific lines from a file

func (*FileServiceImpl) ValidateFile added in v0.16.0

func (s *FileServiceImpl) ValidateFile(path string) error

ValidateFile checks if a file path is valid and accessible

type HTTPModelService

type HTTPModelService struct {
	// contains filtered or unexported fields
}

HTTPModelService implements ModelService using HTTP API calls

func NewHTTPModelService

func NewHTTPModelService(baseURL, apiKey string) *HTTPModelService

NewHTTPModelService creates a new HTTP-based model service

func (*HTTPModelService) GetCurrentModel

func (s *HTTPModelService) GetCurrentModel() string

func (*HTTPModelService) IsModelAvailable

func (s *HTTPModelService) IsModelAvailable(modelID string) bool

func (*HTTPModelService) ListModels

func (s *HTTPModelService) ListModels(ctx context.Context) ([]string, error)

func (*HTTPModelService) SelectModel

func (s *HTTPModelService) SelectModel(modelID string) error

func (*HTTPModelService) ValidateModel

func (s *HTTPModelService) ValidateModel(modelID string) error

type InMemoryConversationRepository

type InMemoryConversationRepository struct {
	// contains filtered or unexported fields
}

InMemoryConversationRepository implements ConversationRepository using in-memory storage

func NewInMemoryConversationRepository

func NewInMemoryConversationRepository() *InMemoryConversationRepository

NewInMemoryConversationRepository creates a new in-memory conversation repository

func (*InMemoryConversationRepository) AddMessage

func (*InMemoryConversationRepository) Clear

func (*InMemoryConversationRepository) Export

func (*InMemoryConversationRepository) GetMessageCount

func (r *InMemoryConversationRepository) GetMessageCount() int

func (*InMemoryConversationRepository) GetMessages

func (*InMemoryConversationRepository) UpdateLastMessage

func (r *InMemoryConversationRepository) UpdateLastMessage(content string) error

func (*InMemoryConversationRepository) UpdateLastMessageToolCalls

func (r *InMemoryConversationRepository) UpdateLastMessageToolCalls(toolCalls *[]sdk.ChatCompletionMessageToolCall) error

type LLMToolService

type LLMToolService struct {
	// contains filtered or unexported fields
}

LLMToolService implements ToolService with the new tools package architecture

func NewLLMToolService

func NewLLMToolService(cfg *config.Config) *LLMToolService

NewLLMToolService creates a new LLM tool service with a new registry

func NewLLMToolServiceWithRegistry added in v0.14.1

func NewLLMToolServiceWithRegistry(cfg *config.Config, registry *tools.Registry) *LLMToolService

NewLLMToolServiceWithRegistry creates a new LLM tool service with an existing registry

func (*LLMToolService) ExecuteTool

func (s *LLMToolService) ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (*domain.ToolExecutionResult, error)

ExecuteTool executes a tool with the given arguments

func (*LLMToolService) IsToolEnabled

func (s *LLMToolService) IsToolEnabled(name string) bool

IsToolEnabled checks if a tool is enabled

func (*LLMToolService) ListTools

func (s *LLMToolService) ListTools() []domain.ToolDefinition

ListTools returns definitions for all enabled tools

func (*LLMToolService) ValidateTool

func (s *LLMToolService) ValidateTool(name string, args map[string]interface{}) error

ValidateTool validates tool arguments

type ModelsResponse

type ModelsResponse struct {
	Data []struct {
		ID     string `json:"id"`
		Object string `json:"object"`
	} `json:"data"`
}

ModelsResponse represents the API response for listing models

type NoOpToolService

type NoOpToolService struct{}

NoOpToolService implements ToolService as a no-op (when tools are disabled)

func NewNoOpToolService

func NewNoOpToolService() *NoOpToolService

NewNoOpToolService creates a new no-op tool service

func (*NoOpToolService) ExecuteTool

func (s *NoOpToolService) ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (*domain.ToolExecutionResult, error)

func (*NoOpToolService) IsToolEnabled

func (s *NoOpToolService) IsToolEnabled(name string) bool

func (*NoOpToolService) ListTools

func (s *NoOpToolService) ListTools() []domain.ToolDefinition

func (*NoOpToolService) ValidateTool

func (s *NoOpToolService) ValidateTool(name string, args map[string]interface{}) error

type StreamingChatService

type StreamingChatService struct {
	// contains filtered or unexported fields
}

StreamingChatService implements ChatService using streaming SDK client

func NewStreamingChatService

func NewStreamingChatService(baseURL, apiKey string, timeoutSeconds int, toolService domain.ToolService, systemPrompt string) *StreamingChatService

NewStreamingChatService creates a new streaming chat service

func (*StreamingChatService) CancelRequest

func (s *StreamingChatService) CancelRequest(requestID string) error

func (*StreamingChatService) GetMetrics

func (s *StreamingChatService) GetMetrics(requestID string) *domain.ChatMetrics

func (*StreamingChatService) SendMessage

func (s *StreamingChatService) SendMessage(ctx context.Context, model string, messages []sdk.Message) (<-chan domain.ChatEvent, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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