Skip to content

Commit 54d497e

Browse files
committed
Revert "feat: add support for reasoning llm with thought visualization (Cinnamon#652) bump:patch"
This reverts commit 0b09089.
1 parent d912d73 commit 54d497e

File tree

5 files changed

+9
-53
lines changed

5 files changed

+9
-53
lines changed

libs/kotaemon/kotaemon/indices/qa/utils.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,3 @@ def find_start_end_phrase(
8080
final_match = None
8181

8282
return final_match, matched_length
83-
84-
85-
def replace_think_tag_with_details(text):
86-
text = text.replace(
87-
"<think>",
88-
'<details><summary><span style="color:grey">Thought</span></summary><blockquote>', # noqa
89-
)
90-
text = text.replace("</think>", "</blockquote></details>")
91-
return text
92-
93-
94-
def strip_think_tag(text):
95-
if "</think>" in text:
96-
text = text.split("</think>")[1]
97-
return text

libs/kotaemon/kotaemon/storages/docstores/lancedb.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ def get(self, ids: Union[List[str], str]) -> List[Document]:
9898
if not isinstance(ids, list):
9999
ids = [ids]
100100

101-
if len(ids) == 0:
102-
return []
103-
104101
id_filter = ", ".join([f"'{_id}'" for _id in ids])
105102
try:
106103
document_collection = self.db_connection.open_table(self.collection_name)

libs/ktem/ktem/index/file/pipelines.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from typing import Generator, Optional, Sequence
1515

1616
import tiktoken
17-
from decouple import config
1817
from ktem.db.models import engine
1918
from ktem.embeddings.manager import embedding_models_manager
2019
from ktem.llms.manager import llms
@@ -271,7 +270,7 @@ def get_user_settings(cls) -> dict:
271270
},
272271
"use_llm_reranking": {
273272
"name": "Use LLM relevant scoring",
274-
"value": not config("USE_LOW_LLM_REQUESTS", default=False, cast=bool),
273+
"value": True,
275274
"choices": [True, False],
276275
"component": "checkbox",
277276
},

libs/ktem/ktem/pages/chat/__init__.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from typing import Optional
66

77
import gradio as gr
8-
from decouple import config
98
from ktem.app import BasePage
109
from ktem.components import reasonings
1110
from ktem.db.models import Conversation, engine
@@ -24,7 +23,6 @@
2423

2524
from kotaemon.base import Document
2625
from kotaemon.indices.ingests.files import KH_DEFAULT_FILE_EXTRACTORS
27-
from kotaemon.indices.qa.utils import strip_think_tag
2826

2927
from ...utils import SUPPORTED_LANGUAGE_MAP, get_file_names_regex, get_urls
3028
from ...utils.commands import WEB_SEARCH_COMMAND
@@ -369,22 +367,13 @@ def on_building_ui(self):
369367
elem_id="citation-dropdown",
370368
)
371369

372-
if not config("USE_LOW_LLM_REQUESTS", default=False, cast=bool):
373-
self.use_mindmap = gr.State(value=True)
374-
self.use_mindmap_check = gr.Checkbox(
375-
label="Mindmap (on)",
376-
container=False,
377-
elem_id="use-mindmap-checkbox",
378-
value=True,
379-
)
380-
else:
381-
self.use_mindmap = gr.State(value=False)
382-
self.use_mindmap_check = gr.Checkbox(
383-
label="Mindmap (off)",
384-
container=False,
385-
elem_id="use-mindmap-checkbox",
386-
value=False,
387-
)
370+
self.use_mindmap = gr.State(value=True)
371+
self.use_mindmap_check = gr.Checkbox(
372+
label="Mindmap (on)",
373+
container=False,
374+
elem_id="use-mindmap-checkbox",
375+
value=True,
376+
)
388377

389378
with gr.Column(
390379
scale=INFO_PANEL_SCALES[False], elem_id="chat-info-panel"
@@ -1372,7 +1361,6 @@ def check_and_suggest_name_conv(self, chat_history):
13721361
# check if this is a newly created conversation
13731362
if len(chat_history) == 1:
13741363
suggested_name = suggest_pipeline(chat_history).text
1375-
suggested_name = strip_think_tag(suggested_name)
13761364
suggested_name = suggested_name.replace('"', "").replace("'", "")[:40]
13771365
new_name = gr.update(value=suggested_name)
13781366
renamed = True

libs/ktem/ktem/reasoning/simple.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from textwrap import dedent
44
from typing import Generator
55

6-
from decouple import config
76
from ktem.embeddings.manager import embedding_models_manager as embeddings
87
from ktem.llms.manager import llms
98
from ktem.reasoning.prompt_optimization import (
@@ -30,7 +29,6 @@
3029
)
3130
from kotaemon.indices.qa.citation_qa_inline import AnswerWithInlineCitation
3231
from kotaemon.indices.qa.format_context import PrepareEvidencePipeline
33-
from kotaemon.indices.qa.utils import replace_think_tag_with_details
3432
from kotaemon.llms import ChatLLM
3533

3634
from ..utils import SUPPORTED_LANGUAGE_MAP
@@ -315,13 +313,6 @@ def generate_relevant_scores():
315313
**kwargs,
316314
)
317315

318-
# check <think> tag from reasoning models
319-
processed_answer = replace_think_tag_with_details(answer.text)
320-
if processed_answer != answer.text:
321-
# clear the chat message and render again
322-
yield Document(channel="chat", content=None)
323-
yield Document(channel="chat", content=processed_answer)
324-
325316
# show the evidence
326317
if scoring_thread:
327318
scoring_thread.join()
@@ -419,11 +410,7 @@ def get_user_settings(cls) -> dict:
419410
},
420411
"highlight_citation": {
421412
"name": "Citation style",
422-
"value": (
423-
"inline"
424-
if not config("USE_LOW_LLM_REQUESTS", default=False, cast=bool)
425-
else "off"
426-
),
413+
"value": "inline",
427414
"component": "radio",
428415
"choices": [
429416
("citation: highlight", "highlight"),

0 commit comments

Comments
 (0)