Fix iteration when calling client.tools.list (#120)

**Blocked** until this is merged **and** Stainless clients are re-built:
https://github.com/ArcadeAI/Engine/pull/148
TODO: Update arcadepy version dependency.
This commit is contained in:
Nate Barbettini 2024-10-24 09:39:20 -07:00 committed by GitHub
parent ce0616a471
commit 10030c6a12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View file

@ -30,6 +30,7 @@ def display_tools_table(tools: list[ToolDefinition]) -> None:
tool.toolkit.name,
tool.toolkit.version,
)
console.print(f"Found {len(tools)} tools.")
console.print(table)

View file

@ -98,10 +98,9 @@ def get_tools_from_engine(
client = Arcade(api_key=config.api.key, base_url=config.engine_url)
tools = []
# TODO: This is a hack! limit=100 is a workaround for broken(?) pagination in Stainless
for page in client.tools.list(limit=100, toolkit=toolkit or NOT_GIVEN).iter_pages():
for item in page:
tools.append(ToolDefinition.model_validate(item.model_dump()))
page_iterator = client.tools.list(toolkit=toolkit or NOT_GIVEN)
for tool in page_iterator:
tools.append(ToolDefinition.model_validate(tool.model_dump()))
return tools

View file

@ -20,7 +20,7 @@ rich = "^13.7.1"
toml = "^0.10.2"
tomlkit = "^0.12.4"
openai = "^1.36.0" # TODO: relax to an earlier version that still has what we need
arcadepy = "~0.1.0"
arcadepy = "~0.1.1"
pyjwt = "^2.8.0"
loguru = "^0.7.0"
types-python-dateutil = "2.9.0.20241003"