v1

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GrpcArgumentError = status.Errorf(codes.InvalidArgument, "Invalid Argument")
	GrpcInternalError = status.Errorf(codes.Internal, "Internal Server Error")
)

Functions

This section is empty.

Types

type ApiService

type ApiService struct {
	apiv1.UnimplementedApiServiceServer
	// contains filtered or unexported fields
}

func NewApiService

func NewApiService(models *llmx.Models) *ApiService

func (*ApiService) Chat

func (*ApiService) ChatRealtime

func (s *ApiService) ChatRealtime(stream apiv1.ApiService_ChatRealtimeServer) error

func (*ApiService) ChatStream

func (*ApiService) ClaudeCreateMessage

func (s *ApiService) ClaudeCreateMessage(c echo.Context) error

func (*ApiService) OpenaiCompletion

func (s *ApiService) OpenaiCompletion(c echo.Context) error

type ClaudeContent

type ClaudeContent struct {
	Type      string             `json:"type"`
	Text      string             `json:"text,omitempty"`
	Thinking  string             `json:"thinking,omitempty"`
	Signature string             `json:"signature,omitempty"`
	Source    *ClaudeImageSource `json:"source,omitempty"`
	ID        string             `json:"id,omitempty"`
	Name      string             `json:"name,omitempty"`
	Input     interface{}        `json:"input,omitempty"`
	ToolUseID string             `json:"tool_use_id,omitempty"`
	Content   interface{}        `json:"content,omitempty"` // For tool_result
}

type ClaudeDelta

type ClaudeDelta struct {
	Type         string  `json:"type"`
	Text         string  `json:"text,omitempty"`
	Thinking     string  `json:"thinking,omitempty"`
	Signature    string  `json:"signature,omitempty"`
	PartialJson  string  `json:"partial_json,omitempty"`
	StopReason   *string `json:"stop_reason,omitempty"`
	StopSequence *string `json:"stop_sequence,omitempty"`
}

type ClaudeImageSource

type ClaudeImageSource struct {
	Type      string `json:"type"`
	MediaType string `json:"media_type"`
	Data      string `json:"data"`
}

type ClaudeMessage

type ClaudeMessage struct {
	Role    string      `json:"role"`
	Content interface{} `json:"content"` // string or []ClaudeContent
}

type ClaudeMessageRequest

type ClaudeMessageRequest struct {
	Model         string            `json:"model"`
	Messages      []ClaudeMessage   `json:"messages"`
	System        interface{}       `json:"system,omitempty"` // string or []ClaudeContent
	MaxTokens     int64             `json:"max_tokens,omitempty"`
	Metadata      *ClaudeMetadata   `json:"metadata,omitempty"`
	StopSequences []string          `json:"stop_sequences,omitempty"`
	Stream        bool              `json:"stream,omitempty"`
	Temperature   *float32          `json:"temperature,omitempty"`
	TopP          *float32          `json:"top_p,omitempty"`
	TopK          *int              `json:"top_k,omitempty"`
	Tools         []ClaudeTool      `json:"tools,omitempty"`
	ToolChoice    *ClaudeToolChoice `json:"tool_choice,omitempty"`
	Thinking      *ClaudeThinking   `json:"thinking,omitempty"`
}

See https://docs.anthropic.com/en/api/messages

type ClaudeMessageResponse

type ClaudeMessageResponse struct {
	ID           string          `json:"id"`
	Type         string          `json:"type"`
	Role         string          `json:"role"`
	Content      []ClaudeContent `json:"content"`
	Model        string          `json:"model"`
	StopReason   *string         `json:"stop_reason"`
	StopSequence *string         `json:"stop_sequence"`
	Usage        ClaudeUsage     `json:"usage"`
}

type ClaudeMetadata

type ClaudeMetadata struct {
	UserID string `json:"user_id,omitempty"`
}

type ClaudeStreamEvent

type ClaudeStreamEvent struct {
	Type         string                 `json:"type"`
	Message      *ClaudeMessageResponse `json:"message,omitempty"`
	Index        int                    `json:"index,omitempty"`
	ContentBlock *ClaudeContent         `json:"content_block,omitempty"`
	Delta        *ClaudeDelta           `json:"delta,omitempty"`
	Usage        *ClaudeUsage           `json:"usage,omitempty"`
}

Streaming events

type ClaudeThinking

type ClaudeThinking struct {
	Type         string `json:"type"`
	BudgetTokens int    `json:"budget_tokens,omitempty"`
}

type ClaudeTool

type ClaudeTool struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description,omitempty"`
	InputSchema map[string]interface{} `json:"input_schema"`
}

type ClaudeToolChoice

type ClaudeToolChoice struct {
	Type                   string `json:"type"`
	Name                   string `json:"name,omitempty"`
	DisableParallelToolUse *bool  `json:"disable_parallel_tool_use,omitempty"`
}

type ClaudeUsage

type ClaudeUsage struct {
	InputTokens  int64 `json:"input_tokens"`
	OutputTokens int64 `json:"output_tokens"`
}

Jump to

Keyboard shortcuts

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