{"repo": "0xlazai/alith", "files": {"website/src/content/features/llm.mdx": {"3df46365605d504baba93527140115358a423643": {"t": 1785746477.006362, "n": 6454, "h": "825ee7d09637483b", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, Chat, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, Chat, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1 Model\n )?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, Chat, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## HuggingFace Models\n\n```rust\nuse alith::HuggingFaceLoader;\n\nfn main() -> Result<(), anyhow::Error> {\n let _path = HuggingFaceLoader::new().load_file(\"model.safetensors\", \"gpt2\")?;\n Ok(())\n}\n```\n\n> Note: we can use the `HF_ENDPOINT` env to set different huggingface endpoints.\n\n## GGUF Models\n\n```rust\nuse alith::{GgufLoader, GgufLoaderTrait};\n\nfn main() -> Result<(), anyhow::Error> {\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .load()?;\n\n // By default we attempt to extract everything we need from the GGUF file.\n // If you need to specifiy the tokenizer or chat template to use, you can add a hf repo to load from.\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .hf_config_repo_id(\"meta-llama/Meta-Llama-3-8B-Instruct\")\n .load()?;\n\n // We can also load the model from the local path\n let _model = GgufLoader::default()\n .local_quant_file_path(\"/root/models/qwen2.5-1.5b-instruct-q5_k_m.gguf\")\n .load()?;\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"deepseek-chat\", # or `deepseek-reasoner` for DeepSeek R1\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nasync function main() {\n const agent = new Agent({\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n });\n\n const response = await agent.prompt(\"Entertain me!\");\n console.log(response.output_text);\n}\n\nmain().catch(console.error);\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nasync function main() {\n const agent = new Agent({\n model: \"deepseek-chat\",\n apiKey: \"\",\n baseUrl: \"https://api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n });\n\n const response = await agent.prompt(\"Entertain me!\");\n console.log(response.output_text);\n}\n\nmain().catch(console.error);\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nasync function main() {\n const agent = new Agent({\n model: \"claude-3-5-sonnet\",\n apiKey: \"\",\n baseUrl: \"https://api.anthropic.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n });\n\n const response = await agent.prompt(\"Entertain me!\");\n console.log(response.output_text);\n}\n\nmain().catch(console.error);\n```\n\n\n\n"}, "b28a7050b3fbaecebac05e4fb6f4a1a443cf350c": {"t": 1785764746.719693, "n": 6454, "h": "825ee7d09637483b", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, Chat, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, Chat, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1 Model\n )?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, Chat, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## HuggingFace Models\n\n```rust\nuse alith::HuggingFaceLoader;\n\nfn main() -> Result<(), anyhow::Error> {\n let _path = HuggingFaceLoader::new().load_file(\"model.safetensors\", \"gpt2\")?;\n Ok(())\n}\n```\n\n> Note: we can use the `HF_ENDPOINT` env to set different huggingface endpoints.\n\n## GGUF Models\n\n```rust\nuse alith::{GgufLoader, GgufLoaderTrait};\n\nfn main() -> Result<(), anyhow::Error> {\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .load()?;\n\n // By default we attempt to extract everything we need from the GGUF file.\n // If you need to specifiy the tokenizer or chat template to use, you can add a hf repo to load from.\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .hf_config_repo_id(\"meta-llama/Meta-Llama-3-8B-Instruct\")\n .load()?;\n\n // We can also load the model from the local path\n let _model = GgufLoader::default()\n .local_quant_file_path(\"/root/models/qwen2.5-1.5b-instruct-q5_k_m.gguf\")\n .load()?;\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"deepseek-chat\", # or `deepseek-reasoner` for DeepSeek R1\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nasync function main() {\n const agent = new Agent({\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n });\n\n const response = await agent.prompt(\"Entertain me!\");\n console.log(response.output_text);\n}\n\nmain().catch(console.error);\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nasync function main() {\n const agent = new Agent({\n model: \"deepseek-chat\",\n apiKey: \"\",\n baseUrl: \"https://api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n });\n\n const response = await agent.prompt(\"Entertain me!\");\n console.log(response.output_text);\n}\n\nmain().catch(console.error);\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nasync function main() {\n const agent = new Agent({\n model: \"claude-3-5-sonnet\",\n apiKey: \"\",\n baseUrl: \"https://api.anthropic.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n });\n\n const response = await agent.prompt(\"Entertain me!\");\n console.log(response.output_text);\n}\n\nmain().catch(console.error);\n```\n\n\n\n"}, "cb3ba2c7000141465f74fbd22620fe4d771c1379": {"t": 1785764748.3824356, "n": 6082, "h": "c6ce708c67b4b95e", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, Chat, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, Chat, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1 Model\n )?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, Chat, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## HuggingFace Models\n\n```rust\nuse alith::HuggingFaceLoader;\n\nfn main() -> Result<(), anyhow::Error> {\n let _path = HuggingFaceLoader::new().load_file(\"model.safetensors\", \"gpt2\")?;\n Ok(())\n}\n```\n\n> Note: we can use the `HF_ENDPOINT` env to set different huggingface endpoints.\n\n## GGUF Models\n\n```rust\nuse alith::{GgufLoader, GgufLoaderTrait};\n\nfn main() -> Result<(), anyhow::Error> {\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .load()?;\n\n // By default we attempt to extract everything we need from the GGUF file.\n // If you need to specifiy the tokenizer or chat template to use, you can add a hf repo to load from.\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .hf_config_repo_id(\"meta-llama/Meta-Llama-3-8B-Instruct\")\n .load()?;\n\n // We can also load the model from the local path\n let _model = GgufLoader::default()\n .local_quant_file_path(\"/root/models/qwen2.5-1.5b-instruct-q5_k_m.gguf\")\n .load()?;\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"deepseek-chat\", # or `deepseek-reasoner` for DeepSeek R1\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(await agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n model: \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1\n apiKey: \"\",\n baseUrl: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(await agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(await agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "1bd8a5ee4d147a7ec96d5acc6ebb74241eccad3b": {"t": 1785764750.366242, "n": 6046, "h": "c1eb087be0774f30", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1 Model\n )?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## HuggingFace Models\n\n```rust\nuse alith::HuggingFaceLoader;\n\nfn main() -> Result<(), anyhow::Error> {\n let _path = HuggingFaceLoader::new().load_file(\"model.safetensors\", \"gpt2\")?;\n Ok(())\n}\n```\n\n> Note: we can use the `HF_ENDPOINT` env to set different huggingface endpoints.\n\n## GGUF Models\n\n```rust\nuse alith::{GgufLoader, GgufLoaderTrait};\n\nfn main() -> Result<(), anyhow::Error> {\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .load()?;\n\n // By default we attempt to extract everything we need from the GGUF file.\n // If you need to specifiy the tokenizer or chat template to use, you can add a hf repo to load from.\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .hf_config_repo_id(\"meta-llama/Meta-Llama-3-8B-Instruct\")\n .load()?;\n\n // We can also load the model from the local path\n let _model = GgufLoader::default()\n .local_quant_file_path(\"/root/models/qwen2.5-1.5b-instruct-q5_k_m.gguf\")\n .load()?;\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"deepseek-chat\", # or `deepseek-reasoner` for DeepSeek R1\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n model: \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1\n apiKey: \"\",\n baseUrl: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "146fa59e1b357ff14892fa0465863d85c35ac95f": {"t": 1785764752.0679793, "n": 5853, "h": "556eaed6fe0d69c5", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1 Model\n )?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## HuggingFace Models\n\n```rust\nuse alith::HuggingFaceLoader;\n\nfn main() -> Result<(), anyhow::Error> {\n let _path = HuggingFaceLoader::new().load_file(\"model.safetensors\", \"gpt2\")?;\n Ok(())\n}\n```\n\n> Note: we can use the `HF_ENDPOINT` env to set different huggingface endpoints.\n\n## GGUF Models\n\n```rust\nuse alith::{GgufLoader, GgufLoaderTrait};\n\nfn main() -> Result<(), anyhow::Error> {\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .load()?;\n\n // By default we attempt to extract everything we need from the GGUF file.\n // If you need to specifiy the tokenizer or chat template to use, you can add a hf repo to load from.\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .hf_config_repo_id(\"meta-llama/Meta-Llama-3-8B-Instruct\")\n .load()?;\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"deepseek-chat\", # or `deepseek-reasoner` for DeepSeek R1\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n model: \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1\n apiKey: \"\",\n baseUrl: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "2b8543f6c157d94c637e1241ed5bb4b9218fdc18": {"t": 1785764753.4441895, "n": 6006, "h": "82be3b59542af413", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1 Model\n )?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## HuggingFace Models\n\n```rust\nuse alith::HuggingFaceLoader;\n\nfn main() -> Result<(), anyhow::Error> {\n let _path = HuggingFaceLoader::new().load_file(\"model.safetensors\", \"gpt2\")?;\n Ok(())\n}\n```\n\n> Note: we can use the `HF_ENDPOINT` env to set different huggingface endpoints.\n\n## GGUF Models\n\n```rust\nuse alith::{GgufLoader, GgufLoaderTrait};\n\nfn main() -> Result<(), anyhow::Error> {\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .load()?;\n\n // By default we attempt to extract everything we need from the GGUF file.\n // If you need to specifiy the tokenizer or chat template to use, you can add a hf repo to load from.\n let _model = GgufLoader::default()\n .hf_quant_file_url(\"https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/blob/main/Meta-Llama-3.1-8B-Instruct-Q8_0.gguf\")\n .hf_config_repo_id(\"meta-llama/Meta-Llama-3-8B-Instruct\")\n .load()?;\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"deepseek-chat\", # or `deepseek-reasoner` for DeepSeek R1\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1\n apiKey: \"\",\n baseUrl: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "a626556727a2396f7a7893a9958a34cb1827c93d": {"t": 1785764754.8516314, "n": 4945, "h": "8482fb9c9a7ec9e0", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1 Model\n )?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"deepseek-chat\", # or `deepseek-reasoner` for DeepSeek R1\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1\n apiKey: \"\",\n baseUrl: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "fbeb771418c44c70204af16958b4ee8f3c6702f9": {"t": 1785764756.1339447, "n": 4947, "h": "a817f3c599d6e652", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1 Model\n )?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model)\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"deepseek-chat\", # or `deepseek-reasoner` for DeepSeek R1\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1\n api_key: \"\",\n base_url: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "2fe30f9873eb2941af424a51fd3f01c8a60589cb": {"t": 1785764757.4058392, "n": 4971, "h": "c9e71c5016f372eb", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model, vec![])\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1 Model\n )?;\n let agent = Agent::new(\"simple agent\", model, vec![])\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model, vec![])\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"deepseek-chat\", # or `deepseek-reasoner` for DeepSeek R1\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"deepseek-chat\", // or `deepseek-reasoner` for DeepSeek R1\n api_key: \"\",\n base_url: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "6dfa9059671499d0c5cc001004f14187e6d3b18f": {"t": 1785764759.3405335, "n": 4840, "h": "fbcca1b68e20e352", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, DeepSeek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model, vec![])\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\",\n )?;\n let agent = Agent::new(\"simple agent\", model, vec![])\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model, vec![])\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"deepseek-chat\",\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the DeepSeek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"deepseek-chat\",\n api_key: \"\",\n base_url: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "4e2c171b6bb5559d7d12315a5142a93942a438d2": {"t": 1785764760.7569475, "n": 4840, "h": "f6a55931cac597c3", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, Deepseek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let agent = Agent::new(\"simple agent\", model, vec![])\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the Deepseek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\",\n )?;\n let agent = Agent::new(\"simple agent\", model, vec![])\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let agent = Agent::new(\"simple agent\", model, vec![])\n .preamble(\"You are a comedian here to entertain the user using humour and jokes.\");\n\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the Deepseek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"deepseek-chat\",\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the Deepseek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"deepseek-chat\",\n api_key: \"\",\n base_url: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "6b93372768eb99159a3e6ac8d707328641499c63": {"t": 1785764762.431848, "n": 4918, "h": "266a7e7080333609", "c": "import { Steps, Tabs } from \"nextra/components\";\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, Deepseek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let mut agent = Agent::new(\"simple agent\", model, vec![]);\n agent.preamble =\n \"You are a comedian here to entertain the user using humour and jokes.\".to_string();\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the Deepseek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\",\n )?;\n let mut agent = Agent::new(\"simple agent\", model, vec![]);\n agent.preamble =\n \"You are a comedian here to entertain the user using humour and jokes.\".to_string();\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let mut agent = Agent::new(\"simple agent\", model, vec![]);\n agent.preamble =\n \"You are a comedian here to entertain the user using humour and jokes.\".to_string();\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the Deepseek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"deepseek-chat\",\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"gpt-4\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the Deepseek model as the example.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"deepseek-chat\",\n api_key: \"\",\n base_url: \"api.deepseek.com\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from \"alith\";\n\nconst agent = new Agent({\n name: \"A dummy Agent\",\n model: \"claude-3-5-sonnet\",\n preamble:\n \"You are a comedian here to entertain the user using humour and jokes.\",\n});\nconsole.log(agent.prompt(\"Entertain me!\"));\n```\n\n\n\n"}, "855a3234caa52994c4dfc936d9a3aa3fcea70602": {"t": 1785764763.9270673, "n": 4896, "h": "4a3304ec8c67027d", "c": "import { Steps, Tabs } from 'nextra/components'\n\n# Large Language Models (LLMs)\n\nAlith provides seamless integration with various **Large Language Models (LLMs)**, allowing you to easily switch between models like GPT-4, GPT-3.5, Claude, Deepseek and others. Below, you'll find examples of how to initialize and use LLMs in Rust, Python, and Node.js.\n\n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"gpt-4\")?;\n let mut agent = Agent::new(\"simple agent\", model, vec![]);\n agent.preamble =\n \"You are a comedian here to entertain the user using humour and jokes.\".to_string();\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the Deepseek model as the example.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::openai_compatible_model(\n \"\", // Replace with your api key or read it from env.\n \"api.deepseek.com\",\n \"deepseek-chat\",\n )?;\n let mut agent = Agent::new(\"simple agent\", model, vec![]);\n agent.preamble =\n \"You are a comedian here to entertain the user using humour and jokes.\".to_string();\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```rust\nuse alith::{Agent, LLM};\n\n#[tokio::main]\nasync fn main() -> Result<(), anyhow::Error> {\n let model = LLM::from_model_name(\"claude-3-5-sonnet\")?;\n let mut agent = Agent::new(\"simple agent\", model, vec![]);\n agent.preamble =\n \"You are a comedian here to entertain the user using humour and jokes.\".to_string();\n let response = agent.prompt(\"Entertain me!\").await?;\n\n println!(\"{}\", response);\n\n Ok(())\n}\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"gpt-4o-mini\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the Deepseek model as the example.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"deepseek-chat\",\n api_key=\"\", # Replace with your api key or read it from env.\n base_url=\"api.deepseek.com\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```python\nfrom alith import Agent\n\nagent = Agent(\n name=\"A dummy Agent\",\n model=\"claude-3-5-sonnet\",\n preamble=\"You are a comedian here to entertain the user using humour and jokes.\",\n)\nprint(agent.prompt(\"Entertain me!\"))\n```\n\n \n\n \n\n## OpenAI Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport OPENAI_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:OPENAI_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from 'alith'\n\nconst agent = new Agent({\n name: 'A dummy Agent',\n model: 'gpt-4',\n preamble: 'You are a comedian here to entertain the user using humour and jokes.',\n})\nconsole.log(agent.prompt('Entertain me!'))\n```\n\n## OpenAI API Compatible Models\n\nHere, we take the Deepseek model as the example.\n\n```typescript\nimport { Agent } from 'alith'\n\nconst agent = new Agent({\n name: 'A dummy Agent',\n model: 'deepseek-chat',\n api_key: '',\n base_url: 'api.deepseek.com',\n preamble: 'You are a comedian here to entertain the user using humour and jokes.',\n})\nconsole.log(agent.prompt('Entertain me!'))\n```\n\n## Anthropic Models\n\nSet the API key.\n\n- Unix\n\n```shell\nexport ANTHROPIC_API_KEY=\n```\n\n- Windows\n\n```shell\n$env:ANTHROPIC_API_KEY = \"\"\n```\n\nWrite the code.\n\n```typescript\nimport { Agent } from 'alith'\n\nconst agent = new Agent({\n name: 'A dummy Agent',\n model: 'claude-3-5-sonnet',\n preamble: 'You are a comedian here to entertain the user using humour and jokes.',\n})\nconsole.log(agent.prompt('Entertain me!'))\n```\n\n\n\n"}}}}