From 701c1d2cd296b9eaec113fdad1d5d98b193a8c13 Mon Sep 17 00:00:00 2001 From: ilanm Date: Mon, 24 Nov 2025 16:01:12 +0200 Subject: [PATCH 1/4] fix: maestro read --- README.md | 14 ++++++++---- examples/studio/maestro/async_run.py | 34 +++++++++++++++------------- examples/studio/maestro/run.py | 29 +++++++++++++----------- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 9bfa0d19..2821e860 100644 --- a/README.md +++ b/README.md @@ -259,18 +259,22 @@ from ai21 import AI21Client client = AI21Client() run_result = client.beta.maestro.runs.create_and_poll( - input="Write a poem about the ocean", + input="Tell me about AI21 Maestro", requirements=[ { "name": "length requirement", - "description": "The length of the poem should be less than 1000 characters", + "description": "The length of the response should be less than 2000 characters", }, { - "name": "rhyme requirement", - "description": "The poem should rhyme", + "name": "source requirement", + "description": ( + "Should rely on information from these websites: " + "https://www.ai21.com/, https://www.ai21.com/maestro/, " + "https://docs.ai21.com/home" + ), }, ], - include=["requirements_result"] + include=["requirements_result"] # Include additional fields in the result ) ``` diff --git a/examples/studio/maestro/async_run.py b/examples/studio/maestro/async_run.py index b3b634c7..faff1c02 100644 --- a/examples/studio/maestro/async_run.py +++ b/examples/studio/maestro/async_run.py @@ -8,24 +8,26 @@ async def main(): try: run_result = await client.beta.maestro.runs.create_and_poll( - input="Write a poem about the ocean", - requirements=[ - { - "name": "length requirement", - "description": "The length of the poem should be less than 1000 characters", - }, - { - "name": "rhyme requirement", - "description": "The poem should rhyme", - }, - ], - include=["requirements_result"], - ) - - print(run_result) + input="Tell me about AI21 Maestro", + requirements=[ + { + "name": "length requirement", + "description": "The length of the response should be less than 2000 characters", + }, + { + "name": "source requirement", + "description": ( + "Should rely on information from these websites: " + "https://www.ai21.com/, https://www.ai21.com/maestro/, " + "https://docs.ai21.com/home" + ), + }, + ], + include=["requirements_result"] + ) + print(run_result.result) except TimeoutError: print("The run timed out") - if __name__ == "__main__": asyncio.run(main()) diff --git a/examples/studio/maestro/run.py b/examples/studio/maestro/run.py index b32258e4..7a26cc65 100644 --- a/examples/studio/maestro/run.py +++ b/examples/studio/maestro/run.py @@ -6,20 +6,23 @@ def main(): try: run_result = client.beta.maestro.runs.create_and_poll( - input="Write a poem about the ocean", - requirements=[ - { - "name": "length requirement", - "description": "The length of the poem should be less than 1000 characters", - }, - { - "name": "rhyme requirement", - "description": "The poem should rhyme", - }, - ], - include=["requirements_result"], + input="Tell me about AI21 Maestro", + requirements=[ + { + "name": "length requirement", + "description": "The length of the response should be less than 2000 characters", + }, + { + "name": "source requirement", + "description": ( + "Should rely on information from these websites: " + "https://www.ai21.com/, https://www.ai21.com/maestro/, " + "https://docs.ai21.com/home" + ), + }, + ], + include=["requirements_result"] ) - print(run_result) except TimeoutError: print("The run timed out") From aa6fa389e677fb678607e4980d611c8e421e2c29 Mon Sep 17 00:00:00 2001 From: ilanm Date: Mon, 24 Nov 2025 16:37:57 +0200 Subject: [PATCH 2/4] fix: format --- examples/studio/maestro/async_run.py | 37 ++++++++++++++-------------- examples/studio/maestro/run.py | 32 ++++++++++++------------ 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/examples/studio/maestro/async_run.py b/examples/studio/maestro/async_run.py index faff1c02..ca029fab 100644 --- a/examples/studio/maestro/async_run.py +++ b/examples/studio/maestro/async_run.py @@ -8,26 +8,27 @@ async def main(): try: run_result = await client.beta.maestro.runs.create_and_poll( - input="Tell me about AI21 Maestro", - requirements=[ - { - "name": "length requirement", - "description": "The length of the response should be less than 2000 characters", - }, - { - "name": "source requirement", - "description": ( - "Should rely on information from these websites: " - "https://www.ai21.com/, https://www.ai21.com/maestro/, " - "https://docs.ai21.com/home" - ), - }, - ], - include=["requirements_result"] - ) - print(run_result.result) + input="Tell me about AI21 Maestro", + requirements=[ + { + "name": "length requirement", + "description": "The length of the response should be less than 2000 characters", + }, + { + "name": "source requirement", + "description": ( + "Should rely on information from these websites: " + "https://www.ai21.com/, https://www.ai21.com/maestro/, " + "https://docs.ai21.com/home" + ), + }, + ], + include=["requirements_result"], + ) + print(run_result.result) except TimeoutError: print("The run timed out") + if __name__ == "__main__": asyncio.run(main()) diff --git a/examples/studio/maestro/run.py b/examples/studio/maestro/run.py index 7a26cc65..8d20adad 100644 --- a/examples/studio/maestro/run.py +++ b/examples/studio/maestro/run.py @@ -6,22 +6,22 @@ def main(): try: run_result = client.beta.maestro.runs.create_and_poll( - input="Tell me about AI21 Maestro", - requirements=[ - { - "name": "length requirement", - "description": "The length of the response should be less than 2000 characters", - }, - { - "name": "source requirement", - "description": ( - "Should rely on information from these websites: " - "https://www.ai21.com/, https://www.ai21.com/maestro/, " - "https://docs.ai21.com/home" - ), - }, - ], - include=["requirements_result"] + input="Tell me about AI21 Maestro", + requirements=[ + { + "name": "length requirement", + "description": "The length of the response should be less than 2000 characters", + }, + { + "name": "source requirement", + "description": ( + "Should rely on information from these websites: " + "https://www.ai21.com/, https://www.ai21.com/maestro/, " + "https://docs.ai21.com/home" + ), + }, + ], + include=["requirements_result"], ) print(run_result) except TimeoutError: From e5d57a9311b4b57e919b0d8d035f215d1af54745 Mon Sep 17 00:00:00 2001 From: ilanm Date: Mon, 24 Nov 2025 18:27:37 +0200 Subject: [PATCH 3/4] feat: empty From 44bf8686447c492d71dc39eef67197fa471fd176 Mon Sep 17 00:00:00 2001 From: ilanm Date: Mon, 24 Nov 2025 18:59:12 +0200 Subject: [PATCH 4/4] chore: align tests --- tests/integration_tests/clients/test_studio.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/integration_tests/clients/test_studio.py b/tests/integration_tests/clients/test_studio.py index 6c7efd82..35986305 100644 --- a/tests/integration_tests/clients/test_studio.py +++ b/tests/integration_tests/clients/test_studio.py @@ -50,8 +50,6 @@ def test_studio(test_file_name: str): argvalues=[ ("chat/async_chat_completions.py",), ("chat/async_stream_chat_completions.py",), - ("conversational_rag/conversational_rag.py",), - ("conversational_rag/async_conversational_rag.py",), ("maestro/run.py",), ("maestro/async_run.py",), ("agents/agent_crud.py",), @@ -61,8 +59,6 @@ def test_studio(test_file_name: str): ids=[ "when_chat_completions__should_return_ok", "when_stream_chat_completions__should_return_ok", - "when_conversational_rag__should_return_ok", - "when_async_conversational_rag__should_return_ok", "when_maestro_runs__should_return_ok", "when_maestro_async_runs__should_return_ok", "when_agent_crud__should_return_ok",