Skip to content
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

Deploy the api to modal #267

Merged
merged 8 commits into from
Dec 28, 2024
Merged

Deploy the api to modal #267

merged 8 commits into from
Dec 28, 2024

Conversation

bugsz
Copy link
Contributor

@bugsz bugsz commented Dec 13, 2024

This pr majorly

  1. Refactor the original FastAPI
  2. Add deployment to modal in modal_api_server

Closes #

πŸ“‘ Description

βœ… 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

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 50.50847% with 292 lines in your changes missing coverage. Please review.

Project coverage is 70.36%. Comparing base (61f190e) to head (501660d).

Files with missing lines Patch % Lines
sotopia/ui/fastapi_server.py 49.81% 136 Missing ⚠️
sotopia/ui/modal_api_server.py 0.00% 43 Missing ⚠️
sotopia/database/evaluation_dimensions.py 37.09% 39 Missing ⚠️
sotopia/ui/websocket_utils.py 49.33% 38 Missing ⚠️
sotopia/server.py 71.21% 19 Missing ⚠️
tests/ui/test_fastapi.py 72.72% 15 Missing ⚠️
sotopia/database/serialization.py 0.00% 1 Missing ⚠️
sotopia/envs/parallel.py 0.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main     #267      +/-   ##
==========================================
- Coverage   74.47%   70.36%   -4.12%     
==========================================
  Files          61       64       +3     
  Lines        3162     3664     +502     
==========================================
+ Hits         2355     2578     +223     
- Misses        807     1086     +279     
Files with missing lines Coverage Ξ”
sotopia/database/__init__.py 100.00% <100.00%> (ΓΈ)
sotopia/database/logs.py 94.33% <100.00%> (+0.46%) ⬆️
sotopia/database/persistent_profile.py 89.83% <100.00%> (+0.17%) ⬆️
tests/database/test_database.py 98.24% <100.00%> (+0.24%) ⬆️
tests/sampler/test_sampler.py 100.00% <100.00%> (ΓΈ)
sotopia/database/serialization.py 97.87% <0.00%> (ΓΈ)
sotopia/envs/parallel.py 77.71% <0.00%> (ΓΈ)
tests/ui/test_fastapi.py 89.13% <72.72%> (-10.87%) ⬇️
sotopia/server.py 44.38% <71.21%> (+2.71%) ⬆️
sotopia/ui/websocket_utils.py 49.33% <49.33%> (ΓΈ)
... and 3 more

@ProKil ProKil changed the base branch from main to demo December 13, 2024 03:52
Copy link
Member

@ProKil ProKil left a comment

Choose a reason for hiding this comment

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

it looks good to me, but please make sure that the pytest is passed.

"apt-get install -y redis-stack-server",
)
.pip_install(
"pydantic>=2.5.0,<3.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

Why not just install sotopia? This is not useful for maintaining dependencies.

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.

Added the modal deployment process to the doc?

@bugsz
Copy link
Contributor Author

bugsz commented Dec 14, 2024

it looks good to me, but please make sure that the pytest is passed.

@ProKil Current SotopiaFastAPI inherits FastAPI and there should not be any issue. I tested on my end and it works well.

bugsz and others added 4 commits December 14, 2024 03:20
- Added a new script for the modal API server that initializes a Redis instance.
- Created a persistent volume for Redis data and included a function to download initial data if not present.
- Configured a Docker image with necessary dependencies including Redis Stack and FastAPI.
- Implemented a web API class that sets up and cleans up the Redis connection, ensuring readiness before serving requests.
- Integrated the SotopiaFastAPI application within the modal framework.
@XuhuiZhou XuhuiZhou merged commit 1f4fb0a into demo Dec 28, 2024
1 check passed
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.

3 participants