mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-02 10:39:13 +00:00
chore: cleanup
This commit is contained in:
parent
82a4eb3966
commit
a1aad295bb
4 changed files with 16 additions and 23 deletions
|
@ -119,13 +119,13 @@ This is the core of SurfSense. Before we begin let's look at `.env` variables' t
|
||||||
| EMBEDDING_MODEL| Name of the embedding model to use for vector embeddings. Currently works with Sentence Transformers only. Expect other embeddings soon. Eg. `mixedbread-ai/mxbai-embed-large-v1`|
|
| EMBEDDING_MODEL| Name of the embedding model to use for vector embeddings. Currently works with Sentence Transformers only. Expect other embeddings soon. Eg. `mixedbread-ai/mxbai-embed-large-v1`|
|
||||||
| RERANKERS_MODEL_NAME| Name of the reranker model for search result reranking. Eg. `ms-marco-MiniLM-L-12-v2`|
|
| RERANKERS_MODEL_NAME| Name of the reranker model for search result reranking. Eg. `ms-marco-MiniLM-L-12-v2`|
|
||||||
| RERANKERS_MODEL_TYPE| Type of reranker model being used. Eg. `flashrank`|
|
| RERANKERS_MODEL_TYPE| Type of reranker model being used. Eg. `flashrank`|
|
||||||
| FAST_LLM| LiteLLM routed Smaller, faster LLM for quick responses. Eg. `litellm:openai/gpt-4o`|
|
| FAST_LLM| LiteLLM routed Smaller, faster LLM for quick responses. Eg. `openai/gpt-4o-mini`, `ollama/deepseek-r1:8b`|
|
||||||
| STRATEGIC_LLM| LiteLLM routed Advanced LLM for complex reasoning tasks. Eg. `litellm:openai/gpt-4o`|
|
| STRATEGIC_LLM| LiteLLM routed Advanced LLM for complex reasoning tasks. Eg. `openai/gpt-4o`, `ollama/gemma3:12b`|
|
||||||
| LONG_CONTEXT_LLM| LiteLLM routed LLM capable of handling longer context windows. Eg. `litellm:gemini/gemini-2.0-flash`|
|
| LONG_CONTEXT_LLM| LiteLLM routed LLM capable of handling longer context windows. Eg. `gemini/gemini-2.0-flash`, `ollama/deepseek-r1:8b`|
|
||||||
| UNSTRUCTURED_API_KEY| API key for Unstructured.io service for document parsing|
|
| UNSTRUCTURED_API_KEY| API key for Unstructured.io service for document parsing|
|
||||||
| FIRECRAWL_API_KEY| API key for Firecrawl service for web crawling and data extraction|
|
| FIRECRAWL_API_KEY| API key for Firecrawl service for web crawling and data extraction|
|
||||||
|
|
||||||
IMPORTANT: Since LLM calls are routed through LiteLLM make sure to include API keys of LLM models you are using. For example if you used `litellm:openai/gpt-4o` make sure to include OpenAI API Key `OPENAI_API_KEY` or if you use `litellm:gemini/gemini-2.0-flash` then you include `GEMINI_API_KEY`.
|
IMPORTANT: Since LLM calls are routed through LiteLLM make sure to include API keys of LLM models you are using. For example if you used `openai/gpt-4o` make sure to include OpenAI API Key `OPENAI_API_KEY` or if you use `gemini/gemini-2.0-flash` then you include `GEMINI_API_KEY`.
|
||||||
|
|
||||||
You can also integrate any LLM just follow this https://docs.litellm.ai/docs/providers
|
You can also integrate any LLM just follow this https://docs.litellm.ai/docs/providers
|
||||||
|
|
||||||
|
|
|
@ -4,15 +4,18 @@ SECRET_KEY="SECRET"
|
||||||
GOOGLE_OAUTH_CLIENT_ID="924507538m"
|
GOOGLE_OAUTH_CLIENT_ID="924507538m"
|
||||||
GOOGLE_OAUTH_CLIENT_SECRET="GOCSV"
|
GOOGLE_OAUTH_CLIENT_SECRET="GOCSV"
|
||||||
NEXT_FRONTEND_URL="http://localhost:3000"
|
NEXT_FRONTEND_URL="http://localhost:3000"
|
||||||
|
|
||||||
EMBEDDING_MODEL="mixedbread-ai/mxbai-embed-large-v1"
|
EMBEDDING_MODEL="mixedbread-ai/mxbai-embed-large-v1"
|
||||||
|
|
||||||
RERANKERS_MODEL_NAME="ms-marco-MiniLM-L-12-v2"
|
RERANKERS_MODEL_NAME="ms-marco-MiniLM-L-12-v2"
|
||||||
RERANKERS_MODEL_TYPE="flashrank"
|
RERANKERS_MODEL_TYPE="flashrank"
|
||||||
|
|
||||||
FAST_LLM="litellm:openai/gpt-4o-mini"
|
# https://docs.litellm.ai/docs/providers
|
||||||
STRATEGIC_LLM="litellm:openai/gpt-4o"
|
FAST_LLM="openai/gpt-4o-mini"
|
||||||
LONG_CONTEXT_LLM="litellm:gemini/gemini-2.0-flash"
|
STRATEGIC_LLM="openai/gpt-4o"
|
||||||
|
LONG_CONTEXT_LLM="gemini/gemini-2.0-flash"
|
||||||
|
|
||||||
|
# Chosen LiteLLM Providers Keys
|
||||||
OPENAI_API_KEY="sk-proj-iA"
|
OPENAI_API_KEY="sk-proj-iA"
|
||||||
GEMINI_API_KEY="AIzaSyB6-1641124124124124124124124124124"
|
GEMINI_API_KEY="AIzaSyB6-1641124124124124124124124124124"
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,8 @@ async def rerank_documents(state: State, config: RunnableConfig) -> Dict[str, An
|
||||||
if reranker_service:
|
if reranker_service:
|
||||||
try:
|
try:
|
||||||
# Use the sub-section questions for reranking context
|
# Use the sub-section questions for reranking context
|
||||||
rerank_query = "\n".join(sub_section_questions)
|
# rerank_query = "\n".join(sub_section_questions)
|
||||||
|
rerank_query = configuration.user_query
|
||||||
|
|
||||||
# Convert documents to format expected by reranker if needed
|
# Convert documents to format expected by reranker if needed
|
||||||
reranker_input_docs = [
|
reranker_input_docs = [
|
||||||
|
|
|
@ -15,17 +15,6 @@ env_file = BASE_DIR / ".env"
|
||||||
load_dotenv(env_file)
|
load_dotenv(env_file)
|
||||||
|
|
||||||
|
|
||||||
def extract_model_name(llm_string: str) -> str:
|
|
||||||
"""Extract the model name from an LLM string.
|
|
||||||
Example: "litellm:openai/gpt-4o-mini" -> "openai/gpt-4o-mini"
|
|
||||||
|
|
||||||
Args:
|
|
||||||
llm_string: The LLM string with optional prefix
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: The extracted model name
|
|
||||||
"""
|
|
||||||
return llm_string.split(":", 1)[1] if ":" in llm_string else llm_string
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
# Database
|
# Database
|
||||||
|
@ -38,13 +27,13 @@ class Config:
|
||||||
|
|
||||||
# LONG-CONTEXT LLMS
|
# LONG-CONTEXT LLMS
|
||||||
LONG_CONTEXT_LLM = os.getenv("LONG_CONTEXT_LLM")
|
LONG_CONTEXT_LLM = os.getenv("LONG_CONTEXT_LLM")
|
||||||
long_context_llm_instance = ChatLiteLLM(model=extract_model_name(LONG_CONTEXT_LLM))
|
long_context_llm_instance = ChatLiteLLM(model=LONG_CONTEXT_LLM)
|
||||||
|
|
||||||
# GPT Researcher
|
# GPT Researcher
|
||||||
FAST_LLM = os.getenv("FAST_LLM")
|
FAST_LLM = os.getenv("FAST_LLM")
|
||||||
STRATEGIC_LLM = os.getenv("STRATEGIC_LLM")
|
STRATEGIC_LLM = os.getenv("STRATEGIC_LLM")
|
||||||
fast_llm_instance = ChatLiteLLM(model=extract_model_name(FAST_LLM))
|
fast_llm_instance = ChatLiteLLM(model=FAST_LLM)
|
||||||
strategic_llm_instance = ChatLiteLLM(model=extract_model_name(STRATEGIC_LLM))
|
strategic_llm_instance = ChatLiteLLM(model=STRATEGIC_LLM)
|
||||||
|
|
||||||
|
|
||||||
# Chonkie Configuration | Edit this to your needs
|
# Chonkie Configuration | Edit this to your needs
|
||||||
|
|
Loading…
Add table
Reference in a new issue