Skip to content

docs: Update Maestro Example#329

Closed
Moti2002 wants to merge 2 commits into
AI21Labs:mainfrom
Moti2002:main
Closed

docs: Update Maestro Example#329
Moti2002 wants to merge 2 commits into
AI21Labs:mainfrom
Moti2002:main

Conversation

@Moti2002

Copy link
Copy Markdown
Contributor

change this example:
from ai21 import AI21Client

client = AI21Client()

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"]
)

to this example:
+# Create and poll a Maestro run
+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"] # Include additional fields in the result
    +)

+# Output the result
+print("\n=== AI21 MAESTRO INFO ===")
+print(run_result.result)
+print()

@Moti2002 Moti2002 closed this Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant