openaipreset

package
v1.28.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package openaipreset는 pkg/llm의 OpenAI 호환 JSON 생성 경로를 functional-options 클라이언트로 감싼 재사용 프리셋이다.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UsageFromResponseUsage

func UsageFromResponseUsage(usage *responses.ResponseUsage) sharedllm.Usage

Types

type Client

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

func New

func New(baseURL, apiKey, model string, opts ...Option) (*Client, error)

func (*Client) Complete

func (*Client) GenerateJSON

func (c *Client) GenerateJSON(ctx context.Context, systemPrompt, userPrompt string, schema map[string]any) (string, error)

func (*Client) Model

func (c *Client) Model() string

func (*Client) RunInto

func (c *Client) RunInto(ctx context.Context, task, prompt string, schema map[string]any, out any) error

type CompletionRequest

type CompletionRequest struct {
	Messages        []Message
	Model           string
	Temperature     *float64
	ReasoningEffort string
	WebSearch       bool
	CacheKey        string
	ResponseFormat  *ResponseFormat
}

type CompletionResponse

type CompletionResponse struct {
	Text  string
	Model string
	Usage sharedllm.Usage
}

func CompletionFromResponse

func CompletionFromResponse(resp *responses.Response, requestedModel string) CompletionResponse

type Message

type Message struct {
	Role    string
	Content string
}

type Option

type Option func(*config)

func WithAllowChatCompletionsFallback

func WithAllowChatCompletionsFallback(enabled bool) Option

func WithChatCompletions

func WithChatCompletions() Option

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithReasoningEffort

func WithReasoningEffort(effort string) Option

func WithSchemaName

func WithSchemaName(name string) Option

func WithTemperature

func WithTemperature(temperature float64) Option

func WithUsageReporter

func WithUsageReporter(reporter sharedllm.UsageReporter) Option

func WithWebSearch

func WithWebSearch(enabled bool) Option

type ResponseFormat

type ResponseFormat struct {
	Name   string
	Schema map[string]any
	Strict bool
}

Jump to

Keyboard shortcuts

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