llmapi

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package llmapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRequest

type ChatRequest struct {
	FileIDs   []string `json:"fileIDs,omitempty"`
	ImageIDs  []string `json:"imageIDs,omitempty"`
	ImageURLs []string `json:"imageURLs,omitempty"`
	Input     Input    `json:"input"`

	// Model Model name.
	Model string `json:"model"`

	// Options Model generation options.
	Options            *Options `json:"options,omitempty"`
	PreviousResponseID string   `json:"previousResponseID,omitempty"`

	// ResponseFormat Structured response format for LLM outputs.
	ResponseFormat *ResponseFormat `json:"responseFormat,omitempty"`

	// SystemPrompt Overrides the model's default system prompt.
	SystemPrompt string `json:"systemPrompt,omitempty"`
	Tools        []Tool `json:"tools,omitempty"`
}

ChatRequest LLM response generation request.

type ChatResponse

type ChatResponse struct {
	Citations        []Citation        `json:"citations,omitempty"`
	ResponseID       string            `json:"responseID"`
	Text             string            `json:"text,omitempty"`
	TokensUsed       int               `json:"tokensUsed"`
	ToolCallRequests []ToolCallRequest `json:"toolCallRequests,omitempty"`
}

ChatResponse LLM response.

type Citation

type Citation struct {
	// EndIdx End offset into the assistant message text.
	EndIdx *int `json:"endIdx,omitempty"`

	// Snippet The cited text excerpt from the source.
	Snippet *string `json:"snippet,omitempty"`

	// StartIdx Start offset into the assistant message text.
	StartIdx *int `json:"startIdx,omitempty"`

	// Title The source's title.
	Title *string `json:"title,omitempty"`

	// Url The cited source URL.
	Url string `json:"url"`
}

Citation A source reference attached to a span of assistant-generated text.

type ContentType

type ContentType string

ContentType MIME type of a file.

const (
	Applicationjson ContentType = "application/json"
	Applicationpdf  ContentType = "application/pdf"
	Applicationzip  ContentType = "application/zip"
	Imagejpeg       ContentType = "image/jpeg"
	Imagepng        ContentType = "image/png"
	Textcsv         ContentType = "text/csv"
	Textplain       ContentType = "text/plain"
)

Defines values for ContentType.

func (ContentType) Valid

func (e ContentType) Valid() bool

Valid indicates whether the value is a known member of the ContentType enum.

type ExternalTool

type ExternalTool struct {
	// Description Description of the tool and its purpose.
	Description string `json:"description,omitempty"`

	// Name Name of the tool.
	Name string `json:"name"`

	// Parameters JSON schema describing the tool's parameters.
	Parameters map[string]interface{} `json:"parameters"`
	Type       ExternalToolType       `json:"type"`
}

ExternalTool An external tool that can be called by the model.

type ExternalToolType

type ExternalToolType string

ExternalToolType defines model for ExternalTool.Type.

const (
	External ExternalToolType = "external"
)

Defines values for ExternalToolType.

func (ExternalToolType) Valid

func (e ExternalToolType) Valid() bool

Valid indicates whether the value is a known member of the ExternalToolType enum.

type FileUpload

type FileUpload struct {
	FileID   string `json:"fileID"`
	FileName string `json:"fileName"`
}

FileUpload Uploaded file result.

type FileUploadRequest

type FileUploadRequest struct {
	File     openapi_types.File `json:"file"`
	FileName string             `json:"fileName"`

	// FileType MIME type of a file.
	FileType   ContentType `json:"fileType"`
	ProviderID string      `json:"providerID"`
	Purpose    *string     `json:"purpose,omitempty"`
}

FileUploadRequest File upload request.

type Input

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

Input defines model for Input.

func (Input) AsInput1

func (t Input) AsInput1() (Input1, error)

AsInput1 returns the union data inside the Input as a Input1

func (Input) AsInputString

func (t Input) AsInputString() (InputString, error)

AsInputString returns the union data inside the Input as a InputString

func (*Input) FromInput1

func (t *Input) FromInput1(v Input1) error

FromInput1 overwrites any union data inside the Input as the provided Input1

func (*Input) FromInputString

func (t *Input) FromInputString(v InputString) error

FromInputString overwrites any union data inside the Input as the provided InputString

func (Input) MarshalJSON

func (t Input) MarshalJSON() ([]byte, error)

func (*Input) MergeInput1

func (t *Input) MergeInput1(v Input1) error

MergeInput1 performs a merge with any union data inside the Input, using the provided Input1

func (*Input) MergeInputString

func (t *Input) MergeInputString(v InputString) error

MergeInputString performs a merge with any union data inside the Input, using the provided InputString

func (*Input) UnmarshalJSON

func (t *Input) UnmarshalJSON(b []byte) error

type Input1

type Input1 = []Input_1_Item

Input1 defines model for .

type InputString

type InputString struct {
	// Value The input text.
	Value string `json:"value"`
}

InputString Input string to the model.

type Input_1_Item

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

Input_1_Item defines model for Input.1.Item.

func (Input_1_Item) AsInputString

func (t Input_1_Item) AsInputString() (InputString, error)

AsInputString returns the union data inside the Input_1_Item as a InputString

func (Input_1_Item) AsToolCallRequest

func (t Input_1_Item) AsToolCallRequest() (ToolCallRequest, error)

AsToolCallRequest returns the union data inside the Input_1_Item as a ToolCallRequest

func (Input_1_Item) AsToolResult

func (t Input_1_Item) AsToolResult() (ToolResult, error)

AsToolResult returns the union data inside the Input_1_Item as a ToolResult

func (*Input_1_Item) FromInputString

func (t *Input_1_Item) FromInputString(v InputString) error

FromInputString overwrites any union data inside the Input_1_Item as the provided InputString

func (*Input_1_Item) FromToolCallRequest

func (t *Input_1_Item) FromToolCallRequest(v ToolCallRequest) error

FromToolCallRequest overwrites any union data inside the Input_1_Item as the provided ToolCallRequest

func (*Input_1_Item) FromToolResult

func (t *Input_1_Item) FromToolResult(v ToolResult) error

FromToolResult overwrites any union data inside the Input_1_Item as the provided ToolResult

func (Input_1_Item) MarshalJSON

func (t Input_1_Item) MarshalJSON() ([]byte, error)

func (*Input_1_Item) MergeInputString

func (t *Input_1_Item) MergeInputString(v InputString) error

MergeInputString performs a merge with any union data inside the Input_1_Item, using the provided InputString

func (*Input_1_Item) MergeToolCallRequest

func (t *Input_1_Item) MergeToolCallRequest(v ToolCallRequest) error

MergeToolCallRequest performs a merge with any union data inside the Input_1_Item, using the provided ToolCallRequest

func (*Input_1_Item) MergeToolResult

func (t *Input_1_Item) MergeToolResult(v ToolResult) error

MergeToolResult performs a merge with any union data inside the Input_1_Item, using the provided ToolResult

func (*Input_1_Item) UnmarshalJSON

func (t *Input_1_Item) UnmarshalJSON(b []byte) error

type ModelCapability

type ModelCapability string

ModelCapability defines model for ModelCapability.

const (
	Chat           ModelCapability = "chat"
	Classification ModelCapability = "classification"
	Code           ModelCapability = "code"
	Embedding      ModelCapability = "embedding"
	FineTuning     ModelCapability = "fine_tuning"
	FunctionCall   ModelCapability = "function_call"
	Reasoning      ModelCapability = "reasoning"
	Vision         ModelCapability = "vision"
)

Defines values for ModelCapability.

func (ModelCapability) Valid

func (e ModelCapability) Valid() bool

Valid indicates whether the value is a known member of the ModelCapability enum.

type ModelInfo

type ModelInfo struct {
	// Capabilities Capabilities supported by the model.
	Capabilities []ModelCapability `json:"capabilities"`

	// EmbeddingDimension Dimension of the model's embedding output (only applicable for embedding-capable models)
	EmbeddingDimension *int `json:"embeddingDimension,omitempty"`

	// Id Unique identifier of the model.
	Id string `json:"id"`

	// Label Human-readable model name.
	Label string `json:"label"`

	// MaxTokens Maximum number of tokens supported by the model.
	MaxTokens *int `json:"maxTokens,omitempty"`

	// Provider Provider that hosts the model.
	Provider string `json:"provider"`

	// TokenModifier Multiplier to apply to input token count when estimating usage for billing purposes (e.g. 1.2 means "20% more tokens than actual input count")
	TokenModifier float32 `json:"tokenModifier"`
}

ModelInfo Information about an available LLM model.

type Options

type Options struct {
	FrequencyPenalty *float32 `json:"frequencyPenalty,omitempty"`
	MaxTokens        *int     `json:"maxTokens,omitempty"`
	PresencePenalty  *float32 `json:"presencePenalty,omitempty"`
	Seed             *int     `json:"seed,omitempty"`
	Temperature      *float32 `json:"temperature,omitempty"`
	TopK             *int     `json:"topK,omitempty"`
	TopP             *float32 `json:"topP,omitempty"`
}

Options Model generation options.

type ProviderInfo

type ProviderInfo struct {
	// Id Provider identifier (e.g. OpenAI, Anthropic, Local).
	Id string `json:"id"`

	// Models Concrete models (only populated for Local provider).
	Models []ModelInfo `json:"models"`
}

ProviderInfo defines model for ProviderInfo.

type ResponseFormat

type ResponseFormat struct {
	Description *string                `json:"description,omitempty"`
	Name        string                 `json:"name"`
	Schema      map[string]interface{} `json:"schema"`
}

ResponseFormat Structured response format for LLM outputs.

type Tool

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

Tool defines model for Tool.

func (Tool) AsExternalTool

func (t Tool) AsExternalTool() (ExternalTool, error)

AsExternalTool returns the union data inside the Tool as a ExternalTool

func (Tool) AsWebSearchTool

func (t Tool) AsWebSearchTool() (WebSearchTool, error)

AsWebSearchTool returns the union data inside the Tool as a WebSearchTool

func (Tool) Discriminator

func (t Tool) Discriminator() (string, error)

func (*Tool) FromExternalTool

func (t *Tool) FromExternalTool(v ExternalTool) error

FromExternalTool overwrites any union data inside the Tool as the provided ExternalTool

func (*Tool) FromWebSearchTool

func (t *Tool) FromWebSearchTool(v WebSearchTool) error

FromWebSearchTool overwrites any union data inside the Tool as the provided WebSearchTool

func (Tool) MarshalJSON

func (t Tool) MarshalJSON() ([]byte, error)

func (*Tool) MergeExternalTool

func (t *Tool) MergeExternalTool(v ExternalTool) error

MergeExternalTool performs a merge with any union data inside the Tool, using the provided ExternalTool

func (*Tool) MergeWebSearchTool

func (t *Tool) MergeWebSearchTool(v WebSearchTool) error

MergeWebSearchTool performs a merge with any union data inside the Tool, using the provided WebSearchTool

func (*Tool) UnmarshalJSON

func (t *Tool) UnmarshalJSON(b []byte) error

func (Tool) ValueByDiscriminator

func (t Tool) ValueByDiscriminator() (interface{}, error)

type ToolCallRequest

type ToolCallRequest struct {
	// Arguments Arguments passed to the function tool.
	Arguments json.RawMessage `json:"arguments"`

	// CallId Unique ID of the function tool call request.
	CallId string `json:"callId"`

	// Name Name of the function tool called.
	Name string `json:"name"`
}

ToolCallRequest Request made by the model to call an external tool.

type ToolResult

type ToolResult struct {
	// CallId Unique ID of the external tool call request.
	CallId string `json:"callId"`

	// Name Name of the external tool called.
	Name string `json:"name"`

	// Output Output returned by the external tool.
	Output map[string]interface{} `json:"output"`
}

ToolResult Result of an external tool execution.

type WebSearchTool

type WebSearchTool struct {
	Type WebSearchToolType `json:"type"`
}

WebSearchTool A built-in web search tool that allows the model to search the web.

type WebSearchToolType

type WebSearchToolType string

WebSearchToolType defines model for WebSearchTool.Type.

const (
	WebSearch WebSearchToolType = "web_search"
)

Defines values for WebSearchToolType.

func (WebSearchToolType) Valid

func (e WebSearchToolType) Valid() bool

Valid indicates whether the value is a known member of the WebSearchToolType enum.

Jump to

Keyboard shortcuts

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