feat: extract think tags from reasoning models

This commit is contained in:
LUIS NOVO 2025-06-26 11:41:15 -03:00
parent 01dc2240a2
commit 7eee271232
4 changed files with 104 additions and 10 deletions

View file

@ -7,6 +7,7 @@ from typing_extensions import TypedDict
from open_notebook.domain.notebook import Source
from open_notebook.domain.transformation import DefaultPrompts, Transformation
from open_notebook.graphs.utils import provision_langchain_model
from open_notebook.utils import clean_thinking_content
class TransformationState(TypedDict):
@ -42,11 +43,15 @@ def run_transformation(state: dict, config: RunnableConfig) -> dict:
)
response = chain.invoke(payload)
# Clean thinking content from the response
cleaned_content = clean_thinking_content(response.content)
if source:
source.add_insight(transformation.title, response.content)
source.add_insight(transformation.title, cleaned_content)
return {
"output": response.content,
"output": cleaned_content,
}