airtrain 0.1.32__py3-none-any.whl → 0.1.35__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/cli/main.py +89 -32
- {airtrain-0.1.32.dist-info → airtrain-0.1.35.dist-info}/METADATA +2 -1
- {airtrain-0.1.32.dist-info → airtrain-0.1.35.dist-info}/RECORD +7 -7
- {airtrain-0.1.32.dist-info → airtrain-0.1.35.dist-info}/WHEEL +0 -0
- {airtrain-0.1.32.dist-info → airtrain-0.1.35.dist-info}/entry_points.txt +0 -0
- {airtrain-0.1.32.dist-info → airtrain-0.1.35.dist-info}/top_level.txt +0 -0
airtrain/__init__.py
CHANGED
airtrain/cli/main.py
CHANGED
@@ -1,13 +1,23 @@
|
|
1
1
|
import click
|
2
|
+
from typing import Optional
|
2
3
|
from airtrain.integrations.openai.skills import OpenAIChatSkill, OpenAIInput
|
4
|
+
from airtrain.integrations.anthropic.skills import AnthropicChatSkill, AnthropicInput
|
3
5
|
import os
|
4
6
|
from dotenv import load_dotenv
|
7
|
+
import sys
|
5
8
|
|
9
|
+
# Load environment variables
|
6
10
|
load_dotenv()
|
7
11
|
|
8
12
|
|
9
|
-
def initialize_chat():
|
10
|
-
|
13
|
+
def initialize_chat(provider: str = "openai"):
|
14
|
+
"""Initialize chat skill based on provider"""
|
15
|
+
if provider == "openai":
|
16
|
+
return OpenAIChatSkill()
|
17
|
+
elif provider == "anthropic":
|
18
|
+
return AnthropicChatSkill()
|
19
|
+
else:
|
20
|
+
raise ValueError(f"Unsupported provider: {provider}")
|
11
21
|
|
12
22
|
|
13
23
|
@click.group()
|
@@ -17,37 +27,84 @@ def cli():
|
|
17
27
|
|
18
28
|
|
19
29
|
@cli.command()
|
20
|
-
|
30
|
+
@click.option(
|
31
|
+
"--provider",
|
32
|
+
type=click.Choice(["openai", "anthropic"]),
|
33
|
+
default="openai",
|
34
|
+
help="The AI provider to use",
|
35
|
+
)
|
36
|
+
@click.option(
|
37
|
+
"--temperature",
|
38
|
+
type=float,
|
39
|
+
default=0.7,
|
40
|
+
help="Temperature for response generation (0.0-1.0)",
|
41
|
+
)
|
42
|
+
@click.option(
|
43
|
+
"--system-prompt",
|
44
|
+
type=str,
|
45
|
+
default="You are a helpful AI assistant that helps users build their own AI agents. Be helpful and provide clear explanations.",
|
46
|
+
help="System prompt to guide the model",
|
47
|
+
)
|
48
|
+
def chat(provider: str, temperature: float, system_prompt: str):
|
21
49
|
"""Start an interactive chat session with Airtrain"""
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
+
try:
|
51
|
+
skill = initialize_chat(provider)
|
52
|
+
|
53
|
+
click.echo(f"\nWelcome to Airtrain! Using {provider.upper()} as the provider.")
|
54
|
+
click.echo("Type 'exit' to end the conversation.")
|
55
|
+
click.echo("Type 'clear' to clear the conversation history.\n")
|
56
|
+
|
57
|
+
conversation_history = []
|
58
|
+
|
59
|
+
while True:
|
60
|
+
user_input = click.prompt("You", type=str)
|
61
|
+
|
62
|
+
if user_input.lower() == "exit":
|
63
|
+
click.echo("\nGoodbye! Have a great day!")
|
64
|
+
break
|
65
|
+
|
66
|
+
if user_input.lower() == "clear":
|
67
|
+
conversation_history = []
|
68
|
+
click.echo("\nConversation history cleared!")
|
69
|
+
continue
|
70
|
+
|
71
|
+
try:
|
72
|
+
if provider == "openai":
|
73
|
+
input_data = OpenAIInput(
|
74
|
+
user_input=user_input,
|
75
|
+
system_prompt=system_prompt,
|
76
|
+
conversation_history=conversation_history,
|
77
|
+
model="gpt-4o",
|
78
|
+
temperature=temperature,
|
79
|
+
)
|
80
|
+
else:
|
81
|
+
input_data = AnthropicInput(
|
82
|
+
user_input=user_input,
|
83
|
+
system_prompt=system_prompt,
|
84
|
+
conversation_history=conversation_history,
|
85
|
+
model="claude-3-opus-20240229",
|
86
|
+
temperature=temperature,
|
87
|
+
)
|
88
|
+
|
89
|
+
result = skill.process(input_data)
|
90
|
+
|
91
|
+
# Update conversation history
|
92
|
+
conversation_history.extend(
|
93
|
+
[
|
94
|
+
{"role": "user", "content": user_input},
|
95
|
+
{"role": "assistant", "content": result.response},
|
96
|
+
]
|
97
|
+
)
|
98
|
+
|
99
|
+
click.echo(f"\nAirtrain: {result.response}\n")
|
100
|
+
|
101
|
+
except Exception as e:
|
102
|
+
click.echo(f"\nError: {str(e)}\n")
|
103
|
+
|
104
|
+
except Exception as e:
|
105
|
+
click.echo(f"Failed to initialize chat: {str(e)}")
|
106
|
+
sys.exit(1)
|
50
107
|
|
51
108
|
|
52
109
|
if __name__ == "__main__":
|
53
|
-
|
110
|
+
cli()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: airtrain
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.35
|
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
|
@@ -48,6 +48,7 @@ Requires-Dist: build>=0.10.0; extra == "dev"
|
|
48
48
|
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
49
49
|
Requires-Dist: types-requests>=2.31.0; extra == "dev"
|
50
50
|
Requires-Dist: types-Markdown>=3.5.0; extra == "dev"
|
51
|
+
Requires-Dist: toml>=0.10.2; extra == "dev"
|
51
52
|
Dynamic: author
|
52
53
|
Dynamic: home-page
|
53
54
|
Dynamic: requires-python
|
@@ -1,6 +1,6 @@
|
|
1
|
-
airtrain/__init__.py,sha256=
|
1
|
+
airtrain/__init__.py,sha256=HxQoDsFRceRrgV-8HMhQ9NQYkwqFREBJoxpqHBVcE40,2099
|
2
2
|
airtrain/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
airtrain/cli/main.py,sha256=
|
3
|
+
airtrain/cli/main.py,sha256=Y6QxIcoqctJNn7_HLRvOb3WhF9MhBeK3KacpEV-Xwto,3415
|
4
4
|
airtrain/contrib/__init__.py,sha256=pG-7mJ0pBMqp3Q86mIF9bo1PqoBOVSGlnEK1yY1U1ok,641
|
5
5
|
airtrain/contrib/travel/__init__.py,sha256=clmBodw4nkTA-DsgjVGcXfJGPaWxIpCZDtdO-8RzL0M,811
|
6
6
|
airtrain/contrib/travel/agents.py,sha256=tpQtZ0WUiXBuhvZtc2JlEam5TuR5l-Tndi14YyImDBM,8975
|
@@ -59,8 +59,8 @@ airtrain/integrations/together/rerank_skill.py,sha256=gjH24hLWCweWKPyyfKZMG3K_g9
|
|
59
59
|
airtrain/integrations/together/schemas.py,sha256=pBMrbX67oxPCr-sg4K8_Xqu1DWbaC4uLCloVSascROg,1210
|
60
60
|
airtrain/integrations/together/skills.py,sha256=8DwkexMJu1Gm6QmNDfNasYStQ31QsXBbFP99zR-YCf0,7598
|
61
61
|
airtrain/integrations/together/vision_models_config.py,sha256=m28HwYDk2Kup_J-a1FtynIa2ZVcbl37kltfoHnK8zxs,1544
|
62
|
-
airtrain-0.1.
|
63
|
-
airtrain-0.1.
|
64
|
-
airtrain-0.1.
|
65
|
-
airtrain-0.1.
|
66
|
-
airtrain-0.1.
|
62
|
+
airtrain-0.1.35.dist-info/METADATA,sha256=puapNvVJkJ9KZ5BBsnrkQ5aFEetk52M79ePuZd6EOCo,5375
|
63
|
+
airtrain-0.1.35.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
64
|
+
airtrain-0.1.35.dist-info/entry_points.txt,sha256=rrJ36IUsyq6n1dSfTWXqVAgpQLPRWDfCqwd6_3B-G0U,52
|
65
|
+
airtrain-0.1.35.dist-info/top_level.txt,sha256=cFWW1vY6VMCb3AGVdz6jBDpZ65xxBRSqlsPyySxTkxY,9
|
66
|
+
airtrain-0.1.35.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|