Skip to content

Feature/api turntaking #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Feature/api turntaking #290

wants to merge 26 commits into from

Conversation

sani903
Copy link
Collaborator

@sani903 sani903 commented Feb 26, 2025

📑 Description

This PR adds WebSocket support for turnwise interaction in Sotopia. The implementation enables real-time interaction between:

  • Non-NPC and NPC
  • Two NPCs

Unit tests have been added to ensure correctness, and the WebSocket implementation supports smooth turnwise communication.

  • WebSocket implementation for turnwise interaction
  • Support for Non-NPC to NPC interaction
  • Support for NPC to NPC interaction
  • Unit tests for WebSocket functionality

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed
  • Branch name follows type/descript (e.g. feature/add-llm-agents)
  • Ready for code review

ℹ Additional Information

No breaking changes. The WebSocket implementation integrates seamlessly with existing logic. Let me know if any modifications or additional tests are needed.

Copy link

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 92.02658% with 24 lines in your changes missing coverage. Please review.

Project coverage is 77.37%. Comparing base (47aab1a) to head (8fd869a).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
tests/api/test_turntaking.py 85.24% 18 Missing ⚠️
tests/api/test_turntaking_atomic.py 97.77% 3 Missing ⚠️
sotopia/api/fastapi_server.py 90.47% 2 Missing ⚠️
sotopia/api/websocket_utils.py 95.65% 1 Missing ⚠️
@@             Coverage Diff             @@
##             main     #290       +/-   ##
===========================================
+ Coverage   32.29%   77.37%   +45.08%     
===========================================
  Files          50       65       +15     
  Lines        2793     3912     +1119     
===========================================
+ Hits          902     3027     +2125     
+ Misses       1891      885     -1006     
Files with missing lines Coverage Δ
tests/api/test_fastapi.py 89.44% <ø> (ø)
sotopia/api/websocket_utils.py 87.91% <95.65%> (+87.91%) ⬆️
sotopia/api/fastapi_server.py 73.16% <90.47%> (+73.16%) ⬆️
tests/api/test_turntaking_atomic.py 97.77% <97.77%> (ø)
tests/api/test_turntaking.py 85.24% <85.24%> (ø)

... and 34 files with indirect coverage changes

Copy link
Member

@XuhuiZhou XuhuiZhou left a comment

Choose a reason for hiding this comment

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

okay so the websocket enables turn-taking. qq, how does the connection with redis agent work here?

is the redisagent still on the tac side? (maybe share the tac repo with me as well?)

@sani903
Copy link
Collaborator Author

sani903 commented Feb 27, 2025

okay so the websocket enables turn-taking. qq, how does the connection with redis agent work here?

is the redisagent still on the tac side? (maybe share the tac repo with me as well?)

We have the NPCs stored on Sotopia side (created/deleted using FastAPI calls from TAC). The main agent interacts with these NPCs, with the message broker still on TAC side.
I will share the TAC fork with you.

@sani903 sani903 force-pushed the feature/API-turntaking branch from cfc3b63 to 6c7de04 Compare March 2, 2025 05:50
@sani903 sani903 force-pushed the feature/API-turntaking branch from d8b4ea5 to 2ac8912 Compare March 2, 2025 05:57
@sani903 sani903 force-pushed the feature/API-turntaking branch from a81417e to 97818bf Compare March 2, 2025 06:09
@sani903 sani903 force-pushed the feature/API-turntaking branch from 5f214d2 to 5bc7714 Compare March 2, 2025 06:12
@sani903 sani903 force-pushed the feature/API-turntaking branch from 8b50805 to 3643e68 Compare March 2, 2025 06:22
@sani903 sani903 force-pushed the feature/API-turntaking branch from 3943012 to be6593a Compare March 2, 2025 06:28
@sani903 sani903 force-pushed the feature/API-turntaking branch from 465c2bf to 07de04f Compare March 2, 2025 06:35
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