initial commit

This commit is contained in:
2026-03-12 19:17:00 +01:00
commit 9030f2001e
25 changed files with 5089 additions and 0 deletions

51
internal/domain/llm.go Normal file
View File

@@ -0,0 +1,51 @@
package domain
import "context"
// Message represents a single message in the conversation
type Message struct {
Role string `json:"role"` // "system", "user", "assistant", "tool"
Content string `json:"content"` // Message content
ToolCallID string `json:"tool_call_id,omitempty"` // For tool responses
ToolCalls []ToolCall `json:"tool_calls,omitempty"` // For assistant messages with function calls
}
// ToolCall represents a function call request from the LLM
type ToolCall struct {
ID string `json:"id"`
Type string `json:"type"` // "function"
Function struct {
Name string `json:"name"`
Arguments string `json:"arguments"` // JSON string
} `json:"function"`
}
// Tool represents a function available to the LLM
type Tool struct {
Type string `json:"type"` // "function"
Function ToolFunction `json:"function"`
}
// ToolFunction defines a function that can be called
type ToolFunction struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]interface{} `json:"parameters"`
}
// LLMRequest represents a request to the LLM with conversation history
type LLMRequest struct {
Messages []Message `json:"messages"`
Tools []Tool `json:"tools,omitempty"`
}
// LLMResponse represents the response from the LLM
type LLMResponse struct {
Content string `json:"content"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
}
// LLMProvider defines the interface for LLM providers
type LLMProvider interface {
Complete(ctx context.Context, request LLMRequest) (*LLMResponse, error)
}

View File

@@ -0,0 +1,16 @@
package domain
import "context"
// PackageStatus represents the status of a package
type PackageStatus struct {
PackageID string `json:"packageid"`
Status string `json:"status"`
Location string `json:"location,omitempty"`
}
// PackageClient defines the interface for package operations
type PackageClient interface {
Check(ctx context.Context, packageID string) (*PackageStatus, error)
Redirect(ctx context.Context, packageID, destination, code string) (string, error)
}

View File

@@ -0,0 +1,15 @@
package domain
import "context"
// Session represents a conversation session
type Session struct {
ID string `json:"id"`
Messages []Message `json:"messages"`
}
// SessionStorage defines the interface for session storage
type SessionStorage interface {
Get(ctx context.Context, sessionID string) (*Session, error)
Save(ctx context.Context, session *Session) error
}

View File

@@ -0,0 +1,16 @@
package domain
import "context"
// WeatherInfo represents weather information for a location
type WeatherInfo struct {
Location string `json:"location"`
Temperature float64 `json:"temperature"` // in Celsius
Description string `json:"description"`
Humidity int `json:"humidity"`
}
// WeatherClient defines the interface for weather operations
type WeatherClient interface {
GetWeather(ctx context.Context, location string) (*WeatherInfo, error)
}