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

refactor: use goroutinue instead of mutex to sync messages #842

Merged
merged 25 commits into from
Jun 28, 2024

Conversation

woorui
Copy link
Collaborator

@woorui woorui commented Jun 21, 2024

Description

The HTTP server startup creates a CallerProvider struct, which provides a Provide(credential string) method that returns a Caller.

The Caller and provider work together to provide invoke and chat completion functionality.

The Caller has a CallerSyncer attribute, which is responsible for synchronizing pub/sub information to the req/res.

Impact

The register no longer requires the Factor method, which ensures the correct execution of yomo test-prompt.

On the server-side, it is guaranteed that llm-sfn can only have one return, and if there are multiple returns, the first one will be used. If there is no return, the client will be notified of a timeout.

Test

Provide a mock provider which can record the requests to OpenAI and mock the responses from OpenAI.

Provide a mockDataFlow which is used to mock the data flow in Yomo, from the source -> handler -> reducer.

@woorui woorui self-assigned this Jun 21, 2024
@woorui woorui requested a review from venjiang as a code owner June 21, 2024 04:05
Copy link

vercel bot commented Jun 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
yomo ⬜️ Ignored (Inspect) Visit Preview Jun 27, 2024 0:07am

Copy link

codecov bot commented Jun 21, 2024

Codecov Report

Attention: Patch coverage is 73.90300% with 113 lines in your changes missing coverage. Please review.

Project coverage is 78.73%. Comparing base (cc2e6f2) to head (68a4399).

Files Patch % Lines
pkg/bridge/ai/caller.go 68.18% 38 Missing and 4 partials ⚠️
pkg/bridge/ai/api_server.go 57.57% 24 Missing and 4 partials ⚠️
pkg/bridge/ai/call_syncer.go 81.60% 16 Missing and 7 partials ⚠️
pkg/bridge/ai/provider/mock.go 85.07% 6 Missing and 4 partials ⚠️
pkg/bridge/ai/ai.go 72.00% 5 Missing and 2 partials ⚠️
pkg/bridge/ai/provider/openai/provider.go 60.00% 1 Missing and 1 partial ⚠️
serverless/mock/mock_context.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #842       +/-   ##
===========================================
+ Coverage   64.93%   78.73%   +13.79%     
===========================================
  Files          45       47        +2     
  Lines        2658     2718       +60     
===========================================
+ Hits         1726     2140      +414     
+ Misses        820      427      -393     
- Partials      112      151       +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@fanweixiao fanweixiao left a comment

Choose a reason for hiding this comment

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

Great work 🎆

And I think we'd better improve the comments for code, cause this is way complicated.

pkg/bridge/ai/call_syncer.go Outdated Show resolved Hide resolved
pkg/bridge/ai/call_syncer.go Outdated Show resolved Hide resolved
pkg/bridge/ai/call_syncer.go Outdated Show resolved Hide resolved
pkg/bridge/ai/call_syncer.go Show resolved Hide resolved
@fanweixiao fanweixiao merged commit 273b19a into master Jun 28, 2024
7 checks passed
@fanweixiao fanweixiao deleted the feat/syncer branch June 28, 2024 03:32
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.

None yet

3 participants