cloudflare

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ModelList = []string{
	"@cf/meta/llama-3.1-8b-instruct",
	"@cf/meta/llama-2-7b-chat-fp16",
	"@cf/meta/llama-2-7b-chat-int8",
	"@cf/mistral/mistral-7b-instruct-v0.1",
	"@hf/thebloke/deepseek-coder-6.7b-base-awq",
	"@hf/thebloke/deepseek-coder-6.7b-instruct-awq",
	"@cf/deepseek-ai/deepseek-math-7b-base",
	"@cf/deepseek-ai/deepseek-math-7b-instruct",
	"@cf/thebloke/discolm-german-7b-v1-awq",
	"@cf/tiiuae/falcon-7b-instruct",
	"@cf/google/gemma-2b-it-lora",
	"@hf/google/gemma-7b-it",
	"@cf/google/gemma-7b-it-lora",
	"@hf/nousresearch/hermes-2-pro-mistral-7b",
	"@hf/thebloke/llama-2-13b-chat-awq",
	"@cf/meta-llama/llama-2-7b-chat-hf-lora",
	"@cf/meta/llama-3-8b-instruct",
	"@hf/thebloke/llamaguard-7b-awq",
	"@hf/thebloke/mistral-7b-instruct-v0.1-awq",
	"@hf/mistralai/mistral-7b-instruct-v0.2",
	"@cf/mistral/mistral-7b-instruct-v0.2-lora",
	"@hf/thebloke/neural-chat-7b-v3-1-awq",
	"@cf/openchat/openchat-3.5-0106",
	"@hf/thebloke/openhermes-2.5-mistral-7b-awq",
	"@cf/microsoft/phi-2",
	"@cf/qwen/qwen1.5-0.5b-chat",
	"@cf/qwen/qwen1.5-1.8b-chat",
	"@cf/qwen/qwen1.5-14b-chat-awq",
	"@cf/qwen/qwen1.5-7b-chat-awq",
	"@cf/defog/sqlcoder-7b-2",
	"@hf/nexusflow/starling-lm-7b-beta",
	"@cf/tinyllama/tinyllama-1.1b-chat-v1.0",
	"@hf/thebloke/zephyr-7b-beta-awq",
}

Functions

func Handler

func Handler(c *gin.Context, resp *http.Response, promptTokens int, modelName string) (*model.ErrorWithStatusCode, *model.Usage)

func StreamHandler

func StreamHandler(c *gin.Context, resp *http.Response, promptTokens int, modelName string) (*model.ErrorWithStatusCode, *model.Usage)

Types

type Adaptor

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

func (*Adaptor) ConvertImageRequest

func (*Adaptor) ConvertImageRequest(request *model.ImageRequest) (any, error)

ConvertImageRequest implements adaptor.Adaptor.

func (*Adaptor) ConvertRequest

func (a *Adaptor) ConvertRequest(c *gin.Context, relayMode int, request *model.GeneralOpenAIRequest) (any, error)

func (*Adaptor) DoRequest

func (a *Adaptor) DoRequest(c *gin.Context, meta *meta.Meta, requestBody io.Reader) (*http.Response, error)

func (*Adaptor) DoResponse

func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, meta *meta.Meta) (usage *model.Usage, err *model.ErrorWithStatusCode)

func (*Adaptor) GetChannelName

func (a *Adaptor) GetChannelName() string

func (*Adaptor) GetModelList

func (a *Adaptor) GetModelList() []string

func (*Adaptor) GetRequestURL

func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error)

func (*Adaptor) Init

func (a *Adaptor) Init(meta *meta.Meta)

func (*Adaptor) SetupRequestHeader

func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, meta *meta.Meta) error

type Request

type Request struct {
	Messages    []model.Message `json:"messages,omitempty"`
	Lora        string          `json:"lora,omitempty"`
	MaxTokens   int             `json:"max_tokens,omitempty"`
	Prompt      string          `json:"prompt,omitempty"`
	Raw         bool            `json:"raw,omitempty"`
	Stream      bool            `json:"stream,omitempty"`
	Temperature *float64        `json:"temperature,omitempty"`
}

func ConvertCompletionsRequest

func ConvertCompletionsRequest(textRequest model.GeneralOpenAIRequest) *Request

Jump to

Keyboard shortcuts

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