Skip to content

Latest commit

 

History

History
191 lines (137 loc) · 5.71 KB

File metadata and controls

191 lines (137 loc) · 5.71 KB

Providers

Reference for LLM and embedding providers supported by hatch. Providers are selected via config or environment variable and swapped without changing any application code.


Overview

hatch separates two provider concerns:

Concern Interface Config key Env var
LLM internal/llm.LLM llm_provider HATCH_LLM_PROVIDER
Embedder internal/embedder.Embedder embed_provider HATCH_EMBED_PROVIDER

Both are provider-agnostic by design — the interfaces accept any conforming implementation. Set the provider name via environment variable, or run hatch config init to create ~/.hatch/config.yaml and edit it there. The ~/.hatch/ folder does not exist until that command is run for the first time.


LLM Providers

Anthropic

Generates completions via the Anthropic Messages API.

Property Value
Provider key anthropic
Default yes
Required env ANTHROPIC_API_KEY
Recommended claude-3-5-haiku-20241022

Set HATCH_LLM_PROVIDER=anthropic and provide ANTHROPIC_API_KEY in .env or the shell environment. No additional dependencies required.

OpenAI

Generates completions via the OpenAI Chat Completions API.

Property Value
Provider key openai
Default no
Required env OPENAI_API_KEY
Recommended gpt-4o-mini

Set HATCH_LLM_PROVIDER=openai and provide OPENAI_API_KEY.

Google Gemini

Generates completions via the Google Generative AI API.

Property Value
Provider key gemini
Default no
Required env GEMINI_API_KEY
Recommended gemini-2.0-flash

Set HATCH_LLM_PROVIDER=gemini and provide GEMINI_API_KEY.

Ollama

Generates completions via a locally running Ollama instance. No API key required — Ollama runs entirely on-device.

Property Value
Provider key ollama
Default no
Required env none
Default host http://localhost:11434
Recommended llama3.2, mistral

Set HATCH_LLM_PROVIDER=ollama. Ollama must be running locally with the target model pulled (ollama pull llama3.2).


Embedding Providers

OpenAI Embedder

Generates embeddings via the OpenAI Embeddings API.

Property Value
Provider key openai
Default no
Required env OPENAI_API_KEY
Recommended text-embedding-3-small
Vector dim 1536 (text-embedding-3-small)

Set HATCH_EMBED_PROVIDER=openai and provide OPENAI_API_KEY.

Google Gemini Embedder

Generates embeddings via the Google Generative AI Embeddings API.

Property Value
Provider key gemini
Default no
Required env GEMINI_API_KEY
Recommended text-embedding-004
Vector dim 768 (text-embedding-004)

Set HATCH_EMBED_PROVIDER=gemini and provide GEMINI_API_KEY.

Ollama Embedder

Generates embeddings via a locally running Ollama instance. No API key required — runs entirely on-device.

Property Value
Provider key ollama
Default yes
Required env none
Default host http://localhost:11434
Recommended nomic-embed-text
Vector dim 768 (nomic-embed-text)

Set HATCH_EMBED_PROVIDER=ollama. Pull the embedding model first: ollama pull nomic-embed-text.


Configuration Examples

Local / offline (Ollama for both)

llm_provider: ollama
embed_provider: ollama

Cloud LLM + cloud embeddings (OpenAI)

llm_provider: openai
embed_provider: openai

Mixed (Anthropic LLM + Ollama embeddings)

llm_provider: anthropic
embed_provider: ollama

Google only (Gemini LLM + Gemini embeddings)

llm_provider: gemini
embed_provider: gemini

Implementation Status

Provider LLM Embedder Milestone
Fake (test double) M1
OpenAI 🔲 M2 / M3
Anthropic 🔲 M3
Google Gemini 🔲 M2 / M3
Ollama 🔲 🔲 v4

Related