airtrain 0.1.3__py3-none-any.whl → 0.1.6__py3-none-any.whl

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/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Airtrain - A platform for building and deploying AI agents with structured skills"""
2
2
 
3
- __version__ = "0.1.3"
3
+ __version__ = "0.1.6"
4
4
 
5
5
  from .core.skills import Skill
6
6
  from .core.schemas import InputSchema, OutputSchema
@@ -5,7 +5,7 @@ from pathlib import Path
5
5
  from abc import ABC, abstractmethod
6
6
  import dotenv
7
7
  from pydantic import BaseModel, Field, SecretStr
8
- import yaml # type: ignore
8
+ import yaml
9
9
 
10
10
 
11
11
  class CredentialError(Exception):
@@ -100,7 +100,7 @@ class BaseCredentials(BaseModel):
100
100
  else:
101
101
  raise ValueError(f"Unsupported file format: {file_path.suffix}")
102
102
 
103
- def validate_credentials(self) -> None:
103
+ async def validate_credentials(self) -> bool:
104
104
  """Validate that all required credentials are present"""
105
105
  missing = []
106
106
  for field_name in self._required_credentials:
@@ -114,6 +114,7 @@ class BaseCredentials(BaseModel):
114
114
  raise CredentialValidationError(
115
115
  f"Missing required credentials: {', '.join(missing)}"
116
116
  )
117
+ return True
117
118
 
118
119
  def clear_from_env(self) -> None:
119
120
  """Remove credentials from environment variables"""
@@ -122,32 +123,3 @@ class BaseCredentials(BaseModel):
122
123
  if env_key in os.environ:
123
124
  del os.environ[env_key]
124
125
  self._loaded = False
125
-
126
-
127
- class OpenAICredentials(BaseCredentials):
128
- """OpenAI API credentials"""
129
-
130
- api_key: SecretStr = Field(..., description="OpenAI API key")
131
- organization_id: Optional[str] = Field(None, description="OpenAI organization ID")
132
-
133
- _required_credentials = {"api_key"}
134
-
135
-
136
- class AWSCredentials(BaseCredentials):
137
- """AWS credentials"""
138
-
139
- aws_access_key_id: SecretStr
140
- aws_secret_access_key: SecretStr
141
- aws_region: str = "us-east-1"
142
- aws_session_token: Optional[SecretStr] = None
143
-
144
- _required_credentials = {"aws_access_key_id", "aws_secret_access_key"}
145
-
146
-
147
- class GoogleCloudCredentials(BaseCredentials):
148
- """Google Cloud credentials"""
149
-
150
- project_id: str
151
- service_account_key: SecretStr
152
-
153
- _required_credentials = {"project_id", "service_account_key"}
@@ -0,0 +1,26 @@
1
+ """Airtrain integrations package"""
2
+
3
+ from .openai.credentials import OpenAICredentials
4
+ from .aws.credentials import AWSCredentials
5
+ from .google.credentials import GoogleCloudCredentials
6
+ from .anthropic.credentials import AnthropicCredentials
7
+ from .groq.credentials import GroqCredentials
8
+ from .together.credentials import TogetherAICredentials
9
+ from .ollama.credentials import OllamaCredentials
10
+ from .sambanova.credentials import SambanovaCredentials
11
+ from .cerebras.credentials import CerebrasCredentials
12
+
13
+ from .anthropic.skills import AnthropicChatSkill
14
+
15
+ __all__ = [
16
+ "OpenAICredentials",
17
+ "AWSCredentials",
18
+ "GoogleCloudCredentials",
19
+ "AnthropicCredentials",
20
+ "AnthropicChatSkill",
21
+ "GroqCredentials",
22
+ "TogetherAICredentials",
23
+ "OllamaCredentials",
24
+ "SambanovaCredentials",
25
+ "CerebrasCredentials",
26
+ ]
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.2
2
+ Name: airtrain
3
+ Version: 0.1.6
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: helloworldcmu@gmail.com
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: pydantic>=2.0.0
19
+ Requires-Dist: openai>=1.0.0
20
+ Requires-Dist: python-dotenv>=0.19.0
21
+ Requires-Dist: PyYAML>=5.4.1
22
+ Requires-Dist: firebase-admin>=5.0.0
23
+ Requires-Dist: loguru>=0.5.3
24
+ Dynamic: author
25
+ Dynamic: author-email
26
+ Dynamic: classifier
27
+ Dynamic: description
28
+ Dynamic: description-content-type
29
+ Dynamic: home-page
30
+ Dynamic: requires-dist
31
+ Dynamic: requires-python
32
+ Dynamic: summary
33
+
34
+ # Airtrain
35
+
36
+ A powerful platform for building and deploying AI agents with structured skills and capabilities.
37
+
38
+ ## Features
39
+
40
+ - **Structured Skills**: Build modular AI skills with defined input/output schemas
41
+ - **Multiple LLM Integrations**: Built-in support for OpenAI and Anthropic models
42
+ - **Structured Outputs**: Parse LLM responses into structured Pydantic models
43
+ - **Credential Management**: Secure handling of API keys and credentials
44
+ - **Type Safety**: Full type hints and Pydantic model support
45
+ - **Image Support**: Handle image inputs for multimodal models
46
+ - **Error Handling**: Robust error handling and logging
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install airtrain
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ ### 1. Basic OpenAI Chat
57
+
58
+ ```python
59
+ from airtrain.integrations.openai.skills import OpenAIChatSkill, OpenAIInput
60
+
61
+ # Initialize the skill
62
+ skill = OpenAIChatSkill()
63
+
64
+ # Create input
65
+ input_data = OpenAIInput(
66
+ user_input="Explain quantum computing in simple terms.",
67
+ system_prompt="You are a helpful teacher.",
68
+ max_tokens=500,
69
+ temperature=0.7
70
+ )
71
+
72
+ # Get response
73
+ result = skill.process(input_data)
74
+ print(result.response)
75
+ print(f"Tokens Used: {result.usage['total_tokens']}")
76
+ ```
77
+
78
+ ### 2. Anthropic Claude Integration
79
+
80
+ ```python
81
+ from airtrain.integrations.anthropic.skills import AnthropicChatSkill, AnthropicInput
82
+
83
+ # Initialize the skill
84
+ skill = AnthropicChatSkill()
85
+
86
+ # Create input
87
+ input_data = AnthropicInput(
88
+ user_input="Explain the theory of relativity.",
89
+ system_prompt="You are a physics expert.",
90
+ model="claude-3-opus-20240229",
91
+ temperature=0.3
92
+ )
93
+
94
+ # Get response
95
+ result = skill.process(input_data)
96
+ print(result.response)
97
+ print(f"Usage: {result.usage}")
98
+ ```
99
+
100
+ ### 3. Structured Output with OpenAI
101
+
102
+ ```python
103
+ from pydantic import BaseModel
104
+ from typing import List
105
+ from airtrain.integrations.openai.skills import OpenAIParserSkill, OpenAIParserInput
106
+
107
+ # Define your response model
108
+ class PersonInfo(BaseModel):
109
+ name: str
110
+ age: int
111
+ occupation: str
112
+ skills: List[str]
113
+
114
+ # Initialize the parser skill
115
+ parser_skill = OpenAIParserSkill()
116
+
117
+ # Create input with response model
118
+ input_data = OpenAIParserInput(
119
+ user_input="Tell me about John Doe, a 30-year-old software engineer who specializes in Python and AI",
120
+ system_prompt="Extract structured information about the person.",
121
+ response_model=PersonInfo
122
+ )
123
+
124
+ # Get structured response
125
+ result = parser_skill.process(input_data)
126
+ person_info = result.parsed_response
127
+ print(f"Name: {person_info.name}")
128
+ print(f"Skills: {', '.join(person_info.skills)}")
129
+ ```
130
+
131
+ ## Error Handling
132
+
133
+ All skills include built-in error handling:
134
+
135
+ ```python
136
+ from airtrain.core.skills import ProcessingError
137
+
138
+ try:
139
+ result = skill.process(input_data)
140
+ except ProcessingError as e:
141
+ print(f"Processing failed: {e}")
142
+ ```
143
+
144
+ ## Advanced Features
145
+
146
+ - Image Analysis Support
147
+ - Function Calling
148
+ - Custom Validators
149
+ - Async Processing
150
+ - Token Usage Tracking
151
+
152
+ For more examples and detailed documentation, visit our [documentation](https://airtrain.readthedocs.io/).
153
+
154
+ ## Documentation
155
+
156
+ For detailed documentation, visit [our documentation site](https://docs.airtrain.dev/).
157
+
158
+ ## Contributing
159
+
160
+ Contributions are welcome! Please feel free to submit a Pull Request.
161
+
162
+ ## License
163
+
164
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,10 @@
1
+ airtrain/__init__.py,sha256=t0n2IItXdHzaLZf_1zSUmSf3buF-8Y4FJol1LAzSclk,312
2
+ airtrain/core/__init__.py,sha256=9h7iKwTzZocCPc9bU6j8bA02BokteWIOcO1uaqGMcrk,254
3
+ airtrain/core/credentials.py,sha256=PgQotrQc46J5djidKnkK1znUv3fyNkUFDO-m2Kn_Gzo,4006
4
+ airtrain/core/schemas.py,sha256=MMXrDviC4gRea_QaPpbjgO--B_UKxnD7YrxqZOLJZZU,7003
5
+ airtrain/core/skills.py,sha256=LljalzeSHK5eQPTAOEAYc5D8Qn1kVSfiz9WgziTD5UM,4688
6
+ airtrain/integrations/__init__.py,sha256=PRKI_A-KE307C4lpXgFAsZA2oFtTl1kt_4CrRUF2rpU,832
7
+ airtrain-0.1.6.dist-info/METADATA,sha256=C0hcwg_Am0cUqrv8vKfNJ_AeMdBfGhxrSEmzDbjJA7o,4380
8
+ airtrain-0.1.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
9
+ airtrain-0.1.6.dist-info/top_level.txt,sha256=cFWW1vY6VMCb3AGVdz6jBDpZ65xxBRSqlsPyySxTkxY,9
10
+ airtrain-0.1.6.dist-info/RECORD,,
@@ -1,106 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: airtrain
3
- Version: 0.1.3
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: helloworldcmu@gmail.com
8
- Classifier: Development Status :: 3 - Alpha
9
- Classifier: Intended Audience :: Developers
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.8
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
- Requires-Python: >=3.8
17
- Description-Content-Type: text/markdown
18
- Requires-Dist: pydantic>=2.0.0
19
- Requires-Dist: openai>=1.0.0
20
- Requires-Dist: python-dotenv>=0.19.0
21
- Requires-Dist: PyYAML>=5.4.1
22
- Requires-Dist: firebase-admin>=5.0.0
23
- Requires-Dist: loguru>=0.5.3
24
- Dynamic: author
25
- Dynamic: author-email
26
- Dynamic: classifier
27
- Dynamic: description
28
- Dynamic: description-content-type
29
- Dynamic: home-page
30
- Dynamic: requires-dist
31
- Dynamic: requires-python
32
- Dynamic: summary
33
-
34
- # Airtrain
35
-
36
- A powerful platform for building and deploying AI agents with structured skills and capabilities.
37
-
38
- ## Features
39
-
40
- - **Structured Skills**: Build modular AI skills with defined input/output schemas
41
- - **OpenAI Integration**: Built-in support for OpenAI's GPT models with structured outputs
42
- - **Credential Management**: Secure handling of API keys and credentials
43
- - **Type Safety**: Full type hints and Pydantic model support
44
- - **Async Support**: Both synchronous and asynchronous API implementations
45
-
46
- ## Installation
47
-
48
- ```bash
49
- pip install airtrain
50
- ```
51
-
52
- ## Quick Start
53
-
54
- ### Creating a Structured OpenAI Skill
55
-
56
- ```python
57
- from airtrain.core.skills import Skill
58
- from airtrain.core.schemas import InputSchema, OutputSchema
59
- from pydantic import BaseModel
60
- from typing import List
61
-
62
- # Define your response model
63
- class PersonInfo(BaseModel):
64
- name: str
65
- age: int
66
- occupation: str
67
- skills: List[str]
68
-
69
- # Create a skill
70
- class OpenAIParserSkill(Skill):
71
- def process(self, input_data):
72
- # Implementation
73
- return parsed_response
74
-
75
- # Use the skill
76
- skill = OpenAIParserSkill()
77
- result = skill.process(input_data)
78
- ```
79
-
80
- ### Managing Credentials
81
-
82
- ```python
83
- from airtrain.core.credentials import OpenAICredentials
84
- from pathlib import Path
85
-
86
- # Load credentials
87
- creds = OpenAICredentials(
88
- api_key="your-api-key",
89
- organization_id="optional-org-id"
90
- )
91
-
92
- # Save to environment
93
- creds.load_to_env()
94
- ```
95
-
96
- ## Documentation
97
-
98
- For detailed documentation, visit [our documentation site](https://docs.airtrain.dev/).
99
-
100
- ## Contributing
101
-
102
- Contributions are welcome! Please feel free to submit a Pull Request.
103
-
104
- ## License
105
-
106
- This project is licensed under the MIT License - see the LICENSE file for details.
@@ -1,9 +0,0 @@
1
- airtrain/__init__.py,sha256=tgJhVEwGGFzwlIrtXHGfUULQOZm8Tb4NOrRCXUTau9g,312
2
- airtrain/core/__init__.py,sha256=9h7iKwTzZocCPc9bU6j8bA02BokteWIOcO1uaqGMcrk,254
3
- airtrain/core/credentials.py,sha256=CzUZkAFxrSMC0nq70zybkkJmeIZDYiNBuzfivOTEgH0,4773
4
- airtrain/core/schemas.py,sha256=MMXrDviC4gRea_QaPpbjgO--B_UKxnD7YrxqZOLJZZU,7003
5
- airtrain/core/skills.py,sha256=LljalzeSHK5eQPTAOEAYc5D8Qn1kVSfiz9WgziTD5UM,4688
6
- airtrain-0.1.3.dist-info/METADATA,sha256=mbq-9NwqtCnevHmiKtC4r1jneyDrFyQJE0uvfSOir6s,2786
7
- airtrain-0.1.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
8
- airtrain-0.1.3.dist-info/top_level.txt,sha256=cFWW1vY6VMCb3AGVdz6jBDpZ65xxBRSqlsPyySxTkxY,9
9
- airtrain-0.1.3.dist-info/RECORD,,