Skip to content

Commit 7c1c8c0

Browse files
authored
Fix Amazon Nova support (use StrOutputParser) (#1202)
* use StrOutputParser in default chat * encourage using StrOutputParser in docs * pre-commit
1 parent 7cbc340 commit 7c1c8c0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/source/developers/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def create_llm_chain(
492492
prompt_template = FIX_PROMPT_TEMPLATE
493493
self.prompt_template = prompt_template
494494

495-
runnable = prompt_template | llm # type:ignore
495+
runnable = prompt_template | llm | StrOutputParser() # type:ignore
496496
self.llm_chain = runnable
497497
```
498498

packages/jupyter-ai/jupyter_ai/chat_handlers/default.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from jupyter_ai_magics.providers import BaseProvider
55
from jupyterlab_chat.models import Message
6+
from langchain_core.output_parsers import StrOutputParser
67
from langchain_core.runnables.history import RunnableWithMessageHistory
78

89
from ..context_providers import ContextProviderException, find_commands
@@ -36,7 +37,7 @@ def create_llm_chain(
3637
self.llm = llm
3738
self.prompt_template = prompt_template
3839

39-
runnable = prompt_template | llm # type:ignore
40+
runnable = prompt_template | llm | StrOutputParser() # type:ignore
4041
if not llm.manages_history:
4142
runnable = RunnableWithMessageHistory(
4243
runnable=runnable, # type:ignore[arg-type]

0 commit comments

Comments
 (0)