Skip to content

Commit

Permalink
added citation to streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
WSQsGithub committed Jan 13, 2025
1 parent e64bfb5 commit 7d3dc5e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/community/langchain_community/chat_models/perplexity.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,12 @@ def _stream(
chunk = chunk.dict()
if len(chunk["choices"]) == 0:
continue
citations = chunk.get("citations", [])
choice = chunk["choices"][0]
chunk = self._convert_delta_to_message_chunk(
choice["delta"], default_chunk_class
)
chunk.additional_kwargs["citations"] = citations
finish_reason = choice.get("finish_reason")
generation_info = (
dict(finish_reason=finish_reason) if finish_reason is not None else None
Expand Down

0 comments on commit 7d3dc5e

Please sign in to comment.