Package scarlet (v1.0.0) [up] [repository]

Index

Functions

func RunServer(cfg *AppConfig) error

RunServer initializes the HTTP routes and starts the web server

Types

type AppConfig

type AppConfig struct {
	APIKey string `json:"api_key"`
	APIURL string `json:"api_url"`
	Model  string `json:"model"`
}

type Markdown

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

Methods

func (m *Markdown) Render(raw string) string
func (m *Markdown) RenderLine(line string) string

type Message

type Message struct {
	Role             string `json:"role"`
	Content          string `json:"content"`
	ReasoningContent string `json:"reasoning_content,omitempty"`
}

type PromptTokensDetails

type PromptTokensDetails struct {
	CachedTokens int `json:"cached_tokens"`
}

type StreamChoice

type StreamChoice struct {
	Delta StreamDelta `json:"delta"`
}

type StreamDelta

type StreamDelta struct {
	Content          string `json:"content"`
	ReasoningContent string `json:"reasoning_content"`
}

type StreamResponse

type StreamResponse struct {
	Choices []StreamChoice `json:"choices"`
	Usage   *Usage         `json:"usage,omitempty"`
}

type Usage

type Usage struct {
	PromptTokens        int                 `json:"prompt_tokens"`
	CompletionTokens    int                 `json:"completion_tokens"`
	TotalTokens         int                 `json:"total_tokens"`
	PromptTokensDetails PromptTokensDetails `json:"prompt_tokens_details"`
}