mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-07-17 08:53:39 +00:00
Merge 7463efcbf7
into b7ee43788d
This commit is contained in:
commit
721e14c2c7
@ -104,6 +104,7 @@ class ChatService:
|
|||||||
embed_model=embedding_component.embedding_model,
|
embed_model=embedding_component.embedding_model,
|
||||||
show_progress=True,
|
show_progress=True,
|
||||||
)
|
)
|
||||||
|
self.default_context_template = settings.rag.default_context_template
|
||||||
|
|
||||||
def _chat_engine(
|
def _chat_engine(
|
||||||
self,
|
self,
|
||||||
@ -113,6 +114,10 @@ class ChatService:
|
|||||||
) -> BaseChatEngine:
|
) -> BaseChatEngine:
|
||||||
settings = self.settings
|
settings = self.settings
|
||||||
if use_context:
|
if use_context:
|
||||||
|
if self.default_context_template is not None:
|
||||||
|
context_template = self.default_context_template
|
||||||
|
else:
|
||||||
|
context_template = None
|
||||||
vector_index_retriever = self.vector_store_component.get_retriever(
|
vector_index_retriever = self.vector_store_component.get_retriever(
|
||||||
index=self.index,
|
index=self.index,
|
||||||
context_filter=context_filter,
|
context_filter=context_filter,
|
||||||
@ -139,6 +144,7 @@ class ChatService:
|
|||||||
retriever=vector_index_retriever,
|
retriever=vector_index_retriever,
|
||||||
llm=self.llm_component.llm, # Takes no effect at the moment
|
llm=self.llm_component.llm, # Takes no effect at the moment
|
||||||
node_postprocessors=node_postprocessors,
|
node_postprocessors=node_postprocessors,
|
||||||
|
context_template=context_template,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return SimpleChatEngine.from_defaults(
|
return SimpleChatEngine.from_defaults(
|
||||||
|
@ -396,6 +396,13 @@ class RerankSettings(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class RagSettings(BaseModel):
|
class RagSettings(BaseModel):
|
||||||
|
default_context_template: str | None = Field(
|
||||||
|
None,
|
||||||
|
description=(
|
||||||
|
"The default context template to use for the chat engine when using RAG. "
|
||||||
|
"If none is given - use the default system prompt (from the llama_index). "
|
||||||
|
),
|
||||||
|
)
|
||||||
similarity_top_k: int = Field(
|
similarity_top_k: int = Field(
|
||||||
2,
|
2,
|
||||||
description="This value controls the number of documents returned by the RAG pipeline or considered for reranking if enabled.",
|
description="This value controls the number of documents returned by the RAG pipeline or considered for reranking if enabled.",
|
||||||
|
@ -57,6 +57,11 @@ llm:
|
|||||||
temperature: 0.1 # The temperature of the model. Increasing the temperature will make the model answer more creatively. A value of 0.1 would be more factual. (Default: 0.1)
|
temperature: 0.1 # The temperature of the model. Increasing the temperature will make the model answer more creatively. A value of 0.1 would be more factual. (Default: 0.1)
|
||||||
|
|
||||||
rag:
|
rag:
|
||||||
|
default_context_template: |
|
||||||
|
Context information is below.
|
||||||
|
--------------------
|
||||||
|
{context_str}
|
||||||
|
--------------------
|
||||||
similarity_top_k: 2
|
similarity_top_k: 2
|
||||||
#This value controls how many "top" documents the RAG returns to use in the context.
|
#This value controls how many "top" documents the RAG returns to use in the context.
|
||||||
#similarity_value: 0.45
|
#similarity_value: 0.45
|
||||||
@ -70,11 +75,11 @@ summarize:
|
|||||||
use_async: true
|
use_async: true
|
||||||
|
|
||||||
clickhouse:
|
clickhouse:
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 8443
|
port: 8443
|
||||||
username: admin
|
username: admin
|
||||||
password: clickhouse
|
password: clickhouse
|
||||||
database: embeddings
|
database: embeddings
|
||||||
|
|
||||||
llamacpp:
|
llamacpp:
|
||||||
llm_hf_repo_id: lmstudio-community/Meta-Llama-3.1-8B-Instruct-GGUF
|
llm_hf_repo_id: lmstudio-community/Meta-Llama-3.1-8B-Instruct-GGUF
|
||||||
@ -150,3 +155,4 @@ gemini:
|
|||||||
api_key: ${GOOGLE_API_KEY:}
|
api_key: ${GOOGLE_API_KEY:}
|
||||||
model: models/gemini-pro
|
model: models/gemini-pro
|
||||||
embedding_model: models/embedding-001
|
embedding_model: models/embedding-001
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user