cloudflareAI

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioResponse

type AudioResponse struct {
	Result AudioResult `json:"result,omitempty"`
	CloudflareAIError
}

type AudioResult

type AudioResult struct {
	Text      string                 `json:"text,omitempty"`
	WordCount int                    `json:"word_count,omitempty"`
	Words     []types.AudioWordsList `json:"words,omitempty"`
	Vtt       string                 `json:"vtt,omitempty"`
}

type ChatRequest

type ChatRequest struct {
	Messages  []Message `json:"messages"`
	Stream    bool      `json:"stream,omitempty"`
	MaxTokens int       `json:"max_tokens,omitempty"`
}

type ChatRespone

type ChatRespone struct {
	Result ChatResult `json:"result,omitempty"`
	CloudflareAIError
}

type ChatResult

type ChatResult struct {
	Response string `json:"response"`
}

type CloudflareAIError

type CloudflareAIError struct {
	Error []struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"errors,omitempty"`
	Success bool `json:"success"`
}

type CloudflareAIProvider

type CloudflareAIProvider struct {
	base.BaseProvider
	AccountID string
	CFToken   string
}

func (*CloudflareAIProvider) CreateChatCompletion

func (*CloudflareAIProvider) CreateImageGenerations

func (*CloudflareAIProvider) CreateTranscriptions

func (*CloudflareAIProvider) GetFullRequestURL

func (p *CloudflareAIProvider) GetFullRequestURL(modelName string) string

func (*CloudflareAIProvider) GetRequestHeaders

func (p *CloudflareAIProvider) GetRequestHeaders() (headers map[string]string)

获取请求头

type CloudflareAIProviderFactory

type CloudflareAIProviderFactory struct{}

func (CloudflareAIProviderFactory) Create

创建 CloudflareAIProvider

type CloudflareAIStreamHandler

type CloudflareAIStreamHandler struct {
	Usage   *types.Usage
	Request *types.ChatCompletionRequest
}

type ImageObject

type ImageObject struct {
	Image []float64 `json:"image"`
}

type ImageRequest

type ImageRequest struct {
	Prompt   string      `json:"prompt"`
	Image    interface{} `json:"image,omitempty"` // 可以是 string 或者 ImageObject
	Mask     interface{} `json:"mask,omitempty"`  // 可以是 string 或者 MaskObject
	NumSteps int         `json:"num_steps,omitempty"`
	Strength float64     `json:"strength,omitempty"`
	Guidance float64     `json:"guidance,omitempty"`
}

type MaskObject

type MaskObject struct {
	Mask []float64 `json:"mask"`
}

type Message

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

Jump to

Keyboard shortcuts

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