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:
parent
ce0616a471
commit
10030c6a12
3 changed files with 5 additions and 5 deletions
|
|
@ -30,6 +30,7 @@ def display_tools_table(tools: list[ToolDefinition]) -> None:
|
||||||
tool.toolkit.name,
|
tool.toolkit.name,
|
||||||
tool.toolkit.version,
|
tool.toolkit.version,
|
||||||
)
|
)
|
||||||
|
console.print(f"Found {len(tools)} tools.")
|
||||||
console.print(table)
|
console.print(table)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,10 +98,9 @@ def get_tools_from_engine(
|
||||||
client = Arcade(api_key=config.api.key, base_url=config.engine_url)
|
client = Arcade(api_key=config.api.key, base_url=config.engine_url)
|
||||||
|
|
||||||
tools = []
|
tools = []
|
||||||
# TODO: This is a hack! limit=100 is a workaround for broken(?) pagination in Stainless
|
page_iterator = client.tools.list(toolkit=toolkit or NOT_GIVEN)
|
||||||
for page in client.tools.list(limit=100, toolkit=toolkit or NOT_GIVEN).iter_pages():
|
for tool in page_iterator:
|
||||||
for item in page:
|
tools.append(ToolDefinition.model_validate(tool.model_dump()))
|
||||||
tools.append(ToolDefinition.model_validate(item.model_dump()))
|
|
||||||
|
|
||||||
return tools
|
return tools
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ rich = "^13.7.1"
|
||||||
toml = "^0.10.2"
|
toml = "^0.10.2"
|
||||||
tomlkit = "^0.12.4"
|
tomlkit = "^0.12.4"
|
||||||
openai = "^1.36.0" # TODO: relax to an earlier version that still has what we need
|
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"
|
pyjwt = "^2.8.0"
|
||||||
loguru = "^0.7.0"
|
loguru = "^0.7.0"
|
||||||
types-python-dateutil = "2.9.0.20241003"
|
types-python-dateutil = "2.9.0.20241003"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue