[WIP] Implement deep research logic from Python to C##34
Closed
Copilot wants to merge 1 commit into
Closed
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original prompt
Implement the provided Python
deep_research.pylogic as faithfully as possible in theSerialKicked/Lethe-AI-Sharpcodebase on branchmaster, preserving the original algorithmic structure and behavior rather than replacing it with a generic research scaffold.Requirements:
product,comparison,howto,factcheck)_emit(...)phases (planning,searching,reading,analyzing,writing,warning,error)LLMEngineIPromptBuilder(including structured output support where helpful)EnrichedSearchResultDeliverable:
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: I was wondering how easy it would be to turn this (joined) python code into C# and integrate the whole concept into Lethe AI. Any idea?
Assistant: Yes — very doable, and this file is actually a good candidate for a C# port.
Short version: this is not “hard to translate” algorithmically. It’s mostly orchestration code: async loops, prompt construction, JSON parsing, cancellation, concurrency limiting, and calling existing services. That kind of logic maps cleanly from Python to modern C#/.NET. The real work is less about syntax conversion and more about wiring it into Lethe AI’s existing abstractions for LLM calls, search providers, webpage fetching, progress events, and settings.
Difficulty estimate
I’d rate it roughly:
If Lethe AI already has:
then this becomes much easier.
Why this code ports well
This file is mostly composed of patterns C# handles very well:
async/awaitNothing here depends on very Python-specific features like:
So the concept transfers cleanly.
What the class actually is in C# terms
In C#, I’d think of this as something like:
DeepResearchServiceorIterativeResearchEngineILLMClientISearchProvideror search-provider factoryIWebContentFetcherIResearchProgressSinkorIProgress<ResearchProgressEvent>The Python class already has a nice service-oriented shape:
ResearchAsync(...)That maps very naturally to a C# class.
Main translation points
1. Async methods
Python:
async def research(...)asyncio.gatherasyncio.SemaphoreC# equivalent:
Task<string> ResearchAsync(...)Task.WhenAll(...)This pull request was created from Copilot chat.