langchain icon indicating copy to clipboard operation
langchain copied to clipboard

feat(chat_perplexity): capture full API response metadata

Open mathieuripert opened this issue 5 months ago • 2 comments
trafficstars

Capture Full Perplexity API Response Metadata

It enhances ChatPerplexity to capture the complete API response from Perplexity, not just the message content. The main benefit is to get the citations and search results.

  • Full API response metadata is now available in Message.processed_content
  • Access to citations, search results, token usage, and response identifiers

mathieuripert avatar Jun 16 '25 15:06 mathieuripert

Hi @mathieuripert! Using processed_content as a place to store the additional information is an interesting approach!

One of the things I'm working on currently is support for NativeTools. This means web_search tools, which are also returning citations or annotations. The challenge is the variety of ways services return this data. But I'm looking for something more fully supported in ContentParts. I don't have it done yet, but I'll think more about it.

Thanks!

brainlid avatar Jun 20 '25 16:06 brainlid

Hi @brainlid, In the meantime, do you think we can merge this change ? This would allow the perplexity sources to be available in the response message. I think this is a simple workaround. Thanks

mathieuripert avatar Aug 23 '25 09:08 mathieuripert