mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-04-29 12:00:00 +00:00
feat: extract think tags from reasoning models
This commit is contained in:
parent
01dc2240a2
commit
7eee271232
4 changed files with 104 additions and 10 deletions
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue