llm

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package llm 은 모델 API 클라이언트다 — OpenAI 호환 Chat Completions(Upstage · OpenAI · Gemini · 사내 vLLM 등)와 Anthropic Messages. 어느 것을 쓸지는 Factory 가 설정의 공급자로 고른다.

Index

Constants

View Source
const (
	DefaultBaseURL = "https://api.upstage.ai/v1"
	DefaultModel   = "solar-pro4"
)

DefaultBaseURL · DefaultModel 은 Upstage 의 Chat Completions 와 기본 모델이다.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnthropicClient

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

AnthropicClient 는 Anthropic Messages API 클라이언트다. 시스템 프롬프트는 별도 필드, 도구 호출은 tool_use 블록, 도구 결과는 user 메시지의 tool_result 블록이다.

func NewAnthropic

func NewAnthropic(cfg Config) *AnthropicClient

func (*AnthropicClient) Complete

type Client

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

func New

func New(cfg Config) *Client

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, req port.CompletionRequest) (domain.Message, error)

Complete 는 한 번 묻는다. 도구가 있으면 모델이 고르게(tool_choice=auto), 없으면 도구 필드를 보내지 않는다.

func (*Client) Model

func (c *Client) Model() string

Model 은 쓰는 모델 이름이다(상태 API 가 보인다).

type Config

type Config struct {
	BaseURL string
	APIKey  string
	Model   string
	// Timeout 은 한 번 묻는 상한이다. 0 이면 90초.
	Timeout time.Duration
}

type Factory

type Factory struct{}

Factory 는 설정의 공급자 프로토콜에 맞는 클라이언트를 만든다.

func (Factory) New

func (Factory) New(s domain.Settings) (port.LLM, error)

Jump to

Keyboard shortcuts

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