airtrain 0.1.3__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airtrain-0.1.4/MANIFEST.in +3 -0
- airtrain-0.1.4/PKG-INFO +222 -0
- airtrain-0.1.4/README.md +166 -0
- airtrain-0.1.4/airtrain/__init__.py +149 -0
- airtrain-0.1.4/airtrain/__main__.py +4 -0
- airtrain-0.1.4/airtrain/agents/__init__.py +45 -0
- airtrain-0.1.4/airtrain/agents/example_agent.py +348 -0
- airtrain-0.1.4/airtrain/agents/groq_agent.py +289 -0
- airtrain-0.1.4/airtrain/agents/memory.py +663 -0
- airtrain-0.1.4/airtrain/agents/registry.py +465 -0
- airtrain-0.1.4/airtrain/builder/__init__.py +3 -0
- airtrain-0.1.4/airtrain/builder/agent_builder.py +122 -0
- airtrain-0.1.4/airtrain/cli/__init__.py +0 -0
- airtrain-0.1.4/airtrain/cli/builder.py +23 -0
- airtrain-0.1.4/airtrain/cli/main.py +120 -0
- airtrain-0.1.4/airtrain/contrib/__init__.py +29 -0
- airtrain-0.1.4/airtrain/contrib/travel/__init__.py +35 -0
- airtrain-0.1.4/airtrain/contrib/travel/agents.py +243 -0
- airtrain-0.1.4/airtrain/contrib/travel/models.py +59 -0
- {airtrain-0.1.3 → airtrain-0.1.4}/airtrain/core/credentials.py +62 -44
- {airtrain-0.1.3 → airtrain-0.1.4}/airtrain/core/skills.py +102 -0
- airtrain-0.1.4/airtrain/integrations/__init__.py +74 -0
- airtrain-0.1.4/airtrain/integrations/anthropic/__init__.py +33 -0
- airtrain-0.1.4/airtrain/integrations/anthropic/credentials.py +32 -0
- airtrain-0.1.4/airtrain/integrations/anthropic/list_models.py +110 -0
- airtrain-0.1.4/airtrain/integrations/anthropic/models_config.py +100 -0
- airtrain-0.1.4/airtrain/integrations/anthropic/skills.py +155 -0
- airtrain-0.1.4/airtrain/integrations/aws/__init__.py +6 -0
- airtrain-0.1.4/airtrain/integrations/aws/credentials.py +36 -0
- airtrain-0.1.4/airtrain/integrations/aws/skills.py +98 -0
- airtrain-0.1.4/airtrain/integrations/cerebras/__init__.py +6 -0
- airtrain-0.1.4/airtrain/integrations/cerebras/credentials.py +19 -0
- airtrain-0.1.4/airtrain/integrations/cerebras/skills.py +127 -0
- airtrain-0.1.4/airtrain/integrations/combined/__init__.py +21 -0
- airtrain-0.1.4/airtrain/integrations/combined/groq_fireworks_skills.py +126 -0
- airtrain-0.1.4/airtrain/integrations/combined/list_models_factory.py +210 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/__init__.py +21 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/completion_skills.py +147 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/conversation_manager.py +109 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/credentials.py +26 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/list_models.py +128 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/models.py +139 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/requests_skills.py +207 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/skills.py +181 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/structured_completion_skills.py +175 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/structured_requests_skills.py +291 -0
- airtrain-0.1.4/airtrain/integrations/fireworks/structured_skills.py +102 -0
- airtrain-0.1.4/airtrain/integrations/google/__init__.py +7 -0
- airtrain-0.1.4/airtrain/integrations/google/credentials.py +58 -0
- airtrain-0.1.4/airtrain/integrations/google/skills.py +122 -0
- airtrain-0.1.4/airtrain/integrations/groq/__init__.py +23 -0
- airtrain-0.1.4/airtrain/integrations/groq/credentials.py +24 -0
- airtrain-0.1.4/airtrain/integrations/groq/models_config.py +162 -0
- airtrain-0.1.4/airtrain/integrations/groq/skills.py +201 -0
- airtrain-0.1.4/airtrain/integrations/ollama/__init__.py +6 -0
- airtrain-0.1.4/airtrain/integrations/ollama/credentials.py +26 -0
- airtrain-0.1.4/airtrain/integrations/ollama/skills.py +41 -0
- airtrain-0.1.4/airtrain/integrations/openai/__init__.py +37 -0
- airtrain-0.1.4/airtrain/integrations/openai/chinese_assistant.py +42 -0
- airtrain-0.1.4/airtrain/integrations/openai/credentials.py +39 -0
- airtrain-0.1.4/airtrain/integrations/openai/list_models.py +112 -0
- airtrain-0.1.4/airtrain/integrations/openai/models_config.py +224 -0
- airtrain-0.1.4/airtrain/integrations/openai/skills.py +342 -0
- airtrain-0.1.4/airtrain/integrations/perplexity/__init__.py +49 -0
- airtrain-0.1.4/airtrain/integrations/perplexity/credentials.py +43 -0
- airtrain-0.1.4/airtrain/integrations/perplexity/list_models.py +112 -0
- airtrain-0.1.4/airtrain/integrations/perplexity/models_config.py +128 -0
- airtrain-0.1.4/airtrain/integrations/perplexity/skills.py +279 -0
- airtrain-0.1.4/airtrain/integrations/sambanova/__init__.py +6 -0
- airtrain-0.1.4/airtrain/integrations/sambanova/credentials.py +20 -0
- airtrain-0.1.4/airtrain/integrations/sambanova/skills.py +129 -0
- airtrain-0.1.4/airtrain/integrations/search/__init__.py +21 -0
- airtrain-0.1.4/airtrain/integrations/search/exa/__init__.py +23 -0
- airtrain-0.1.4/airtrain/integrations/search/exa/credentials.py +30 -0
- airtrain-0.1.4/airtrain/integrations/search/exa/schemas.py +114 -0
- airtrain-0.1.4/airtrain/integrations/search/exa/skills.py +115 -0
- airtrain-0.1.4/airtrain/integrations/together/__init__.py +33 -0
- airtrain-0.1.4/airtrain/integrations/together/audio_models_config.py +34 -0
- airtrain-0.1.4/airtrain/integrations/together/credentials.py +22 -0
- airtrain-0.1.4/airtrain/integrations/together/embedding_models_config.py +92 -0
- airtrain-0.1.4/airtrain/integrations/together/image_models_config.py +69 -0
- airtrain-0.1.4/airtrain/integrations/together/image_skill.py +143 -0
- airtrain-0.1.4/airtrain/integrations/together/list_models.py +76 -0
- airtrain-0.1.4/airtrain/integrations/together/models.py +95 -0
- airtrain-0.1.4/airtrain/integrations/together/models_config.py +399 -0
- airtrain-0.1.4/airtrain/integrations/together/rerank_models_config.py +43 -0
- airtrain-0.1.4/airtrain/integrations/together/rerank_skill.py +49 -0
- airtrain-0.1.4/airtrain/integrations/together/schemas.py +33 -0
- airtrain-0.1.4/airtrain/integrations/together/skills.py +305 -0
- airtrain-0.1.4/airtrain/integrations/together/vision_models_config.py +49 -0
- airtrain-0.1.4/airtrain/telemetry/__init__.py +38 -0
- airtrain-0.1.4/airtrain/telemetry/service.py +167 -0
- airtrain-0.1.4/airtrain/telemetry/views.py +237 -0
- airtrain-0.1.4/airtrain/tools/__init__.py +45 -0
- airtrain-0.1.4/airtrain/tools/command.py +398 -0
- airtrain-0.1.4/airtrain/tools/filesystem.py +166 -0
- airtrain-0.1.4/airtrain/tools/network.py +111 -0
- airtrain-0.1.4/airtrain/tools/registry.py +320 -0
- airtrain-0.1.4/airtrain/tools/search.py +450 -0
- airtrain-0.1.4/airtrain/tools/testing.py +135 -0
- airtrain-0.1.4/airtrain.egg-info/PKG-INFO +222 -0
- airtrain-0.1.4/airtrain.egg-info/SOURCES.txt +111 -0
- airtrain-0.1.4/airtrain.egg-info/entry_points.txt +2 -0
- airtrain-0.1.4/airtrain.egg-info/requires.txt +34 -0
- airtrain-0.1.4/changelog.md +37 -0
- airtrain-0.1.4/pyproject.toml +54 -0
- airtrain-0.1.4/requirements.txt +28 -0
- airtrain-0.1.4/setup.py +148 -0
- airtrain-0.1.3/.flake8 +0 -14
- airtrain-0.1.3/.github/workflows/publish.yml +0 -26
- airtrain-0.1.3/.mypy.ini +0 -7
- airtrain-0.1.3/.pre-commit-config.yaml +0 -29
- airtrain-0.1.3/.vscode/extensions.json +0 -7
- airtrain-0.1.3/.vscode/launch.json +0 -27
- airtrain-0.1.3/.vscode/settings.json +0 -25
- airtrain-0.1.3/EXPERIMENTS/schema_exps/pydantic_schemas.py +0 -37
- airtrain-0.1.3/PKG-INFO +0 -106
- airtrain-0.1.3/README.md +0 -73
- airtrain-0.1.3/airtrain/__init__.py +0 -9
- airtrain-0.1.3/airtrain/core/__pycache__/credentials.cpython-310.pyc +0 -0
- airtrain-0.1.3/airtrain/core/__pycache__/schemas.cpython-310.pyc +0 -0
- airtrain-0.1.3/airtrain/core/__pycache__/skills.cpython-310.pyc +0 -0
- airtrain-0.1.3/airtrain.egg-info/PKG-INFO +0 -106
- airtrain-0.1.3/airtrain.egg-info/SOURCES.txt +0 -36
- airtrain-0.1.3/airtrain.egg-info/requires.txt +0 -6
- airtrain-0.1.3/examples/creating-skills/image1.jpg +0 -0
- airtrain-0.1.3/examples/creating-skills/image2.jpg +0 -0
- airtrain-0.1.3/examples/creating-skills/openai_skills.py +0 -192
- airtrain-0.1.3/examples/creating-skills/openai_structured_skills.py +0 -144
- airtrain-0.1.3/examples/credentials_usage.py +0 -48
- airtrain-0.1.3/examples/schema_usage.py +0 -77
- airtrain-0.1.3/examples/skill_usage.py +0 -83
- airtrain-0.1.3/pyproject.toml +0 -11
- airtrain-0.1.3/scripts/build.sh +0 -10
- airtrain-0.1.3/scripts/bump_version.py +0 -55
- airtrain-0.1.3/scripts/publish.sh +0 -10
- airtrain-0.1.3/services/firebase_service.py +0 -181
- airtrain-0.1.3/services/openai_service.py +0 -366
- airtrain-0.1.3/setup.py +0 -49
- {airtrain-0.1.3 → airtrain-0.1.4}/airtrain/core/__init__.py +0 -0
- {airtrain-0.1.3 → airtrain-0.1.4}/airtrain/core/schemas.py +0 -0
- {airtrain-0.1.3 → airtrain-0.1.4}/airtrain.egg-info/dependency_links.txt +0 -0
- {airtrain-0.1.3 → airtrain-0.1.4}/airtrain.egg-info/top_level.txt +0 -0
- {airtrain-0.1.3 → airtrain-0.1.4}/setup.cfg +0 -0
airtrain-0.1.4/PKG-INFO
ADDED
@@ -0,0 +1,222 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: airtrain
|
3
|
+
Version: 0.1.4
|
4
|
+
Summary: A platform for building and deploying AI agents with structured skills
|
5
|
+
Home-page: https://github.com/rosaboyle/airtrain.dev
|
6
|
+
Author: Dheeraj Pai
|
7
|
+
Author-email: Dheeraj Pai <helloworldcmu@gmail.com>
|
8
|
+
Project-URL: Homepage, https://github.com/rosaboyle/airtrain.dev
|
9
|
+
Project-URL: Documentation, https://docs.airtrain.dev/
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
13
|
+
Classifier: Operating System :: OS Independent
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
18
|
+
Requires-Python: >=3.8
|
19
|
+
Description-Content-Type: text/markdown
|
20
|
+
Requires-Dist: pydantic>=2.10.6
|
21
|
+
Requires-Dist: openai>=1.60.1
|
22
|
+
Requires-Dist: python-dotenv>=1.0.1
|
23
|
+
Requires-Dist: PyYAML>=6.0.2
|
24
|
+
Requires-Dist: firebase-admin>=6.6.0
|
25
|
+
Requires-Dist: loguru>=0.7.3
|
26
|
+
Requires-Dist: requests>=2.32.3
|
27
|
+
Requires-Dist: boto3>=1.36.6
|
28
|
+
Requires-Dist: together>=1.3.13
|
29
|
+
Requires-Dist: anthropic>=0.45.0
|
30
|
+
Requires-Dist: groq>=0.15.0
|
31
|
+
Requires-Dist: cerebras-cloud-sdk>=1.19.0
|
32
|
+
Requires-Dist: google-genai>=1.0.0
|
33
|
+
Requires-Dist: fireworks-ai>=0.15.12
|
34
|
+
Requires-Dist: google-generativeai>=0.8.4
|
35
|
+
Requires-Dist: click>=8.0.0
|
36
|
+
Requires-Dist: rich>=13.3.1
|
37
|
+
Requires-Dist: prompt-toolkit>=3.0.36
|
38
|
+
Requires-Dist: colorama>=0.4.6
|
39
|
+
Requires-Dist: typer>=0.9.0
|
40
|
+
Requires-Dist: posthog>=3.7.0
|
41
|
+
Provides-Extra: dev
|
42
|
+
Requires-Dist: black>=24.10.0; extra == "dev"
|
43
|
+
Requires-Dist: flake8>=7.1.1; extra == "dev"
|
44
|
+
Requires-Dist: isort>=5.13.0; extra == "dev"
|
45
|
+
Requires-Dist: mypy>=1.9.0; extra == "dev"
|
46
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
47
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
48
|
+
Requires-Dist: build>=0.10.0; extra == "dev"
|
49
|
+
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
50
|
+
Requires-Dist: types-requests>=2.31.0; extra == "dev"
|
51
|
+
Requires-Dist: types-Markdown>=3.5.0; extra == "dev"
|
52
|
+
Requires-Dist: toml>=0.10.2; extra == "dev"
|
53
|
+
Dynamic: author
|
54
|
+
Dynamic: home-page
|
55
|
+
Dynamic: requires-python
|
56
|
+
|
57
|
+
# Airtrain
|
58
|
+
|
59
|
+
A powerful platform for building and deploying AI agents with structured skills and capabilities.
|
60
|
+
|
61
|
+
## Features
|
62
|
+
|
63
|
+
- **Structured Skills**: Build modular AI skills with defined input/output schemas
|
64
|
+
- **Multiple LLM Integrations**: Built-in support for OpenAI and Anthropic models
|
65
|
+
- **Structured Outputs**: Parse LLM responses into structured Pydantic models
|
66
|
+
- **Credential Management**: Secure handling of API keys and credentials
|
67
|
+
- **Type Safety**: Full type hints and Pydantic model support
|
68
|
+
- **Image Support**: Handle image inputs for multimodal models
|
69
|
+
- **Error Handling**: Robust error handling and logging
|
70
|
+
|
71
|
+
## Installation
|
72
|
+
|
73
|
+
```bash
|
74
|
+
pip install airtrain
|
75
|
+
```
|
76
|
+
|
77
|
+
## Quick Start
|
78
|
+
|
79
|
+
### 1. Basic OpenAI Chat
|
80
|
+
|
81
|
+
```python
|
82
|
+
from airtrain.integrations.openai.skills import OpenAIChatSkill, OpenAIInput
|
83
|
+
|
84
|
+
# Initialize the skill
|
85
|
+
skill = OpenAIChatSkill()
|
86
|
+
|
87
|
+
# Create input
|
88
|
+
input_data = OpenAIInput(
|
89
|
+
user_input="Explain quantum computing in simple terms.",
|
90
|
+
system_prompt="You are a helpful teacher.",
|
91
|
+
max_tokens=500,
|
92
|
+
temperature=0.7
|
93
|
+
)
|
94
|
+
|
95
|
+
# Get response
|
96
|
+
result = skill.process(input_data)
|
97
|
+
print(result.response)
|
98
|
+
print(f"Tokens Used: {result.usage['total_tokens']}")
|
99
|
+
```
|
100
|
+
|
101
|
+
### 2. Anthropic Claude Integration
|
102
|
+
|
103
|
+
```python
|
104
|
+
from airtrain.integrations.anthropic.skills import AnthropicChatSkill, AnthropicInput
|
105
|
+
|
106
|
+
# Initialize the skill
|
107
|
+
skill = AnthropicChatSkill()
|
108
|
+
|
109
|
+
# Create input
|
110
|
+
input_data = AnthropicInput(
|
111
|
+
user_input="Explain the theory of relativity.",
|
112
|
+
system_prompt="You are a physics expert.",
|
113
|
+
model="claude-3-opus-20240229",
|
114
|
+
temperature=0.3
|
115
|
+
)
|
116
|
+
|
117
|
+
# Get response
|
118
|
+
result = skill.process(input_data)
|
119
|
+
print(result.response)
|
120
|
+
print(f"Usage: {result.usage}")
|
121
|
+
```
|
122
|
+
|
123
|
+
### 3. Structured Output with OpenAI
|
124
|
+
|
125
|
+
```python
|
126
|
+
from pydantic import BaseModel
|
127
|
+
from typing import List
|
128
|
+
from airtrain.integrations.openai.skills import OpenAIParserSkill, OpenAIParserInput
|
129
|
+
|
130
|
+
# Define your response model
|
131
|
+
class PersonInfo(BaseModel):
|
132
|
+
name: str
|
133
|
+
age: int
|
134
|
+
occupation: str
|
135
|
+
skills: List[str]
|
136
|
+
|
137
|
+
# Initialize the parser skill
|
138
|
+
parser_skill = OpenAIParserSkill()
|
139
|
+
|
140
|
+
# Create input with response model
|
141
|
+
input_data = OpenAIParserInput(
|
142
|
+
user_input="Tell me about John Doe, a 30-year-old software engineer who specializes in Python and AI",
|
143
|
+
system_prompt="Extract structured information about the person.",
|
144
|
+
response_model=PersonInfo
|
145
|
+
)
|
146
|
+
|
147
|
+
# Get structured response
|
148
|
+
result = parser_skill.process(input_data)
|
149
|
+
person_info = result.parsed_response
|
150
|
+
print(f"Name: {person_info.name}")
|
151
|
+
print(f"Skills: {', '.join(person_info.skills)}")
|
152
|
+
```
|
153
|
+
|
154
|
+
## Error Handling
|
155
|
+
|
156
|
+
All skills include built-in error handling:
|
157
|
+
|
158
|
+
```python
|
159
|
+
from airtrain.core.skills import ProcessingError
|
160
|
+
|
161
|
+
try:
|
162
|
+
result = skill.process(input_data)
|
163
|
+
except ProcessingError as e:
|
164
|
+
print(f"Processing failed: {e}")
|
165
|
+
```
|
166
|
+
|
167
|
+
## Advanced Features
|
168
|
+
|
169
|
+
- Image Analysis Support
|
170
|
+
- Function Calling
|
171
|
+
- Custom Validators
|
172
|
+
- Async Processing
|
173
|
+
- Token Usage Tracking
|
174
|
+
|
175
|
+
For more examples and detailed documentation, visit our [documentation](https://airtrain.readthedocs.io/).
|
176
|
+
|
177
|
+
## Documentation
|
178
|
+
|
179
|
+
For detailed documentation, visit [our documentation site](https://docs.airtrain.dev/).
|
180
|
+
|
181
|
+
## Telemetry
|
182
|
+
|
183
|
+
Airtrain collects telemetry data to help improve the library. The data collected includes:
|
184
|
+
|
185
|
+
- Agent run information (model used, task description, environment settings)
|
186
|
+
- Agent steps and actions (full action details and reasoning)
|
187
|
+
- Performance metrics (token usage, execution time, CPU and memory usage)
|
188
|
+
- System information (OS, Python version, machine details)
|
189
|
+
- Error information (complete stack traces and context)
|
190
|
+
- Model usage details (prompts, responses, parameters)
|
191
|
+
|
192
|
+
The telemetry helps us identify usage patterns, troubleshoot issues, and improve the library based on real-world usage. The user ID is stored at `~/.cache/airtrain/telemetry_user_id`.
|
193
|
+
|
194
|
+
### Disabling Telemetry
|
195
|
+
|
196
|
+
Telemetry is enabled by default, but you can disable it if needed:
|
197
|
+
|
198
|
+
1. Set an environment variable:
|
199
|
+
```bash
|
200
|
+
export AIRTRAIN_TELEMETRY_ENABLED=false
|
201
|
+
```
|
202
|
+
|
203
|
+
2. In your Python code:
|
204
|
+
```python
|
205
|
+
import os
|
206
|
+
os.environ["AIRTRAIN_TELEMETRY_ENABLED"] = "false"
|
207
|
+
```
|
208
|
+
|
209
|
+
### Viewing Telemetry Debug Information
|
210
|
+
|
211
|
+
To see what telemetry data is being sent:
|
212
|
+
```python
|
213
|
+
os.environ["AIRTRAIN_LOGGING_LEVEL"] = "debug"
|
214
|
+
```
|
215
|
+
|
216
|
+
## Contributing
|
217
|
+
|
218
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
219
|
+
|
220
|
+
## License
|
221
|
+
|
222
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
airtrain-0.1.4/README.md
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
# Airtrain
|
2
|
+
|
3
|
+
A powerful platform for building and deploying AI agents with structured skills and capabilities.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
- **Structured Skills**: Build modular AI skills with defined input/output schemas
|
8
|
+
- **Multiple LLM Integrations**: Built-in support for OpenAI and Anthropic models
|
9
|
+
- **Structured Outputs**: Parse LLM responses into structured Pydantic models
|
10
|
+
- **Credential Management**: Secure handling of API keys and credentials
|
11
|
+
- **Type Safety**: Full type hints and Pydantic model support
|
12
|
+
- **Image Support**: Handle image inputs for multimodal models
|
13
|
+
- **Error Handling**: Robust error handling and logging
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
```bash
|
18
|
+
pip install airtrain
|
19
|
+
```
|
20
|
+
|
21
|
+
## Quick Start
|
22
|
+
|
23
|
+
### 1. Basic OpenAI Chat
|
24
|
+
|
25
|
+
```python
|
26
|
+
from airtrain.integrations.openai.skills import OpenAIChatSkill, OpenAIInput
|
27
|
+
|
28
|
+
# Initialize the skill
|
29
|
+
skill = OpenAIChatSkill()
|
30
|
+
|
31
|
+
# Create input
|
32
|
+
input_data = OpenAIInput(
|
33
|
+
user_input="Explain quantum computing in simple terms.",
|
34
|
+
system_prompt="You are a helpful teacher.",
|
35
|
+
max_tokens=500,
|
36
|
+
temperature=0.7
|
37
|
+
)
|
38
|
+
|
39
|
+
# Get response
|
40
|
+
result = skill.process(input_data)
|
41
|
+
print(result.response)
|
42
|
+
print(f"Tokens Used: {result.usage['total_tokens']}")
|
43
|
+
```
|
44
|
+
|
45
|
+
### 2. Anthropic Claude Integration
|
46
|
+
|
47
|
+
```python
|
48
|
+
from airtrain.integrations.anthropic.skills import AnthropicChatSkill, AnthropicInput
|
49
|
+
|
50
|
+
# Initialize the skill
|
51
|
+
skill = AnthropicChatSkill()
|
52
|
+
|
53
|
+
# Create input
|
54
|
+
input_data = AnthropicInput(
|
55
|
+
user_input="Explain the theory of relativity.",
|
56
|
+
system_prompt="You are a physics expert.",
|
57
|
+
model="claude-3-opus-20240229",
|
58
|
+
temperature=0.3
|
59
|
+
)
|
60
|
+
|
61
|
+
# Get response
|
62
|
+
result = skill.process(input_data)
|
63
|
+
print(result.response)
|
64
|
+
print(f"Usage: {result.usage}")
|
65
|
+
```
|
66
|
+
|
67
|
+
### 3. Structured Output with OpenAI
|
68
|
+
|
69
|
+
```python
|
70
|
+
from pydantic import BaseModel
|
71
|
+
from typing import List
|
72
|
+
from airtrain.integrations.openai.skills import OpenAIParserSkill, OpenAIParserInput
|
73
|
+
|
74
|
+
# Define your response model
|
75
|
+
class PersonInfo(BaseModel):
|
76
|
+
name: str
|
77
|
+
age: int
|
78
|
+
occupation: str
|
79
|
+
skills: List[str]
|
80
|
+
|
81
|
+
# Initialize the parser skill
|
82
|
+
parser_skill = OpenAIParserSkill()
|
83
|
+
|
84
|
+
# Create input with response model
|
85
|
+
input_data = OpenAIParserInput(
|
86
|
+
user_input="Tell me about John Doe, a 30-year-old software engineer who specializes in Python and AI",
|
87
|
+
system_prompt="Extract structured information about the person.",
|
88
|
+
response_model=PersonInfo
|
89
|
+
)
|
90
|
+
|
91
|
+
# Get structured response
|
92
|
+
result = parser_skill.process(input_data)
|
93
|
+
person_info = result.parsed_response
|
94
|
+
print(f"Name: {person_info.name}")
|
95
|
+
print(f"Skills: {', '.join(person_info.skills)}")
|
96
|
+
```
|
97
|
+
|
98
|
+
## Error Handling
|
99
|
+
|
100
|
+
All skills include built-in error handling:
|
101
|
+
|
102
|
+
```python
|
103
|
+
from airtrain.core.skills import ProcessingError
|
104
|
+
|
105
|
+
try:
|
106
|
+
result = skill.process(input_data)
|
107
|
+
except ProcessingError as e:
|
108
|
+
print(f"Processing failed: {e}")
|
109
|
+
```
|
110
|
+
|
111
|
+
## Advanced Features
|
112
|
+
|
113
|
+
- Image Analysis Support
|
114
|
+
- Function Calling
|
115
|
+
- Custom Validators
|
116
|
+
- Async Processing
|
117
|
+
- Token Usage Tracking
|
118
|
+
|
119
|
+
For more examples and detailed documentation, visit our [documentation](https://airtrain.readthedocs.io/).
|
120
|
+
|
121
|
+
## Documentation
|
122
|
+
|
123
|
+
For detailed documentation, visit [our documentation site](https://docs.airtrain.dev/).
|
124
|
+
|
125
|
+
## Telemetry
|
126
|
+
|
127
|
+
Airtrain collects telemetry data to help improve the library. The data collected includes:
|
128
|
+
|
129
|
+
- Agent run information (model used, task description, environment settings)
|
130
|
+
- Agent steps and actions (full action details and reasoning)
|
131
|
+
- Performance metrics (token usage, execution time, CPU and memory usage)
|
132
|
+
- System information (OS, Python version, machine details)
|
133
|
+
- Error information (complete stack traces and context)
|
134
|
+
- Model usage details (prompts, responses, parameters)
|
135
|
+
|
136
|
+
The telemetry helps us identify usage patterns, troubleshoot issues, and improve the library based on real-world usage. The user ID is stored at `~/.cache/airtrain/telemetry_user_id`.
|
137
|
+
|
138
|
+
### Disabling Telemetry
|
139
|
+
|
140
|
+
Telemetry is enabled by default, but you can disable it if needed:
|
141
|
+
|
142
|
+
1. Set an environment variable:
|
143
|
+
```bash
|
144
|
+
export AIRTRAIN_TELEMETRY_ENABLED=false
|
145
|
+
```
|
146
|
+
|
147
|
+
2. In your Python code:
|
148
|
+
```python
|
149
|
+
import os
|
150
|
+
os.environ["AIRTRAIN_TELEMETRY_ENABLED"] = "false"
|
151
|
+
```
|
152
|
+
|
153
|
+
### Viewing Telemetry Debug Information
|
154
|
+
|
155
|
+
To see what telemetry data is being sent:
|
156
|
+
```python
|
157
|
+
os.environ["AIRTRAIN_LOGGING_LEVEL"] = "debug"
|
158
|
+
```
|
159
|
+
|
160
|
+
## Contributing
|
161
|
+
|
162
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
163
|
+
|
164
|
+
## License
|
165
|
+
|
166
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
@@ -0,0 +1,149 @@
|
|
1
|
+
"""
|
2
|
+
Airtrain: AI Agent Framework
|
3
|
+
|
4
|
+
This library provides a flexible framework for building AI agents
|
5
|
+
that can complete complex tasks using AI models, skills, and tools.
|
6
|
+
"""
|
7
|
+
|
8
|
+
__version__ = "0.1.4"
|
9
|
+
|
10
|
+
import sys
|
11
|
+
|
12
|
+
# Core imports
|
13
|
+
from .core import Skill, ProcessingError, InputSchema, OutputSchema, BaseCredentials
|
14
|
+
|
15
|
+
# Integration imports - Credentials
|
16
|
+
from .integrations import (
|
17
|
+
# OpenAI
|
18
|
+
OpenAICredentials,
|
19
|
+
OpenAIChatSkill,
|
20
|
+
OpenAICompletionSkill,
|
21
|
+
# Anthropic
|
22
|
+
AnthropicCredentials,
|
23
|
+
AnthropicChatSkill,
|
24
|
+
# Together.ai
|
25
|
+
TogetherAICredentials,
|
26
|
+
TogetherChatSkill,
|
27
|
+
# Fireworks
|
28
|
+
FireworksCredentials,
|
29
|
+
FireworksChatSkill,
|
30
|
+
# Google
|
31
|
+
GeminiCredentials,
|
32
|
+
GeminiChatSkill,
|
33
|
+
# Search
|
34
|
+
ExaCredentials,
|
35
|
+
ExaSearchSkill,
|
36
|
+
ExaSearchInputSchema,
|
37
|
+
ExaSearchOutputSchema,
|
38
|
+
)
|
39
|
+
|
40
|
+
# Integration imports - Skills
|
41
|
+
from .integrations.aws.skills import AWSBedrockSkill
|
42
|
+
from .integrations.google.skills import GoogleChatSkill
|
43
|
+
from .integrations.groq.skills import GroqChatSkill
|
44
|
+
from .integrations.ollama.skills import OllamaChatSkill
|
45
|
+
from .integrations.sambanova.skills import SambanovaChatSkill
|
46
|
+
from .integrations.cerebras.skills import CerebrasChatSkill
|
47
|
+
|
48
|
+
# Tool imports
|
49
|
+
from .tools import (
|
50
|
+
ToolFactory,
|
51
|
+
register_tool,
|
52
|
+
StatelessTool,
|
53
|
+
StatefulTool,
|
54
|
+
BaseTool,
|
55
|
+
ListDirectoryTool,
|
56
|
+
DirectoryTreeTool,
|
57
|
+
ApiCallTool,
|
58
|
+
ExecuteCommandTool,
|
59
|
+
FindFilesTool,
|
60
|
+
TerminalNavigationTool,
|
61
|
+
SearchTermTool,
|
62
|
+
RunPytestTool,
|
63
|
+
)
|
64
|
+
|
65
|
+
# Agent imports
|
66
|
+
from .agents import (
|
67
|
+
BaseAgent,
|
68
|
+
AgentFactory,
|
69
|
+
register_agent,
|
70
|
+
BaseMemory,
|
71
|
+
ShortTermMemory,
|
72
|
+
LongTermMemory,
|
73
|
+
SharedMemory,
|
74
|
+
)
|
75
|
+
|
76
|
+
# Telemetry import - must be imported after version is defined
|
77
|
+
from .telemetry import telemetry
|
78
|
+
from .telemetry import PackageImportTelemetryEvent
|
79
|
+
|
80
|
+
|
81
|
+
__all__ = [
|
82
|
+
# Core
|
83
|
+
"Skill",
|
84
|
+
"ProcessingError",
|
85
|
+
"InputSchema",
|
86
|
+
"OutputSchema",
|
87
|
+
"BaseCredentials",
|
88
|
+
# OpenAI Integration
|
89
|
+
"OpenAICredentials",
|
90
|
+
"OpenAIChatSkill",
|
91
|
+
"OpenAICompletionSkill",
|
92
|
+
# Anthropic Integration
|
93
|
+
"AnthropicCredentials",
|
94
|
+
"AnthropicChatSkill",
|
95
|
+
# Together Integration
|
96
|
+
"TogetherAICredentials",
|
97
|
+
"TogetherChatSkill",
|
98
|
+
# Fireworks Integration
|
99
|
+
"FireworksCredentials",
|
100
|
+
"FireworksChatSkill",
|
101
|
+
# Google Integration
|
102
|
+
"GeminiCredentials",
|
103
|
+
"GeminiChatSkill",
|
104
|
+
# Search Integration
|
105
|
+
"ExaCredentials",
|
106
|
+
"ExaSearchSkill",
|
107
|
+
"ExaSearchInputSchema",
|
108
|
+
"ExaSearchOutputSchema",
|
109
|
+
# Tools
|
110
|
+
"ToolFactory",
|
111
|
+
"register_tool",
|
112
|
+
"StatelessTool",
|
113
|
+
"StatefulTool",
|
114
|
+
"BaseTool",
|
115
|
+
"ListDirectoryTool",
|
116
|
+
"DirectoryTreeTool",
|
117
|
+
"ApiCallTool",
|
118
|
+
"ExecuteCommandTool",
|
119
|
+
"FindFilesTool",
|
120
|
+
"TerminalNavigationTool",
|
121
|
+
"SearchTermTool",
|
122
|
+
"RunPytestTool",
|
123
|
+
# Agents
|
124
|
+
"BaseAgent",
|
125
|
+
"AgentFactory",
|
126
|
+
"register_agent",
|
127
|
+
"BaseMemory",
|
128
|
+
"ShortTermMemory",
|
129
|
+
"LongTermMemory",
|
130
|
+
"SharedMemory",
|
131
|
+
# Telemetry - not directly exposed to users
|
132
|
+
# but initialized at import time
|
133
|
+
]
|
134
|
+
|
135
|
+
# Capture import telemetry
|
136
|
+
try:
|
137
|
+
telemetry.capture(
|
138
|
+
PackageImportTelemetryEvent(
|
139
|
+
version=__version__,
|
140
|
+
python_version=(
|
141
|
+
f"{sys.version_info.major}."
|
142
|
+
f"{sys.version_info.minor}."
|
143
|
+
f"{sys.version_info.micro}"
|
144
|
+
),
|
145
|
+
)
|
146
|
+
)
|
147
|
+
except Exception:
|
148
|
+
# Silently continue if telemetry fails
|
149
|
+
pass
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"""
|
2
|
+
Agents package for AirTrain.
|
3
|
+
|
4
|
+
This package provides a registry of agents that can be used to build AI systems.
|
5
|
+
"""
|
6
|
+
|
7
|
+
# Import registry components
|
8
|
+
from .registry import (
|
9
|
+
BaseAgent,
|
10
|
+
AgentFactory,
|
11
|
+
register_agent,
|
12
|
+
AgentRegistry
|
13
|
+
)
|
14
|
+
|
15
|
+
# Import memory components
|
16
|
+
from .memory import (
|
17
|
+
BaseMemory,
|
18
|
+
ShortTermMemory,
|
19
|
+
LongTermMemory,
|
20
|
+
SharedMemory,
|
21
|
+
AgentMemoryManager
|
22
|
+
)
|
23
|
+
|
24
|
+
# Import agent implementations
|
25
|
+
from .groq_agent import GroqAgent
|
26
|
+
|
27
|
+
__all__ = [
|
28
|
+
# Base classes
|
29
|
+
"BaseAgent",
|
30
|
+
|
31
|
+
# Registry components
|
32
|
+
"AgentFactory",
|
33
|
+
"register_agent",
|
34
|
+
"AgentRegistry",
|
35
|
+
|
36
|
+
# Memory components
|
37
|
+
"BaseMemory",
|
38
|
+
"ShortTermMemory",
|
39
|
+
"LongTermMemory",
|
40
|
+
"SharedMemory",
|
41
|
+
"AgentMemoryManager",
|
42
|
+
|
43
|
+
# Agent implementations
|
44
|
+
"GroqAgent",
|
45
|
+
]
|