Help us shape the future of Go! Take the 2026 Go Developer Survey

azuremodels

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package azuremodels provides a client for interacting with the Azure models API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatChoice

type ChatChoice struct {
	Delta        *chatChoiceDelta   `json:"delta,omitempty"`
	FinishReason string             `json:"finish_reason"`
	Index        int32              `json:"index"`
	Message      *chatChoiceMessage `json:"message,omitempty"`
}

ChatChoice represents a choice in a chat completion.

type ChatCompletion

type ChatCompletion struct {
	Choices []ChatChoice `json:"choices"`
}

ChatCompletion represents a chat completion.

type ChatCompletionOptions

type ChatCompletionOptions struct {
	MaxTokens   *int          `json:"max_tokens,omitempty"`
	Messages    []ChatMessage `json:"messages"`
	Model       string        `json:"model"`
	Stream      bool          `json:"stream,omitempty"`
	Temperature *float64      `json:"temperature,omitempty"`
	TopP        *float64      `json:"top_p,omitempty"`
}

ChatCompletionOptions represents available options for a chat completion request.

type ChatCompletionResponse

type ChatCompletionResponse struct {
	Reader sse.Reader[ChatCompletion]
}

ChatCompletionResponse represents a response to a chat completion request.

type ChatMessage

type ChatMessage struct {
	Content *string         `json:"content,omitempty"`
	Role    ChatMessageRole `json:"role"`
}

ChatMessage represents a message from a chat thread with a model.

type ChatMessageRole

type ChatMessageRole string

ChatMessageRole represents the role of a chat message.

const (
	// ChatMessageRoleAssistant represents a message from the model.
	ChatMessageRoleAssistant ChatMessageRole = "assistant"
	// ChatMessageRoleSystem represents a system message.
	ChatMessageRoleSystem ChatMessageRole = "system"
	// ChatMessageRoleUser represents a message from the user.
	ChatMessageRoleUser ChatMessageRole = "user"
)

type Client

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

Client provides a client for interacting with the Azure models API.

func NewClient

func NewClient(authToken string) *Client

NewClient returns a new client using the given auth token.

func (*Client) GetChatCompletionStream

func (c *Client) GetChatCompletionStream(ctx context.Context, req ChatCompletionOptions) (*ChatCompletionResponse, error)

GetChatCompletionStream returns a stream of chat completions for the given request.

func (*Client) GetModelDetails

func (c *Client) GetModelDetails(ctx context.Context, registry, modelName, version string) (*ModelDetails, error)

GetModelDetails returns the details of the specified model in a prticular registry.

func (*Client) ListModels

func (c *Client) ListModels(ctx context.Context) ([]*ModelSummary, error)

ListModels returns a list of available models.

type ModelDetails

type ModelDetails struct {
	Description               string   `json:"description"`
	Evaluation                string   `json:"evaluation"`
	License                   string   `json:"license"`
	LicenseDescription        string   `json:"license_description"`
	Notes                     string   `json:"notes"`
	Tags                      []string `json:"tags"`
	SupportedInputModalities  []string `json:"supported_input_modalities"`
	SupportedOutputModalities []string `json:"supported_output_modalities"`
	SupportedLanguages        []string `json:"supported_languages"`
	MaxOutputTokens           int      `json:"max_output_tokens"`
	MaxInputTokens            int      `json:"max_input_tokens"`
	RateLimitTier             string   `json:"rateLimitTier"`
}

ModelDetails includes detailed information about a model.

func (*ModelDetails) ContextLimits

func (m *ModelDetails) ContextLimits() string

ContextLimits returns a summary of the context limits for the model.

type ModelSummary

type ModelSummary struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	FriendlyName string `json:"friendly_name"`
	Task         string `json:"task"`
	Publisher    string `json:"publisher"`
	Summary      string `json:"summary"`
	Version      string `json:"version"`
	RegistryName string `json:"registry_name"`
}

ModelSummary includes basic information about a model.

func (*ModelSummary) HasName

func (m *ModelSummary) HasName(name string) bool

HasName checks if the model has the given name.

Jump to

Keyboard shortcuts

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