ai

package
v1.32.0 Latest Latest
Warning

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

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

Documentation

Overview

Package ai is the single-import surface for the SDK's AI subsystem. It owns the registry of concrete provider adapters and re-exports the shared types so plugins depend on one package:

  • ai/provider holds the provider-neutral contract (Client, Config, Schema, AnalyzeResponse, Error) and the base adapters build on.
  • ai/openai (and future sibling packages) hold concrete adapters, registered in clientFactories below.
  • ai/assist holds the plugin-facing accelerator surfaced here as Assist.

See docs/ai-client.md and docs/ai-assist.md.

Index

Constants

View Source
const (
	ProviderOpenAI    = openai.Provider
	ProviderAnthropic = anthropic.Provider

	EvidenceType = assist.EvidenceType

	ErrorKindUnauthorized      = provider.ErrorKindUnauthorized
	ErrorKindRateLimited       = provider.ErrorKindRateLimited
	ErrorKindTimeout           = provider.ErrorKindTimeout
	ErrorKindProviderError     = provider.ErrorKindProviderError
	ErrorKindInvalidRequest    = provider.ErrorKindInvalidRequest
	ErrorKindInvalidResponse   = provider.ErrorKindInvalidResponse
	ErrorKindUnsupportedConfig = provider.ErrorKindUnsupportedConfig
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzeResponse

type AnalyzeResponse = provider.AnalyzeResponse

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

type Client

type Client = provider.Client

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

func NewClient

func NewClient(config sdkconfig.Config) (Client, error)

NewClient is the default constructor for plugins: it extracts the ai_* settings from the primary end user config and builds a Client from them. When AI is not configured it returns (nil, nil) — check the returned client, not just the error, and treat a nil client as "AI disabled".

func NewClientWithAIConfig added in v1.31.1

func NewClientWithAIConfig(config Config) (Client, error)

NewClientWithAIConfig builds a client from an explicit provider-neutral Config. It validates the config and dispatches to the adapter registered for config.Provider.

type Config

type Config = provider.Config

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

type Error

type Error = provider.Error

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

type ErrorKind

type ErrorKind = provider.ErrorKind

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

type EvidencePayload added in v1.31.1

type EvidencePayload = assist.EvidencePayload

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

type Provider

type Provider = provider.Provider

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

type Question added in v1.31.1

type Question = assist.Question

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

type Response added in v1.31.1

type Response = assist.Response

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

func Assist added in v1.31.1

func Assist(ctx context.Context, client Client, q Question) (Response, gemara.Evidence, error)

Assist runs an AI-assisted assessment via the assist package: it asks client for a structured Response answering q, then packages that verdict as a gemara.Evidence. See assist.Assist.

type ResponseMetadata

type ResponseMetadata = provider.ResponseMetadata

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

type Schema

type Schema = provider.Schema

Aliases for the provider-neutral contract and the assist accelerator types, so callers import only this package.

Directories

Path Synopsis
Package anthropic is the Anthropic Messages API adapter for the provider-neutral AI client contract.
Package anthropic is the Anthropic Messages API adapter for the provider-neutral AI client contract.
Package assist is the plugin-facing accelerator for AI-assisted assessment steps: it asks a provider-neutral client for a structured verdict against an SDK-owned schema and packages the answer as auditable gemara.Evidence.
Package assist is the plugin-facing accelerator for AI-assisted assessment steps: it asks a provider-neutral client for a structured verdict against an SDK-owned schema and packages the answer as auditable gemara.Evidence.
Package openai is the OpenAI Chat Completions adapter for the provider-neutral AI client contract.
Package openai is the OpenAI Chat Completions adapter for the provider-neutral AI client contract.
Package provider defines the provider-neutral contract callers use to talk to any AI backend, plus the shared base every concrete adapter builds on.
Package provider defines the provider-neutral contract callers use to talk to any AI backend, plus the shared base every concrete adapter builds on.

Jump to

Keyboard shortcuts

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