Chatbots

ellmer provides a simple interface to a wide range of LLM providers. Use the chat_ functions to initialize a Chat object for a specific provider and model. Once created, use the methods of the Chat object to send messages, receive responses, manage tools and extract structured data.

Chat

A chat

chat_anthropic() models_anthropic()

Chat with an Anthropic Claude model

chat_aws_bedrock() models_aws_bedrock()

Chat with an AWS bedrock model

chat_azure_openai()

Chat with a model hosted on Azure OpenAI

chat_cloudflare()

Chat with a model hosted on CloudFlare

chat_cortex_analyst()

Create a chatbot that speaks to the Snowflake Cortex Analyst

chat_databricks()

Chat with a model hosted on Databricks

chat_deepseek()

Chat with a model hosted on DeepSeek

chat_github()

Chat with a model hosted on the GitHub model marketplace

chat_google_gemini() chat_google_vertex() models_google_gemini() models_google_vertex()

Chat with a Google Gemini or Vertex AI model

chat_groq()

Chat with a model hosted on Groq

chat_huggingface()

Chat with a model hosted on Hugging Face Serverless Inference API

chat_mistral()

Chat with a model hosted on Mistral's La Platforme

chat_ollama() models_ollama()

Chat with a local Ollama model

chat_openai() models_openai()

Chat with an OpenAI model

chat_openrouter()

Chat with one of the many models hosted on OpenRouter

chat_perplexity()

Chat with a model hosted on perplexity.ai

chat_portkey() models_portkey()

Chat with a model hosted on PortkeyAI

chat_snowflake()

Chat with a model hosted on Snowflake

chat_vllm() models_vllm()

Chat with a model hosted by vLLM

token_usage()

Report on token usage in the current session

Chat helpers

create_tool_def()

Create metadata for a tool

content_image_url() content_image_file() content_image_plot()

Encode images for chat input

content_pdf_file() content_pdf_url()

Encode PDFs content for chat input

live_console() live_browser()

Open a live chat application

interpolate() interpolate_file() interpolate_package()

Helpers for interpolating data into prompts

google_upload()

Upload a file to gemini

Parallel and batch chat

batch_chat() batch_chat_structured() batch_chat_completed()

Submit multiple chats in one batch

parallel_chat() parallel_chat_structured()

Submit multiple chats in parallel

Tools and structured data

tool()

Define a tool

tool_annotations()

Tool annotations

tool_reject()

Reject a tool call

type_boolean() type_integer() type_number() type_string() type_enum() type_array() type_object()

Type specifications

Objects

These classes abstract away behaviour differences in chat providers so that for typical ellmer use you don’t need to worry about them. You’ll need to learn more about the objects if you’re doing something that’s only supported by one provider, or if you’re implementing a new provider.

Provider()

A chatbot provider

Chat

A chat

Turn()

A user or assistant turn

Content() ContentText() ContentImage() ContentImageRemote() ContentImageInline() ContentToolRequest() ContentToolResult() ContentThinking() ContentPDF()

Content types received from and sent to a chatbot

TypeBasic() TypeEnum() TypeArray() TypeObject()

Type definitions for function calling and structured data extraction.

Utilities

contents_text() contents_html() contents_markdown()

Format contents into a textual representation

params()

Standard model parameters

Deprecated functions

chat_cortex() chat_azure() chat_bedrock() chat_claude() chat_gemini()

Deprecated functions