airtrain 0.1.40__py3-none-any.whl → 0.1.41__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.40"
3
+ __version__ = "0.1.41"
4
4
 
5
5
  # Core imports
6
6
  from .core.skills import Skill, ProcessingError
@@ -2,5 +2,18 @@
2
2
 
3
3
  from .credentials import TogetherAICredentials
4
4
  from .skills import TogetherAIChatSkill
5
+ from .list_models import (
6
+ TogetherListModelsSkill,
7
+ TogetherListModelsInput,
8
+ TogetherListModelsOutput,
9
+ )
10
+ from .models import TogetherModel
5
11
 
6
- __all__ = ["TogetherAICredentials", "TogetherAIChatSkill"]
12
+ __all__ = [
13
+ "TogetherAICredentials",
14
+ "TogetherAIChatSkill",
15
+ "TogetherListModelsSkill",
16
+ "TogetherListModelsInput",
17
+ "TogetherListModelsOutput",
18
+ "TogetherModel",
19
+ ]
@@ -0,0 +1,77 @@
1
+ from typing import Optional
2
+ import requests
3
+ from pydantic import Field
4
+
5
+ from airtrain.core.skills import Skill, ProcessingError
6
+ from airtrain.core.schemas import InputSchema, OutputSchema
7
+ from .credentials import TogetherAICredentials
8
+ from .models import TogetherModel
9
+
10
+
11
+ class TogetherListModelsInput(InputSchema):
12
+ """Schema for Together AI list models input"""
13
+ pass
14
+
15
+
16
+ class TogetherListModelsOutput(OutputSchema):
17
+ """Schema for Together AI list models output"""
18
+
19
+ data: list[TogetherModel] = Field(
20
+ default_factory=list,
21
+ description="List of Together AI models"
22
+ )
23
+ object: Optional[str] = Field(
24
+ default=None,
25
+ description="Object type"
26
+ )
27
+
28
+
29
+ class TogetherListModelsSkill(Skill[TogetherListModelsInput, TogetherListModelsOutput]):
30
+ """Skill for listing Together AI models"""
31
+
32
+ input_schema = TogetherListModelsInput
33
+ output_schema = TogetherListModelsOutput
34
+
35
+ def __init__(self, credentials: Optional[TogetherAICredentials] = None):
36
+ """Initialize the skill with optional credentials"""
37
+ super().__init__()
38
+ self.credentials = credentials or TogetherAICredentials.from_env()
39
+ self.base_url = "https://api.together.xyz/v1"
40
+
41
+ def process(
42
+ self, input_data: TogetherListModelsInput
43
+ ) -> TogetherListModelsOutput:
44
+ """Process the input and return a list of models."""
45
+ try:
46
+ # Build the URL
47
+ url = f"{self.base_url}/models"
48
+
49
+ # Make the request
50
+ headers = {
51
+ "Authorization": (
52
+ f"Bearer {self.credentials.together_api_key.get_secret_value()}"
53
+ ),
54
+ "accept": "application/json"
55
+ }
56
+
57
+ response = requests.get(url, headers=headers)
58
+ response.raise_for_status()
59
+
60
+ # Parse the response
61
+ result = response.json()
62
+
63
+ # Convert the models to TogetherModel objects
64
+ models = []
65
+ for model_data in result.get("data", []):
66
+ models.append(TogetherModel(**model_data))
67
+
68
+ # Return the output
69
+ return TogetherListModelsOutput(
70
+ data=models,
71
+ object=result.get("object")
72
+ )
73
+
74
+ except requests.RequestException as e:
75
+ raise ProcessingError(f"Failed to list Together AI models: {str(e)}")
76
+ except Exception as e:
77
+ raise ProcessingError(f"Error listing Together AI models: {str(e)}")
@@ -1,6 +1,5 @@
1
- from typing import List, Optional
1
+ from typing import List, Optional, Dict, Any
2
2
  from pydantic import BaseModel, Field, validator
3
- from pathlib import Path
4
3
 
5
4
 
6
5
  class TogetherAIImageInput(BaseModel):
@@ -30,7 +29,7 @@ class TogetherAIImageInput(BaseModel):
30
29
  if width <= 0 or height <= 0:
31
30
  raise ValueError
32
31
  return v
33
- except:
32
+ except ValueError:
34
33
  raise ValueError("Size must be in format WIDTHxHEIGHT (e.g., 1024x1024)")
35
34
 
36
35
 
@@ -54,3 +53,43 @@ class TogetherAIImageOutput(BaseModel):
54
53
  usage: dict = Field(
55
54
  default_factory=dict, description="Usage statistics and billing information"
56
55
  )
56
+
57
+
58
+ class TogetherModel(BaseModel):
59
+ """Schema for Together AI model"""
60
+
61
+ id: str = Field(..., description="Model ID")
62
+ name: Optional[str] = Field(None, description="Model name")
63
+ object: Optional[str] = Field(None, description="Object type")
64
+ created: Optional[int] = Field(None, description="Creation timestamp")
65
+ owned_by: Optional[str] = Field(None, description="Model owner")
66
+ root: Optional[str] = Field(None, description="Root model identifier")
67
+ parent: Optional[str] = Field(None, description="Parent model identifier")
68
+ permission: Optional[List[Dict[str, Any]]] = Field(
69
+ None, description="Permission details"
70
+ )
71
+ metadata: Optional[Dict[str, Any]] = Field(
72
+ None, description="Additional metadata for the model"
73
+ )
74
+ description: Optional[str] = Field(None, description="Model description")
75
+ pricing: Optional[Dict[str, Any]] = Field(None, description="Pricing information")
76
+ context_length: Optional[int] = Field(
77
+ None, description="Maximum context length supported by the model"
78
+ )
79
+ capabilities: Optional[List[str]] = Field(
80
+ None, description="Model capabilities"
81
+ )
82
+
83
+
84
+ class TogetherListModelsInput(BaseModel):
85
+ """Schema for listing Together AI models input"""
86
+ pass
87
+
88
+
89
+ class TogetherListModelsOutput(BaseModel):
90
+ """Schema for listing Together AI models output"""
91
+
92
+ data: List[TogetherModel] = Field(
93
+ ..., description="List of Together AI models"
94
+ )
95
+ object: Optional[str] = Field(None, description="Object type")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: airtrain
3
- Version: 0.1.40
3
+ Version: 0.1.41
4
4
  Summary: A platform for building and deploying AI agents with structured skills
5
5
  Home-page: https://github.com/rosaboyle/airtrain.dev
6
6
  Author: Dheeraj Pai
@@ -1,4 +1,4 @@
1
- airtrain/__init__.py,sha256=fRBP9B8-SN5didcE8h1LLAPTuQTxiODu_-bbKGWLDR4,2099
1
+ airtrain/__init__.py,sha256=KrDT-Fn1iruBhdnav_vK-wkcO6-ZfwcOCDukwElOxEU,2099
2
2
  airtrain/__main__.py,sha256=EU8ffFmCdC1G-UcHHt0Oo3lB1PGqfC6kwzH39CnYSwU,72
3
3
  airtrain/builder/__init__.py,sha256=D33sr0k_WAe6FAJkk8rUaivEzFaeVqLXkQgyFWEhfPU,110
4
4
  airtrain/builder/agent_builder.py,sha256=3XnGUAcK_6lWoUDtL0TanliQZuh7u0unhNbnrz1z2-I,5018
@@ -52,21 +52,22 @@ airtrain/integrations/openai/skills.py,sha256=1dvRJYrnU2hOmGRlkHBtyR6P8D7aIwHZfU
52
52
  airtrain/integrations/sambanova/__init__.py,sha256=dp_263iOckM_J9pOEvyqpf3FrejD6-_x33r0edMCTe0,179
53
53
  airtrain/integrations/sambanova/credentials.py,sha256=JyN8sbMCoXuXAjim46aI3LTicBijoemS7Ao0rn4yBJU,824
54
54
  airtrain/integrations/sambanova/skills.py,sha256=SZ_GAimMiOCILiNkzyhNflyRR6bdC5r0Tnog19K8geU,4997
55
- airtrain/integrations/together/__init__.py,sha256=we4KXn_pUs6Dxo3QcB-t40BSRraQFdKg2nXw7yi2FjM,185
55
+ airtrain/integrations/together/__init__.py,sha256=P6AH0kWgYmXGOupbLqBXCsY-KV1tcCV9UtvmJ6BGqFE,463
56
56
  airtrain/integrations/together/audio_models_config.py,sha256=GtqfmKR1vJ5x4B3kScvEO3x4exvzwNP78vcGVTk_fBE,1004
57
57
  airtrain/integrations/together/credentials.py,sha256=cYNhyIwgsxm8LfiFfT-omBvgV3mUP6SZeRSukyzzDlI,747
58
58
  airtrain/integrations/together/embedding_models_config.py,sha256=F0ISAXCG_Pcnf-ojkvZwIXacXD8LaU8hQmGHCFzmlds,2927
59
59
  airtrain/integrations/together/image_models_config.py,sha256=JlCozrphI9zE4uYpGfj4DCWSN6GZGyr84Tb1HmjNQ28,2455
60
60
  airtrain/integrations/together/image_skill.py,sha256=wQ8wSzfL-QHpM_esYGLNXf8ciOPPsz-QJw6zSrxZT68,5214
61
- airtrain/integrations/together/models.py,sha256=ZW5xfEN9fU18aeltb-sB2O-Bnu5sLkDPZqvUtxgoH-U,2112
61
+ airtrain/integrations/together/list_models.py,sha256=BFq_w3Rz9WP2gKIaQNNIyUJUaYkz-FCSEbNMClccrsY,2580
62
+ airtrain/integrations/together/models.py,sha256=q5KsouOK7IvyzGZ7nhSjTpZw-CcLfPghJr6o_UU9uMo,3652
62
63
  airtrain/integrations/together/models_config.py,sha256=XMKp0Oq1nWWnMMdNAZxkFXmJaURwWrwLE18kFXsMsRw,8829
63
64
  airtrain/integrations/together/rerank_models_config.py,sha256=coCg0IOG2tU4L2uc2uPtPdoBwGjSc_zQwxENwdDuwHE,1188
64
65
  airtrain/integrations/together/rerank_skill.py,sha256=gjH24hLWCweWKPyyfKZMG3K_g9gWzm80WgiJNjkA9eg,1894
65
66
  airtrain/integrations/together/schemas.py,sha256=pBMrbX67oxPCr-sg4K8_Xqu1DWbaC4uLCloVSascROg,1210
66
67
  airtrain/integrations/together/skills.py,sha256=8DwkexMJu1Gm6QmNDfNasYStQ31QsXBbFP99zR-YCf0,7598
67
68
  airtrain/integrations/together/vision_models_config.py,sha256=m28HwYDk2Kup_J-a1FtynIa2ZVcbl37kltfoHnK8zxs,1544
68
- airtrain-0.1.40.dist-info/METADATA,sha256=3-KnsKsMdriztxTjdEWoJF599N3oicxpw2x17-mrQaw,5375
69
- airtrain-0.1.40.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
70
- airtrain-0.1.40.dist-info/entry_points.txt,sha256=rrJ36IUsyq6n1dSfTWXqVAgpQLPRWDfCqwd6_3B-G0U,52
71
- airtrain-0.1.40.dist-info/top_level.txt,sha256=cFWW1vY6VMCb3AGVdz6jBDpZ65xxBRSqlsPyySxTkxY,9
72
- airtrain-0.1.40.dist-info/RECORD,,
69
+ airtrain-0.1.41.dist-info/METADATA,sha256=mOYF47bkfI4rQJFBkcmnHZ47u1Pqh6e_S8-4Ps3KmGg,5375
70
+ airtrain-0.1.41.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
71
+ airtrain-0.1.41.dist-info/entry_points.txt,sha256=rrJ36IUsyq6n1dSfTWXqVAgpQLPRWDfCqwd6_3B-G0U,52
72
+ airtrain-0.1.41.dist-info/top_level.txt,sha256=cFWW1vY6VMCb3AGVdz6jBDpZ65xxBRSqlsPyySxTkxY,9
73
+ airtrain-0.1.41.dist-info/RECORD,,