Skip to content

Conversation

sumitaryal
Copy link
Contributor

@sumitaryal sumitaryal commented Mar 12, 2025

Previous:

async def main():
    agent = Agent(name="Assistant", instructions="Reply very concisely.")
    with trace(workflow_name="Conversation", group_id=thread_id):
        # First turn
        result = await Runner.run(agent, "What city is the Golden Gate Bridge in?")
        print(result.final_output)
        # San Francisco

        # Second turn
        new_input = output.to_input_list() + [{"role": "user", "content": "What state is it in?"}]
        result = await Runner.run(agent, new_input)
        print(result.final_output)
        # California

Updated:

async def main():
  agent = Agent(name="Assistant", instructions="Reply very concisely.")

  with trace(workflow_name="Conversation", group_id=thread_id):
      # First turn
      result = await Runner.run(agent, "What city is the Golden Gate Bridge in?")
      print(result.final_output)
      # San Francisco

      # Second turn
      new_input = result.to_input_list() + [{"role": "user", "content": "What state is it in?"}]
      result = await Runner.run(agent, new_input)
      print(result.final_output)
      # California

…input_list() instead of output.to_input_list()
@rm-openai
Copy link
Collaborator

this looks up to date on main

@rm-openai rm-openai closed this Mar 12, 2025
@sumitaryal sumitaryal deleted the bugfix-input-list-update branch March 13, 2025 02:44
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.

2 participants