anthropic

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(id, name string, v *Config, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)

Create 创建驱动实例

func NewFactory

func NewFactory() eosc.IExtenderDriverFactory

NewFactory 创建service_http驱动工厂

func Register

func Register(register eosc.IExtenderDriverRegister)

Register 注册驱动

Types

type Chat

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

func NewChat

func NewChat() *Chat

func (*Chat) Endpoint

func (c *Chat) Endpoint() string

func (*Chat) RequestConvert

func (c *Chat) RequestConvert(ctx eocontext.EoContext, extender map[string]interface{}) error

func (*Chat) ResponseConvert

func (c *Chat) ResponseConvert(ctx eocontext.EoContext) error

type ClientRequest

type ClientRequest struct {
	Messages []*Message `json:"messages"`
}

type Config

type Config struct {
	APIKey  string `json:"anthropic_api_key"`
	Base    string `json:"anthropic_api_url"`
	Version string `json:"anthropic_api_version"`
}

type Content

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

type Converter

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

func (*Converter) RequestConvert

func (c *Converter) RequestConvert(ctx eocontext.EoContext, extender map[string]interface{}) error

func (*Converter) ResponseConvert

func (c *Converter) ResponseConvert(ctx eocontext.EoContext) error

type Error added in v0.19.5

type Error struct {
	Message string `json:"message"`
	Type    string `json:"type"`
}

type IModelMode

type IModelMode interface {
	Endpoint() string
	convert.IConverter
}

type Message

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

type ModelConfig

type ModelConfig struct {
	MaxTokens      int     `json:"max_tokens"`
	ResponseFormat string  `json:"response_format"`
	Temperature    float64 `json:"temperature"`
	TopP           float64 `json:"top_p"`
	TopK           int     `json:"top_k"`
}

type Response

type Response struct {
	Id         string    `json:"id"`
	Model      string    `json:"model"`
	Role       string    `json:"role"`
	Contents   []Content `json:"content"`
	StopReason string    `json:"stop_reason"`
	Usage      Usage     `json:"usage"`
	Error      Error     `json:"error"`
}

type Usage added in v0.19.5

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

Jump to

Keyboard shortcuts

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