mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-06 21:19:54 +02:00
Ensure relevance functions for selected docs (#2063)
* ensure relevance functions for selected docs * remove logs * remove log
This commit is contained in:
parent
57aec7d02a
commit
e0f0cfd92e
@ -10,6 +10,7 @@ from danswer.chat.chat_utils import llm_doc_from_inference_section
|
|||||||
from danswer.chat.models import DanswerContext
|
from danswer.chat.models import DanswerContext
|
||||||
from danswer.chat.models import DanswerContexts
|
from danswer.chat.models import DanswerContexts
|
||||||
from danswer.chat.models import LlmDoc
|
from danswer.chat.models import LlmDoc
|
||||||
|
from danswer.chat.models import SectionRelevancePiece
|
||||||
from danswer.db.models import Persona
|
from danswer.db.models import Persona
|
||||||
from danswer.db.models import User
|
from danswer.db.models import User
|
||||||
from danswer.dynamic_configs.interface import JSON_ro
|
from danswer.dynamic_configs.interface import JSON_ro
|
||||||
@ -193,9 +194,20 @@ class SearchTool(Tool):
|
|||||||
recency_bias_multiplier=1.0,
|
recency_bias_multiplier=1.0,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Build selected sections for specified documents
|
||||||
|
selected_sections = [
|
||||||
|
SectionRelevancePiece(
|
||||||
|
relevant=True,
|
||||||
|
document_id=section.center_chunk.document_id,
|
||||||
|
chunk_id=section.center_chunk.chunk_id,
|
||||||
|
)
|
||||||
|
for section in self.selected_sections
|
||||||
|
]
|
||||||
|
|
||||||
yield ToolResponse(
|
yield ToolResponse(
|
||||||
id=SECTION_RELEVANCE_LIST_ID,
|
id=SECTION_RELEVANCE_LIST_ID,
|
||||||
response=[i for i in range(len(self.selected_sections))],
|
response=selected_sections,
|
||||||
)
|
)
|
||||||
|
|
||||||
final_context_sections = prune_and_merge_sections(
|
final_context_sections = prune_and_merge_sections(
|
||||||
|
@ -1531,18 +1531,18 @@ export function ChatPage({
|
|||||||
!isFetchingChatMessages && (
|
!isFetchingChatMessages && (
|
||||||
<div
|
<div
|
||||||
className={`
|
className={`
|
||||||
mx-auto
|
mx-auto
|
||||||
px-4
|
px-4
|
||||||
w-searchbar-xs
|
w-searchbar-xs
|
||||||
2xl:w-searchbar-sm
|
2xl:w-searchbar-sm
|
||||||
3xl:w-searchbar
|
3xl:w-searchbar
|
||||||
grid
|
grid
|
||||||
gap-4
|
gap-4
|
||||||
grid-cols-1
|
grid-cols-1
|
||||||
grid-rows-1
|
grid-rows-1
|
||||||
mt-4
|
mt-4
|
||||||
md:grid-cols-2
|
md:grid-cols-2
|
||||||
mb-6`}
|
mb-6`}
|
||||||
>
|
>
|
||||||
{currentPersona.starter_messages.map(
|
{currentPersona.starter_messages.map(
|
||||||
(starterMessage, i) => (
|
(starterMessage, i) => (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user