File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
packages/jupyter-ai/jupyter_ai/chat_handlers Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -492,7 +492,7 @@ def create_llm_chain(
492
492
prompt_template = FIX_PROMPT_TEMPLATE
493
493
self .prompt_template = prompt_template
494
494
495
- runnable = prompt_template | llm # type: ignore
495
+ runnable = prompt_template | llm | StrOutputParser() # type: ignore
496
496
self .llm_chain = runnable
497
497
```
498
498
Original file line number Diff line number Diff line change 3
3
4
4
from jupyter_ai .models import HumanChatMessage
5
5
from jupyter_ai_magics .providers import BaseProvider
6
+ from langchain_core .output_parsers import StrOutputParser
6
7
from langchain_core .runnables import ConfigurableFieldSpec
7
8
from langchain_core .runnables .history import RunnableWithMessageHistory
8
9
@@ -37,7 +38,7 @@ def create_llm_chain(
37
38
self .llm = llm
38
39
self .prompt_template = prompt_template
39
40
40
- runnable = prompt_template | llm # type:ignore
41
+ runnable = prompt_template | llm | StrOutputParser () # type:ignore
41
42
if not llm .manages_history :
42
43
runnable = RunnableWithMessageHistory (
43
44
runnable = runnable , # type:ignore[arg-type]
Original file line number Diff line number Diff line change 3
3
from jupyter_ai .models import CellWithErrorSelection , HumanChatMessage
4
4
from jupyter_ai_magics .providers import BaseProvider
5
5
from langchain .prompts import PromptTemplate
6
+ from langchain_core .output_parsers import StrOutputParser
6
7
7
8
from .base import BaseChatHandler , SlashCommandRoutingType
8
9
@@ -76,7 +77,7 @@ def create_llm_chain(
76
77
self .llm = llm
77
78
prompt_template = FIX_PROMPT_TEMPLATE
78
79
79
- runnable = prompt_template | llm # type:ignore
80
+ runnable = prompt_template | llm | StrOutputParser () # type:ignore
80
81
self .llm_chain = runnable
81
82
82
83
async def process_message (self , message : HumanChatMessage ):
You can’t perform that action at this time.
0 commit comments