Created
June 30, 2025 15:20
-
-
Save anton-pt/ca9cacf3f67ae4256c34f96297a9922d to your computer and use it in GitHub Desktop.
MeetQu service using Restate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const MeetQuService = restate.service({ | |
| name: 'MeetQuService', | |
| handlers: { | |
| runSearch: restate.handlers.handler( | |
| async (ctx: restate.Context, request): Promise<SearchContext> => { | |
| // Generate short bio in parallel with main pipeline | |
| const shortBioPromise = ctx | |
| .serviceClient(MeetQuService) | |
| .generateShortBio(request); | |
| // Generate full research brief | |
| const fullResearchBrief = await ctx | |
| .serviceClient(MeetQuService) | |
| .generateFullResearchBrief(request); | |
| const requestWithBrief = { ...request, fullResearchBrief }; | |
| // Generate all insights in parallel | |
| const [connectOverInsights, talkAboutInsights, keepInMindInsights] = | |
| await restate.RestatePromise.all([ | |
| ctx.serviceClient(MeetQuService) | |
| .generateConnectOverInsights(requestWithBrief), | |
| ctx.serviceClient(MeetQuService) | |
| .generateTalkAboutInsights(requestWithBrief), | |
| ctx.serviceClient(MeetQuService) | |
| .generateKeepInMindInsights(requestWithBrief), | |
| ]); | |
| // Wait for both compiled insights and short bio | |
| const [compiledInsights, shortBio] = await restate.RestatePromise.all([ | |
| ctx.serviceClient(MeetQuService).generateCompiledInsights({ | |
| ...requestWithBrief, | |
| connectOverInsights, | |
| talkAboutInsights, | |
| keepInMindInsights, | |
| }), | |
| shortBioPromise, | |
| ]); | |
| return { | |
| ...requestWithBrief, | |
| connectOverInsights, | |
| talkAboutInsights, | |
| keepInMindInsights, | |
| compiledInsights, | |
| shortBio, | |
| }; | |
| } | |
| ), | |
| // ... individual step handlers | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment