port

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: 2 Imported by: 0

Documentation

Overview

Package port 는 AI 어시스턴트가 바깥과 만나는 자리다 — 모델(LLM)과 도구(MCP).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletionRequest

type CompletionRequest struct {
	Messages      []domain.Message
	Tools         []domain.ToolSpec
	ForbidToolUse bool
	// RequireToolUse 는 이번 라운드에 도구를 반드시 하나 부르게 한다(조회 질문의 첫 라운드). ForbidToolUse 가
	// 참이면 그쪽이 이긴다.
	RequireToolUse bool
}

CompletionRequest 는 모델에 한 번 묻는 내용이다. ForbidToolUse 면 도구 정의는 보내되 쓰지 못하게 한다 — 기록에 도구 호출이 있으면 정의가 있어야 받는 공급자(Anthropic)가 있다.

type Credentials

type Credentials map[string]string

Credentials 는 도구가 API 를 부를 때 실을 요청자의 인증 헤더다(Authorization · X-User-*). 도구는 질문한 사용자의 권한으로만 돈다.

type LLM

type LLM interface {
	Complete(ctx context.Context, req CompletionRequest) (domain.Message, error)
}

LLM 은 OpenAI 호환 Chat Completions 모델이다. 응답 메시지는 답(Content)이거나 도구 호출(ToolCalls)이다.

type LLMFactory

type LLMFactory interface {
	New(s domain.Settings) (LLM, error)
}

LLMFactory 는 설정의 공급자에 맞는 모델 클라이언트를 만든다.

type SettingsRepository

type SettingsRepository interface {
	Get(ctx context.Context, orgID string) (*domain.Settings, error)
	Save(ctx context.Context, s domain.Settings) error
	Delete(ctx context.Context, orgID string) error
}

SettingsRepository 는 조직의 어시스턴트 설정이다. 키는 저장소가 암호화한다. 설정이 없으면 Get 은 nil, nil 이다.

type ToolSession

type ToolSession interface {
	ListTools(ctx context.Context) ([]domain.ToolSpec, error)
	// CallTool 은 도구를 부른다. isError 는 도구가 실패를 결과로 돌려준 것(권한 없음 · 없는 스택)이고,
	// err 는 도구를 부르지 못한 것이다.
	CallTool(ctx context.Context, name, arguments string) (output string, isError bool, err error)
	Close() error
}

ToolSession 은 한 질문 동안 쓰는 도구 묶음이다.

type ToolSessionOpener

type ToolSessionOpener interface {
	Open(ctx context.Context, creds Credentials) (ToolSession, error)
}

ToolSessionOpener 는 요청자의 인증으로 도구 세션을 연다.

Jump to

Keyboard shortcuts

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