airtrain 0.1.27__py3-none-any.whl → 0.1.28__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 +1 -1
- airtrain/integrations/fireworks/structured_requests_skills.py +21 -1
- {airtrain-0.1.27.dist-info → airtrain-0.1.28.dist-info}/METADATA +7 -1
- {airtrain-0.1.27.dist-info → airtrain-0.1.28.dist-info}/RECORD +6 -6
- {airtrain-0.1.27.dist-info → airtrain-0.1.28.dist-info}/WHEEL +0 -0
- {airtrain-0.1.27.dist-info → airtrain-0.1.28.dist-info}/top_level.txt +0 -0
airtrain/__init__.py
CHANGED
@@ -3,6 +3,7 @@ from pydantic import BaseModel, Field
|
|
3
3
|
import requests
|
4
4
|
import json
|
5
5
|
from loguru import logger
|
6
|
+
import re
|
6
7
|
|
7
8
|
from airtrain.core.skills import Skill, ProcessingError
|
8
9
|
from airtrain.core.schemas import InputSchema, OutputSchema
|
@@ -47,6 +48,7 @@ class FireworksStructuredRequestOutput(OutputSchema):
|
|
47
48
|
parsed_response: Any
|
48
49
|
used_model: str
|
49
50
|
usage: Dict[str, int]
|
51
|
+
reasoning: Optional[str] = None
|
50
52
|
|
51
53
|
|
52
54
|
class FireworksStructuredRequestSkill(
|
@@ -141,6 +143,18 @@ class FireworksStructuredRequestSkill(
|
|
141
143
|
except Exception as e:
|
142
144
|
raise ProcessingError(f"Fireworks streaming request failed: {str(e)}")
|
143
145
|
|
146
|
+
def _parse_response_content(self, content: str) -> tuple[Optional[str], str]:
|
147
|
+
"""Parse response content to extract reasoning and JSON."""
|
148
|
+
# Extract reasoning if present
|
149
|
+
reasoning_match = re.search(r"<think>(.*?)</think>", content, re.DOTALL)
|
150
|
+
reasoning = reasoning_match.group(1).strip() if reasoning_match else None
|
151
|
+
|
152
|
+
# Extract JSON
|
153
|
+
json_match = re.search(r"</think>\s*(\{.*\})", content, re.DOTALL)
|
154
|
+
json_str = json_match.group(1).strip() if json_match else content
|
155
|
+
|
156
|
+
return reasoning, json_str
|
157
|
+
|
144
158
|
def process(
|
145
159
|
self, input_data: FireworksStructuredRequestInput
|
146
160
|
) -> FireworksStructuredRequestOutput:
|
@@ -175,14 +189,20 @@ class FireworksStructuredRequestSkill(
|
|
175
189
|
data = response.json()
|
176
190
|
|
177
191
|
response_content = data["choices"][0]["message"]["content"]
|
192
|
+
|
193
|
+
# Parse the response content to extract reasoning and JSON
|
194
|
+
reasoning, json_str = self._parse_response_content(response_content)
|
195
|
+
|
196
|
+
# Parse the JSON string into the specified model
|
178
197
|
parsed_response = input_data.response_model.model_validate_json(
|
179
|
-
|
198
|
+
json_str
|
180
199
|
)
|
181
200
|
|
182
201
|
return FireworksStructuredRequestOutput(
|
183
202
|
parsed_response=parsed_response,
|
184
203
|
used_model=input_data.model,
|
185
204
|
usage=data["usage"],
|
205
|
+
reasoning=reasoning, # Add reasoning to output if present
|
186
206
|
)
|
187
207
|
|
188
208
|
except Exception as e:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: airtrain
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.28
|
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
|
@@ -171,6 +171,12 @@ This project is licensed under the MIT License - see the LICENSE file for detail
|
|
171
171
|
## Changelog
|
172
172
|
|
173
173
|
|
174
|
+
|
175
|
+
## 0.1.28
|
176
|
+
|
177
|
+
- Bug fix: reasoning to Fireworks structured output.
|
178
|
+
- Added reasoning to Fireworks structured output.
|
179
|
+
|
174
180
|
## 0.1.27
|
175
181
|
|
176
182
|
- Added structured completion skills for Fireworks AI
|
@@ -1,4 +1,4 @@
|
|
1
|
-
airtrain/__init__.py,sha256=
|
1
|
+
airtrain/__init__.py,sha256=ZUseQpkG-otzfnOZRjQZHpJYG6w2R-c-k872-UMaRqI,2099
|
2
2
|
airtrain/contrib/__init__.py,sha256=pG-7mJ0pBMqp3Q86mIF9bo1PqoBOVSGlnEK1yY1U1ok,641
|
3
3
|
airtrain/contrib/travel/__init__.py,sha256=clmBodw4nkTA-DsgjVGcXfJGPaWxIpCZDtdO-8RzL0M,811
|
4
4
|
airtrain/contrib/travel/agents.py,sha256=tpQtZ0WUiXBuhvZtc2JlEam5TuR5l-Tndi14YyImDBM,8975
|
@@ -25,7 +25,7 @@ airtrain/integrations/fireworks/models.py,sha256=F-MddbLCLAsTjwRr1l6IpJxOegyY4pD
|
|
25
25
|
airtrain/integrations/fireworks/requests_skills.py,sha256=zPIR70l0KdSGmA5WyDEopFAdKHSPltAttJBzWyHu6Bk,5878
|
26
26
|
airtrain/integrations/fireworks/skills.py,sha256=OB4epD4CSTxExUCC1oMJ_8rHLOoftlxf0FUoIVrd4mA,5163
|
27
27
|
airtrain/integrations/fireworks/structured_completion_skills.py,sha256=IXG4gsZDSfuscrmKIHfnyHkBaCV7zlPInaWXb95iC5k,6428
|
28
|
-
airtrain/integrations/fireworks/structured_requests_skills.py,sha256=
|
28
|
+
airtrain/integrations/fireworks/structured_requests_skills.py,sha256=5FllptmuUewS1OX3Jf0vK6kQjMV4QJmisExbs0ElWPY,8150
|
29
29
|
airtrain/integrations/fireworks/structured_skills.py,sha256=BZaLqSOTC11QdZ4kDORS4JnwF_YXBAa-IiwQ5dJiHXw,3895
|
30
30
|
airtrain/integrations/google/__init__.py,sha256=ElwgcXfbg_gGMm6zbkMXCQPFKZUb-yTJk986o19A7Cs,214
|
31
31
|
airtrain/integrations/google/credentials.py,sha256=KSvWNqW8Mjr4MkysRvUqlrOSGdShNIe5u2OPO6vRrWY,2047
|
@@ -57,7 +57,7 @@ airtrain/integrations/together/rerank_skill.py,sha256=gjH24hLWCweWKPyyfKZMG3K_g9
|
|
57
57
|
airtrain/integrations/together/schemas.py,sha256=pBMrbX67oxPCr-sg4K8_Xqu1DWbaC4uLCloVSascROg,1210
|
58
58
|
airtrain/integrations/together/skills.py,sha256=mUoHc2r5TYQi5iGzwz2aDuUeROGq7teCtNrOlNApef4,6276
|
59
59
|
airtrain/integrations/together/vision_models_config.py,sha256=m28HwYDk2Kup_J-a1FtynIa2ZVcbl37kltfoHnK8zxs,1544
|
60
|
-
airtrain-0.1.
|
61
|
-
airtrain-0.1.
|
62
|
-
airtrain-0.1.
|
63
|
-
airtrain-0.1.
|
60
|
+
airtrain-0.1.28.dist-info/METADATA,sha256=svDrTc0qzBYsuYKGR0VKg7AZSIEMQpUht1M2csmWGH0,5243
|
61
|
+
airtrain-0.1.28.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
62
|
+
airtrain-0.1.28.dist-info/top_level.txt,sha256=cFWW1vY6VMCb3AGVdz6jBDpZ65xxBRSqlsPyySxTkxY,9
|
63
|
+
airtrain-0.1.28.dist-info/RECORD,,
|
File without changes
|
File without changes
|