generic

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 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                                  `json:"-"`
	FrequencyPenalty *float64                                `json:"-"`
	MaxTokens        *int                                    `json:"-"`
	PresencePenalty  *float64                                `json:"-"`
	Temperature      *float64                                `json:"-"`
	TopP             *float64                                `json:"-"`
	ToolChoice       *string                                 `json:"-"`
	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