providers

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package providers is a shared helper used by the runnable examples to pick an LLM provider from the environment.

The precedence order — OpenAI → Anthropic → Gemini → Azure OpenAI → Vertex AI → AWS Bedrock → Mistral → Ollama → OpenAI-compatible — is arbitrary; it simply lets an example script run with whatever credentials the user happens to have exported. Every example wired through Pick automatically gains support for the full provider matrix.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvHint

func EnvHint() string

EnvHint returns the multi-line message to print when no provider is configured. Consistent across examples so users see the same option set.

func Pick

func Pick() (model.Provider, string)

Pick returns the first configured provider from the environment along with its human-readable name, or (nil, "") if nothing is configured.

Recognized env vars (checked in order):

OPENAI_API_KEY                              → OpenAI
ANTHROPIC_API_KEY                           → Anthropic
GEMINI_API_KEY                              → Google Gemini (AI Studio)
AZURE_OPENAI_API_KEY + AZURE_OPENAI_ENDPOINT
  + AZURE_OPENAI_DEPLOYMENT                 → Azure OpenAI
GOOGLE_CLOUD_PROJECT + GOOGLE_ACCESS_TOKEN  → Google Cloud Vertex AI
AWS_REGION + AWS_ACCESS_KEY_ID
  + AWS_SECRET_ACCESS_KEY                   → AWS Bedrock
MISTRAL_API_KEY                             → Mistral
OLLAMA_HOST                                 → Ollama (local)
OPENAI_COMPATIBLE_BASE_URL
  + OPENAI_COMPATIBLE_MODEL                 → any OpenAI-compatible endpoint

Types

This section is empty.

Jump to

Keyboard shortcuts

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