Skip to main content

A platform for building and deploying AI agents with structured skills

Project description

Airtrain

A powerful platform for building and deploying AI agents with structured skills and capabilities.

Features

  • Structured Skills: Build modular AI skills with defined input/output schemas
  • Multiple LLM Integrations: Built-in support for OpenAI and Anthropic models
  • Structured Outputs: Parse LLM responses into structured Pydantic models
  • Credential Management: Secure handling of API keys and credentials
  • Type Safety: Full type hints and Pydantic model support
  • Image Support: Handle image inputs for multimodal models
  • Error Handling: Robust error handling and logging

Installation

pip install airtrain

Quick Start

1. Basic OpenAI Chat

from airtrain.integrations.openai.skills import OpenAIChatSkill, OpenAIInput

# Initialize the skill
skill = OpenAIChatSkill()

# Create input
input_data = OpenAIInput(
    user_input="Explain quantum computing in simple terms.",
    system_prompt="You are a helpful teacher.",
    max_tokens=500,
    temperature=0.7
)

# Get response
result = skill.process(input_data)
print(result.response)
print(f"Tokens Used: {result.usage['total_tokens']}")

2. Anthropic Claude Integration

from airtrain.integrations.anthropic.skills import AnthropicChatSkill, AnthropicInput

# Initialize the skill
skill = AnthropicChatSkill()

# Create input
input_data = AnthropicInput(
    user_input="Explain the theory of relativity.",
    system_prompt="You are a physics expert.",
    model="claude-3-opus-20240229",
    temperature=0.3
)

# Get response
result = skill.process(input_data)
print(result.response)
print(f"Usage: {result.usage}")

3. Structured Output with OpenAI

from pydantic import BaseModel
from typing import List
from airtrain.integrations.openai.skills import OpenAIParserSkill, OpenAIParserInput

# Define your response model
class PersonInfo(BaseModel):
    name: str
    age: int
    occupation: str
    skills: List[str]

# Initialize the parser skill
parser_skill = OpenAIParserSkill()

# Create input with response model
input_data = OpenAIParserInput(
    user_input="Tell me about John Doe, a 30-year-old software engineer who specializes in Python and AI",
    system_prompt="Extract structured information about the person.",
    response_model=PersonInfo
)

# Get structured response
result = parser_skill.process(input_data)
person_info = result.parsed_response
print(f"Name: {person_info.name}")
print(f"Skills: {', '.join(person_info.skills)}")

Error Handling

All skills include built-in error handling:

from airtrain.core.skills import ProcessingError

try:
    result = skill.process(input_data)
except ProcessingError as e:
    print(f"Processing failed: {e}")

Advanced Features

  • Image Analysis Support
  • Function Calling
  • Custom Validators
  • Async Processing
  • Token Usage Tracking

For more examples and detailed documentation, visit our documentation.

Documentation

For detailed documentation, visit our documentation site.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

0.1.28

  • Bug fix: reasoning to Fireworks structured output.
  • Added reasoning to Fireworks structured output.

0.1.27

  • Added structured completion skills for Fireworks AI
  • Added Completion skills for Fireworks AI.
  • Added Combination skill for Groq and Fireworks AI.
  • Add completion streaming.
  • Added strcutured output streaming for Fireworks AI.

0.1.23

  • Added conversation support for Deepseek, Togehter AI, Fireworks AI, Gemini, Groq, Cerebras and Sambanova.
  • Added Change Log

Notes

The changelog format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Project details


Download files

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

Source Distribution

airtrain-0.1.28.tar.gz (176.4 kB view details)

Uploaded Source

Built Distribution

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

airtrain-0.1.28-py3-none-any.whl (61.9 kB view details)

Uploaded Python 3

File details

Details for the file airtrain-0.1.28.tar.gz.

File metadata

  • Download URL: airtrain-0.1.28.tar.gz
  • Upload date:
  • Size: 176.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.14

File hashes

Hashes for airtrain-0.1.28.tar.gz
Algorithm Hash digest
SHA256 1532d55e1497940614f63d2b5046cf02df73eca40ceab5539259c11e1fa4ef6d
MD5 5844894412c9fc2c300203120951492f
BLAKE2b-256 b9cf8cbf792ab66706163ed5266666cb8b0289ccdbbf6fd047ad826dce7347ca

See more details on using hashes here.

File details

Details for the file airtrain-0.1.28-py3-none-any.whl.

File metadata

  • Download URL: airtrain-0.1.28-py3-none-any.whl
  • Upload date:
  • Size: 61.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.14

File hashes

Hashes for airtrain-0.1.28-py3-none-any.whl
Algorithm Hash digest
SHA256 0c3d21acf8621d4a7ceb1c844933ce77e91ed5e4f08de830978b4961a5439ef2
MD5 163089104bc7cbc3c5b491c83b024124
BLAKE2b-256 66a08b5a68b55e51c23734f8fc5006150d2727410a70d0e0af3278b4551a39a3

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