providers

package
v0.0.0-...-30b5f87 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnthropicVersionHeader          = "anthropic-version"
	AnthropicVersion2023_01_01      = "2023-01-01"
	AnthropicVersion2023_06_01      = "2023-06-01"
	AnthropicVersionLatest          = AnthropicVersion2023_06_01
	AnthropicStopReasonEndTurn      = "end_turn"
	AnthropicStopReasonMaxTokens    = "max_tokens"
	AnthropicStopReasonStopSequence = "stop_sequence"
	AnthropicStopReasonToolUse      = "tool_use"
	AnthropicStopReasonPauseTurn    = "pause_turn"
	AnthropicStopReasonRefusal      = "refusal"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnthropicContentBlock

type AnthropicContentBlock struct {
	Type   string                  `json:"type"`
	Text   string                  `json:"text,omitempty"`
	Source *AnthropicContentSource `json:"source,omitempty"`
	// Tool use fields
	ID    string `json:"id,omitempty"`
	Name  string `json:"name,omitempty"`
	Input any    `json:"input,omitempty"`
	// Tool result fields
	ToolUseID string `json:"tool_use_id,omitempty"`
	Content   string `json:"content,omitempty"`
	IsError   bool   `json:"is_error,omitempty"`
}

type AnthropicContentSource

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

type AnthropicMessage

type AnthropicMessage struct {
	Role    string `json:"role"`
	Content any    `json:"content"`
}

type AnthropicProvider

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

func NewAnthropicProvider

func NewAnthropicProvider(options ...dataplane.ProviderOption) *AnthropicProvider

func (*AnthropicProvider) Name

func (p *AnthropicProvider) Name() string

func (*AnthropicProvider) SetLLMClient

func (p *AnthropicProvider) SetLLMClient(client dataplane.LLMClient)

func (*AnthropicProvider) SetupRoutes

func (p *AnthropicProvider) SetupRoutes(mux *http.ServeMux, baseAuth func(http.Handler) http.Handler)

func (*AnthropicProvider) Shutdown

func (p *AnthropicProvider) Shutdown(ctx context.Context) error

type AnthropicRequest

type AnthropicRequest struct {
	Model         string             `json:"model"`
	MaxTokens     int                `json:"max_tokens"`
	Messages      []AnthropicMessage `json:"messages"`
	Temperature   *float64           `json:"temperature,omitempty"`
	TopP          *float64           `json:"top_p,omitempty"`
	TopK          *int               `json:"top_k,omitempty"`
	StopSequences []string           `json:"stop_sequences,omitempty"`
	Stream        bool               `json:"stream,omitempty"`
	System        string             `json:"system,omitempty"`
	Tools         []AnthropicTool    `json:"tools,omitempty"`
	ToolChoice    any                `json:"tool_choice,omitempty"`
}

type AnthropicResponse

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

type AnthropicStreamDelta

type AnthropicStreamDelta struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

type AnthropicStreamEvent

type AnthropicStreamEvent struct {
	Type  string          `json:"type"`
	Index int             `json:"index,omitempty"`
	Delta any             `json:"delta,omitempty"`
	Usage *AnthropicUsage `json:"usage,omitempty"`
}

type AnthropicTool

type AnthropicTool struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	InputSchema any    `json:"input_schema"`
}

type AnthropicUsage

type AnthropicUsage struct {
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
}

type OpenAIProvider

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

func NewOpenAIProvider

func NewOpenAIProvider(options ...dataplane.ProviderOption) *OpenAIProvider

func (*OpenAIProvider) Name

func (p *OpenAIProvider) Name() string

func (*OpenAIProvider) SetLLMClient

func (p *OpenAIProvider) SetLLMClient(client dataplane.LLMClient)

func (*OpenAIProvider) SetupRoutes

func (p *OpenAIProvider) SetupRoutes(mux *http.ServeMux, baseAuth func(http.Handler) http.Handler)

func (*OpenAIProvider) Shutdown

func (p *OpenAIProvider) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

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