generic

package
v1.4.3-rc0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice

type Choice struct {
	Index        int         `json:"index"`
	Delta        Delta       `json:"delta"`
	Logprobs     interface{} `json:"logprobs"` // null or complex object, hence interface{}
	FinishReason string      `json:"finish_reason"`
}

type Delta

type Delta struct {
	Content   any         `json:"content"`
	Role      string      `json:"role"`
	ToolCalls []ToolsCall `json:"tool_calls"`
}

type Func

type Func struct {
	Arguments string `json:"arguments"`
	Name      string `json:"name"`
}

type StreamCompleter

type StreamCompleter struct {
	Model            string
	FrequencyPenalty *float64
	MaxTokens        *int
	PresencePenalty  *float64
	Temperature      *float64
	TopP             *float64
	ToolChoice       *string
	Clean            func([]models.Message) []models.Message `json:"-"`
	// contains filtered or unexported fields
}

StreamCompleter is a struct which follows the model for both OpenAI and Mistral

func (*StreamCompleter) InternalRegisterTool

func (g *StreamCompleter) InternalRegisterTool(tool tools.AiTool)

func (*StreamCompleter) Setup

func (s *StreamCompleter) Setup(apiKeyEnv, url, debugEnv string) error

func (*StreamCompleter) StreamCompletions

func (s *StreamCompleter) StreamCompletions(ctx context.Context, chat models.Chat) (chan models.CompletionEvent, error)

streamCompletions taking the messages as prompt conversation. Returns the messages from the chat model.

type Tool

type Tool struct {
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Inputs      tools.InputSchema `json:"parameters"`
}

type ToolSuper

type ToolSuper struct {
	Type     string `json:"type"`
	Function Tool   `json:"function"`
}

type ToolsCall

type ToolsCall struct {
	Function Func   `json:"function"`
	ID       string `json:"id"`
	Index    int    `json:"index"`
	Type     string `json:"type"`
}

Jump to

Keyboard shortcuts

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