Skip to content

Commit

Permalink
Fix testing LLM
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed Nov 18, 2024
1 parent c603f55 commit df999b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backend/danswer/llm/chat_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,16 @@ def _convert_delta_to_message_chunk(
def _prompt_to_dict(
prompt: LanguageModelInput,
) -> Sequence[str | list[str] | dict[str, Any] | tuple[str, str]]:
# NOTE: this must go first, since it is also a Sequence
if isinstance(prompt, str):
return [_convert_message_to_dict(HumanMessage(content=prompt))]

if isinstance(prompt, (list, Sequence)):
return [
_convert_message_to_dict(msg) if isinstance(msg, BaseMessage) else msg
for msg in prompt
]

if isinstance(prompt, str):
return [_convert_message_to_dict(HumanMessage(content=prompt))]

if isinstance(prompt, PromptValue):
return [_convert_message_to_dict(message) for message in prompt.to_messages()]

Expand Down

0 comments on commit df999b5

Please sign in to comment.