Tune parameters
This commit is contained in:
parent
4908ea9fcc
commit
dfe23482da
4 changed files with 4 additions and 5 deletions
|
|
@ -278,7 +278,7 @@ class HaikuRAG:
|
||||||
return await self.document_repository.list_all(limit=limit, offset=offset)
|
return await self.document_repository.list_all(limit=limit, offset=offset)
|
||||||
|
|
||||||
async def search(
|
async def search(
|
||||||
self, query: str, limit: int = 3, k: int = 60, rerank=Config.RERANK
|
self, query: str, limit: int = 5, k: int = 60, rerank=Config.RERANK
|
||||||
) -> list[tuple[Chunk, float]]:
|
) -> list[tuple[Chunk, float]]:
|
||||||
"""Search for relevant chunks using hybrid search (vector similarity + full-text search) with reranking.
|
"""Search for relevant chunks using hybrid search (vector similarity + full-text search) with reranking.
|
||||||
|
|
||||||
|
|
@ -298,7 +298,6 @@ class HaikuRAG:
|
||||||
search_results = await self.chunk_repository.search_chunks_hybrid(
|
search_results = await self.chunk_repository.search_chunks_hybrid(
|
||||||
query, limit * 3, k
|
query, limit * 3, k
|
||||||
)
|
)
|
||||||
|
|
||||||
# Apply reranking
|
# Apply reranking
|
||||||
reranker = get_reranker()
|
reranker = get_reranker()
|
||||||
chunks = [chunk for chunk, _ in search_results]
|
chunks = [chunk for chunk, _ in search_results]
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from haiku.rag.client import HaikuRAG
|
||||||
from haiku.rag.config import Config
|
from haiku.rag.config import Config
|
||||||
from haiku.rag.qa.base import QuestionAnswerAgentBase
|
from haiku.rag.qa.base import QuestionAnswerAgentBase
|
||||||
|
|
||||||
OLLAMA_OPTIONS = {"temperature": 0.0, "seed": 42, "num_ctx": 64000}
|
OLLAMA_OPTIONS = {"temperature": 0.0, "seed": 42, "num_ctx": 16384}
|
||||||
|
|
||||||
|
|
||||||
class QuestionAnswerOllamaAgent(QuestionAnswerAgentBase):
|
class QuestionAnswerOllamaAgent(QuestionAnswerAgentBase):
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ Guidelines:
|
||||||
- Indicate when information is incomplete or when you need to search for additional context
|
- Indicate when information is incomplete or when you need to search for additional context
|
||||||
- If the retrieved documents don't contain sufficient information, clearly state: "I cannot find enough information in the knowledge base to answer this question."
|
- If the retrieved documents don't contain sufficient information, clearly state: "I cannot find enough information in the knowledge base to answer this question."
|
||||||
- For complex questions, consider breaking them down and performing multiple searches
|
- For complex questions, consider breaking them down and performing multiple searches
|
||||||
- Stick to the answer, do not ellaborate or provde context unless asked for it.
|
- Stick to the answer, do not ellaborate or provide context unless explicitly asked for it.
|
||||||
|
|
||||||
Be concise, and always maintain accuracy over completeness. Prefer short, direct answers that are well-supported by the documents.
|
Be concise, and always maintain accuracy over completeness. Prefer short, direct answers that are well-supported by the documents.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ class LLMJudgeResponseSchema(BaseModel):
|
||||||
class LLMJudge:
|
class LLMJudge:
|
||||||
"""LLM-as-judge for evaluating answer equivalence using Ollama."""
|
"""LLM-as-judge for evaluating answer equivalence using Ollama."""
|
||||||
|
|
||||||
def __init__(self, model: str = "qwen3"):
|
def __init__(self, model: str = Config.QA_MODEL):
|
||||||
self.model = model
|
self.model = model
|
||||||
self.client = AsyncClient(host=Config.OLLAMA_BASE_URL)
|
self.client = AsyncClient(host=Config.OLLAMA_BASE_URL)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue