Skip to content

Commit

Permalink
added similarity threshold to config env var
Browse files Browse the repository at this point in the history
  • Loading branch information
assafelovic committed Jun 12, 2024
1 parent bf960a7 commit 7be4efd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions gpt_researcher/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def __init__(self, config_file: str = None):
self.config_file = os.path.expanduser(config_file) if config_file else os.getenv('CONFIG_FILE')
self.retriever = os.getenv('RETRIEVER', "duckduckgo")
self.embedding_provider = os.getenv('EMBEDDING_PROVIDER', 'openai')
self.fast_token_limit = int(os.getenv('SIMILARITY_THRESHOLD', 0.38))

This comment has been minimized.

Copy link
@gkhngyk

gkhngyk Jun 14, 2024

Contributor

self.fast_token_limit ??

self.llm_provider = os.getenv('LLM_PROVIDER', "openai")
self.ollama_base_url = os.getenv('OLLAMA_BASE_URL', None)
self.fast_llm_model = os.getenv('FAST_LLM_MODEL', "gpt-3.5-turbo-16k")
Expand Down
3 changes: 2 additions & 1 deletion gpt_researcher/context/compression.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from .retriever import SearchAPIRetriever
from langchain.retrievers import (
ContextualCompressionRetriever,
Expand All @@ -17,7 +18,7 @@ def __init__(self, documents, embeddings, max_results=5, **kwargs):
self.documents = documents
self.kwargs = kwargs
self.embeddings = embeddings
self.similarity_threshold = 0.38
self.similarity_threshold = os.environ.get("SIMILARITY_THRESHOLD", 0.38)

def __get_contextual_retriever(self):
splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
Expand Down

0 comments on commit 7be4efd

Please sign in to comment.