Documentation
¶
Index ¶
- Constants
- Variables
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type ChatResponseHandler
- type Client
- func (c *Client) AddSystemPrompt(req *ChatRequest, system string, data any) error
- func (c *Client) Chat(ctx context.Context, req ChatRequest, res ChatResponseHandler) error
- func (c *Client) ChatTools(ctx context.Context, req ChatRequest, resHandler ChatResponseHandler, ...) error
- func (c *Client) Embed(ctx context.Context, req EmbedRequest) (*EmbedResponse, error)
- func (c *Client) EmbedHandle(ctx context.Context, req EmbedRequest, handler EmbedResponseHandler) error
- type EmbedRequest
- type EmbedResponse
- type EmbedResponseHandler
- type RespondStyle
- type Style
- type Tool
- type ToolCall
- type ToolCallFunction
- type ToolCallHandler
- type ToolFunction
- type ToolFunctionParameter
- type ToolFunctionProperty
Constants ¶
View Source
const ( MaxScannerBuffer = 512 * 1000 UserAgent = "ollama/prometheus" )
View Source
const ToolSystemPrompt = `` /* 163-byte string literal not displayed */
Variables ¶
View Source
var Styles = map[string]RespondStyle{ string(ConciseStyle): { Style: ConciseStyle, Template: "Reply with shorter responses and keep the messages concise and to the point.", }, string(DefaultStyle): { Style: DefaultStyle, Template: "", }, string(FormalStyle): { Style: FormalStyle, Template: "Reply in a clear, well-structured and formal tone.", }, }
Functions ¶
This section is empty.
Types ¶
type ChatMessage ¶
type ChatRequest ¶
type ChatRequest struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
KeepAlive int `json:"keep_alive"`
ContextSize int `json:"context_size"`
}
type ChatResponse ¶
type ChatResponseHandler ¶
type ChatResponseHandler func(ChatResponse) error
type Client ¶
type Client struct {
Endpoint string `json:"endpoint"`
Model string `json:"model,omitempty"`
Style Style `json:"style,omitempty"`
// contains filtered or unexported fields
}
func (*Client) AddSystemPrompt ¶
func (c *Client) AddSystemPrompt(req *ChatRequest, system string, data any) error
func (*Client) Chat ¶
func (c *Client) Chat(ctx context.Context, req ChatRequest, res ChatResponseHandler) error
func (*Client) ChatTools ¶
func (c *Client) ChatTools(ctx context.Context, req ChatRequest, resHandler ChatResponseHandler, toolHandler ToolCallHandler, tools []Tool) error
func (*Client) Embed ¶
func (c *Client) Embed(ctx context.Context, req EmbedRequest) (*EmbedResponse, error)
func (*Client) EmbedHandle ¶
func (c *Client) EmbedHandle(ctx context.Context, req EmbedRequest, handler EmbedResponseHandler) error
type EmbedRequest ¶
type EmbedResponse ¶
type EmbedResponseHandler ¶
type EmbedResponseHandler func(EmbedResponse) error
type RespondStyle ¶
type Tool ¶
type Tool struct {
Type string `json:"type"`
Function ToolFunction `json:"function"`
}
type ToolCall ¶
type ToolCall struct {
Function ToolCallFunction `json:"function"`
}
type ToolCallFunction ¶
type ToolCallHandler ¶
type ToolFunction ¶
type ToolFunction struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters ToolFunctionParameter `json:"parameters"`
}
type ToolFunctionParameter ¶
type ToolFunctionParameter struct {
Type string `json:"type"`
Required []string `json:"required"`
Properties map[string]ToolFunctionProperty `json:"properties,omitempty"`
}
type ToolFunctionProperty ¶
Click to show internal directories.
Click to hide internal directories.