Skip to content

Commit

Permalink
feat(agent): Ask for usage type
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola committed Jan 18, 2025
1 parent 8c31364 commit 37e4c7a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
25 changes: 23 additions & 2 deletions libertai_client/commands/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@
),
]

usage_type_choices: list[questionary.Choice] = [
questionary.Choice(
title="fastapi",
value=AgentUsageType.fastapi,
description="API-exposed agent",
),
questionary.Choice(
title="python",
value=AgentUsageType.python,
description="Agent called with Python code",
),
]


@app.command()
async def deploy(
Expand All @@ -59,11 +72,11 @@ async def deploy(
),
] = None,
usage_type: Annotated[
AgentUsageType,
AgentUsageType | None,
typer.Option(
help="How the agent is called", case_sensitive=False, prompt=False
),
] = AgentUsageType.fastapi,
] = None,
):
"""
Deploy or redeploy an agent
Expand Down Expand Up @@ -116,6 +129,14 @@ async def deploy(
validate=validate_python_version,
).ask_async()

if usage_type is None:
usage_type = await questionary.select(
"Usage type",
choices=usage_type_choices,
default=None,
show_description=True,
).ask_async()

agent_zip_path = "/tmp/libertai-agent.zip"
create_agent_zip(path, agent_zip_path)

Expand Down
4 changes: 2 additions & 2 deletions libertai_client/utils/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def detect_python_project_version(
return line.split("=")[1].strip()
except FileNotFoundError:
pass
#
# # Checking if we have a .python-version file, for example created by pyenv

# Checking if we have a .python-version file, for example created by pyenv
try:
version_file_path = get_full_path(project_path, ".python-version")
with open(version_file_path, "r") as file:
Expand Down

0 comments on commit 37e4c7a

Please sign in to comment.