Skip to main content

A flexible, multi-backend, customizable AI agent framework, entirely based on Rust.

Project description

Python Bindings for Ambi

A Python native extension for the Ambi AI Agent framework.

Build

# Install maturin
pip install maturin

# Build and install
cd bindings/python
maturin develop --release

Examples

Run any example from the bindings/python directory:

cd bindings/python

# Basic cloud-based chat
OPENAI_API_KEY=sk-... python examples/chat-cloud.py

# Streaming output
OPENAI_API_KEY=sk-... python examples/chat-stream.py

# Tool calling
OPENAI_API_KEY=sk-... python examples/custom-tool.py

# Custom chat template
OPENAI_API_KEY=sk-... python examples/custom-template.py

# Custom Python LLM engine
python examples/custom-engine.py

# Memory eviction
OPENAI_API_KEY=sk-... python examples/memory-eviction.py

API Reference

Python JS equivalent Description
Agent.make(config) Agent.make(config) Create an async agent
agent.preamble("...") agent.preamble("...") Set system prompt
agent.template("chatml") agent.template(Chatml) Set template type
agent.custom_template(...) agent.customTemplate(...) Custom template
agent.add_tool(...) agent.tool(...) Register a tool
agent.with_standard_formatting() agent.withStandardFormatting() Enable standard formatting
agent.with_eviction_strategy(...) agent.withEvictionStrategy(...) Set eviction strategy
agent.count_tokens(...) agent.countTokens(...) Count tokens
AgentState("id") new AgentState("id") Create session state
LLMEngineConfig.openai(...) LLMEngineConfig.openai(...) OpenAI engine
LLMEngineConfig.custom(...) LLMEngineConfig.custom(...) Custom engine
Pipeline.chat_runner(n) Pipeline.chatRunner(n) Chat runner
Pipeline.custom(...) Pipeline.custom(...) Custom pipeline
runner.chat(...) runner.chat(...) Sync chat
runner.chat_stream(...) runner.chatStream(...) Streaming chat
resolve_request(id, result) resolveRequest(id, result) Resolve async callback
resolve_pipeline_request(...) resolvePipelineRequest(...) Resolve pipeline callback

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ambi_python-0.1.0-cp312-cp312-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.12Windows x86-64

File details

Details for the file ambi_python-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for ambi_python-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3b6662ea766e4694de7dc5940f8b1b41810f0bce84ee943772e167c6c4030464
MD5 8e3a8ab941100575cfd6ce7d5e46ba3c
BLAKE2b-256 c01a389c496e333338553efe32664d698aedfae8b84853cf2142a256372f7502

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page