mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-09-23 20:17:24 +00:00
feat: Context Template from settings for QueryDocs Allowing the text values context_template - PR comments
This commit is contained in:
@@ -21,8 +21,6 @@ from private_gpt.open_ai.extensions.context_filter import ContextFilter
|
||||
from private_gpt.server.chunks.chunks_service import Chunk
|
||||
from private_gpt.settings.settings import settings
|
||||
|
||||
DEFAULT_CONTEXT_TEMPLATE = settings().rag.default_context_template
|
||||
|
||||
|
||||
class Completion(BaseModel):
|
||||
response: str
|
||||
@@ -100,9 +98,11 @@ class ChatService:
|
||||
system_prompt: str | None = None,
|
||||
use_context: bool = False,
|
||||
context_filter: ContextFilter | None = None,
|
||||
context_template: str | None = DEFAULT_CONTEXT_TEMPLATE,
|
||||
context_template: str | None = None,
|
||||
) -> BaseChatEngine:
|
||||
if use_context:
|
||||
if context_template is None:
|
||||
context_template = settings().rag.default_context_template
|
||||
vector_index_retriever = self.vector_store_component.get_retriever(
|
||||
index=self.index, context_filter=context_filter
|
||||
)
|
||||
|
@@ -61,4 +61,8 @@ openai:
|
||||
model: gpt-3.5-turbo
|
||||
|
||||
rag:
|
||||
default_context_template: "Context information is below.\n--------------------\n{context_str}\n--------------------\n"
|
||||
default_context_template: |
|
||||
Context information is below.
|
||||
--------------------
|
||||
{context_str}
|
||||
--------------------
|
||||
|
Reference in New Issue
Block a user