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

Add function get_similar_content_by_query_with_vectorstore. #961

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion gpt_researcher/skills/context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ async def get_similar_content_by_query(self, query, pages):
return await context_compressor.async_get_context(
query=query, max_results=10, cost_callback=self.researcher.add_costs
)


async def get_similar_content_by_query_with_vectorstore(self, query, filter):
if self.researcher.verbose:
await stream_output(
"logs",
"fetching_query_format",
f" Getting relevant content based on query: {query}...",
self.researcher.websocket,
)
vectorstore_compressor = VectorstoreCompressor(self.researcher.vector_store, filter)
return await vectorstore_compressor.async_get_context(query=query, max_results=8)


async def get_similar_written_contents_by_draft_section_titles(
self,
current_subtopic: str,
Expand Down