Skip to content

Commit

Permalink
Export Cohere relevance score as confidence score
Browse files Browse the repository at this point in the history
  • Loading branch information
doviettung96 committed May 31, 2024
1 parent dbe7c76 commit f2d537b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions libs/ktem/ktem/index/file/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from kotaemon.embeddings import BaseEmbeddings
from kotaemon.indices import VectorIndexing, VectorRetrieval
from kotaemon.indices.ingests.files import KH_DEFAULT_FILE_EXTRACTORS
from kotaemon.indices.rankings import BaseReranking, LLMReranking
from kotaemon.indices.rankings import BaseReranking, LLMReranking, CohereReranking
from kotaemon.indices.splitters import BaseSplitter, TokenSplitter

from .base import BaseFileIndexIndexing, BaseFileIndexRetriever
Expand Down Expand Up @@ -245,10 +245,11 @@ def get_pipeline(cls, user_settings, index_settings, selected):
)
],
retrieval_mode=user_settings["retrieval_mode"],
reranker=CohereReranking()
)
if not user_settings["use_reranking"]:
retriever.reranker = None # type: ignore
else:
elif isinstance(retriever.reranker, LLMReranking):
retriever.reranker.llm = llms.get(
user_settings["reranking_llm"], llms.get_default()
)
Expand Down
4 changes: 2 additions & 2 deletions libs/ktem/ktem/reasoning/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def prepare_citations(self, answer, docs) -> tuple[list[Document], list[Document
Document(
channel="info",
content=Render.collapsible(
header=id2docs[id].metadata["file_name"],
header=f'{id2docs[id].metadata["file_name"]}- Relevance score: {id2docs[id].metadata.get("relevance_score")}',
content=Render.table(text),
open=True,
),
Expand All @@ -612,7 +612,7 @@ def prepare_citations(self, answer, docs) -> tuple[list[Document], list[Document
Document(
channel="info",
content=Render.collapsible(
header=doc.metadata["file_name"],
header=f'{doc.metadata["file_name"]}- Relevance score: {doc.metadata.get("relevance_score")}',
content=Render.table(doc.text),
open=True,
),
Expand Down

0 comments on commit f2d537b

Please sign in to comment.