Skip to content

Conversation

@yanxi0830
Copy link
Contributor

@yanxi0830 yanxi0830 commented Mar 4, 2025

What does this PR do?

Test Plan

LLAMA_STACK_BASE_URL=http://localhost:8321 pytest -v tests/integration/agents/test_agents.py --inference-model "meta-llama/Llama-3.3-70B-Instruct"
image
LLAMA_STACK_CONFIG=fireworks pytest -v tests/integration/agents/test_agents.py::test_rag_and_code_agent --inference-model "meta-llama/Llama-3.3-70B-Instruct"

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 4, 2025
@yanxi0830 yanxi0830 marked this pull request as ready for review March 4, 2025 21:56
@yanxi0830 yanxi0830 changed the title chore(wip): refactor create_and_execute_turn and resume_turn chore: refactor create_and_execute_turn and resume_turn Mar 4, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ehhuang I wonder when we should run the test with the generated mocks? It seems like server implementation changes will require re-running --record_response.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally not? unless the key or response structure changed? did the requests going into the inference layer change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't expect that this change requires rerecord. Might be a bug if so, either in the mock util or code. Which key was missing?

Copy link
Contributor Author

@yanxi0830 yanxi0830 Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FAILED tests/integration/agents/test_agents.py::test_rag_agent_with_attachments[txt=meta-llama/Llama-3.3-70B-Instruct-toolgroup0] - KeyError: 'No cached response found for key: (\'meta-llama/Llama-3.3-70B-Instruct\', [SystemMessage(role=\'system\', content=\'You are ...
FAILED tests/integration/agents/test_agents.py::test_rag_agent_with_attachments[txt=meta-llama/Llama-3.3-70B-Instruct-builtin::rag/knowledge_search] - KeyError: 'No cached response found for key: (\'meta-llama/Llama-3.3-70B-Instruct\', [SystemMessage(role=\'system\', content=\'You are ...

Oh I think there's some key missing, going to commit this new generated json.

if event.payload.event_type == AgentTurnResponseEventType.step_complete.value:
steps.append(event.payload.step_details)

async for chunk in self._run_turn(request, turn_id):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beauty

if event.payload.event_type == AgentTurnResponseEventType.step_complete.value:
steps.append(event.payload.step_details)

async for chunk in self._run_turn(request, turn_id):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beauty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't expect that this change requires rerecord. Might be a bug if so, either in the mock util or code. Which key was missing?

@yanxi0830 yanxi0830 merged commit 78962be into main Mar 5, 2025
3 checks passed
@yanxi0830 yanxi0830 deleted the refactor_agent_loop branch March 5, 2025 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce code duplication in agent loops for create_turn and resume_turn

5 participants