Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions chat_with_pdf/flows/standard/chat_with_pdf/utils/oai.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def stream(self, messages: list, **kwargs):
**kwargs,
)

if not response.choices or response.choices[0].message is None:
raise ValueError("LLM returned empty or filtered response")
return response.choices[0].message.content


Expand Down
2 changes: 2 additions & 0 deletions function_flows/flows/basic/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def my_llm_tool(
)

# get first element because prompt is single.
if not response.choices or response.choices[0].message is None:
raise ValueError("LLM returned empty or filtered response")
return response.choices[0].message.content


Expand Down