Python Examples
00_fetch_model.py
Fetch a model before first use.
01_chat.py
Chat basics — start a conversation and add a follow-up.
02_streaming.py
Stream tokens to stdout.
03_tokenize_text.py
Tokenize text — encode, decode, and inspect tokens.
04_prompt_templates.py
Build prompts with templates.
05_manage_models.py
Manage models — cache, download, and inspect files.
06_manage_client.py
Reuse one model across multiple chats.
07_client_ask.py
Use Client for one-shot tasks and shared models.
08_generation_settings.py
Control generation behavior with temperature and limits.
09_convert_model.py
Convert a model for local use.
10_manage_profiles.py
Manage persistent chat sessions with profiles.
11_save_restore.py
Save and restore a chat session.
12_embeddings.py
Get text embeddings for similarity and search.
13_chat_template.py
Format messages with a chat template.
14_batch_chat.py
Run multiple prompts and save results.
15_token_budget.py
Manage a token budget with truncation.
16_structured_output.py
Get structured JSON responses.
17_chat_history.py
Inspect and manage chat history.
18_generation_settings.py
Adjust basic generation settings.
19_branching.py
Branch conversations to explore alternatives.
20_streaming_validation.py
Validate JSON as it streams in.