langchain/libs/community/tests/unit_tests
David Sánchez Sánchez 75823d580b
community: fix perplexity response parameters not being included in model response (#30440)
This pull request includes enhancements to the `perplexity.py` file in
the `chat_models` module, focusing on improving the handling of
additional keyword arguments (`additional_kwargs`) in message processing
methods. Additionally, new unit tests have been added to ensure the
correct inclusion of citations, images, and related questions in the
`additional_kwargs`.

Issue: resolves https://github.com/langchain-ai/langchain/issues/30439

Enhancements to `perplexity.py`:

*
[`libs/community/langchain_community/chat_models/perplexity.py`](diffhunk://#diff-d3e4d7b277608683913b53dcfdbd006f0f4a94d110d8b9ac7acf855f1f22207fL208-L212):
Modified the `_convert_delta_to_message_chunk`, `_stream`, and
`_generate` methods to handle `additional_kwargs`, which include
citations, images, and related questions.
[[1]](diffhunk://#diff-d3e4d7b277608683913b53dcfdbd006f0f4a94d110d8b9ac7acf855f1f22207fL208-L212)
[[2]](diffhunk://#diff-d3e4d7b277608683913b53dcfdbd006f0f4a94d110d8b9ac7acf855f1f22207fL277-L286)
[[3]](diffhunk://#diff-d3e4d7b277608683913b53dcfdbd006f0f4a94d110d8b9ac7acf855f1f22207fR324-R331)

New unit tests:

*
[`libs/community/tests/unit_tests/chat_models/test_perplexity.py`](diffhunk://#diff-dab956d79bd7d17a0f5dea3f38ceab0d583b43b63eb1b29138ee9b6b271ba1d9R119-R275):
Added new tests `test_perplexity_stream_includes_citations_and_images`
and `test_perplexity_stream_includes_citations_and_related_questions` to
verify that the `stream` method correctly includes citations, images,
and related questions in the `additional_kwargs`.
2025-03-26 22:28:08 -04:00
..
agent_toolkits community: adds support for getting github releases for the configured repository (#29318) 2025-01-22 15:45:52 +00:00
agents community: add truncation params when an openai assistant's run is created (#28158) 2024-11-27 10:53:53 -05:00
callbacks Community : Add OpenAI prompt caching and reasoning tokens tracking (#27135) 2024-12-19 09:31:13 -05:00
chains core: add kwargs support to VectorStore (#25934) 2024-12-16 18:57:57 +00:00
chat_loaders community: Bump ruff version to 0.9 (#29206) 2025-02-08 01:21:10 +00:00
chat_message_histories community: Bump ruff version to 0.9 (#29206) 2025-02-08 01:21:10 +00:00
chat_models community: fix perplexity response parameters not being included in model response (#30440) 2025-03-26 22:28:08 -04:00
cross_encoders
data
docstore
document_compressors community: add InfinityRerank (#27043) 2024-11-06 17:26:30 -08:00
document_loaders community: Azure Document Intelligence parser features not available fixed (#30370) 2025-03-26 14:40:14 -04:00
document_transformers community: Bump ruff version to 0.9 (#29206) 2025-02-08 01:21:10 +00:00
embeddings community: Repair embeddings/llamacpp's embed_query method (#29935) 2025-02-23 19:32:17 +00:00
evaluation
examples
graph_vectorstores [community]: Render documents to graphviz (#24830) 2024-12-14 02:02:09 +00:00
graphs community: fix issue #29429 in age_graph.py (#29506) 2025-02-01 21:24:45 -05:00
imports
indexes
jira community: fix Jira API wrapper failing initialization with cloud param (#30117) 2025-03-05 10:49:25 -05:00
llms infra: migrate to uv (#29566) 2025-02-06 13:36:26 -05:00
load core: add sambanova chat models to load module mapping (#29855) 2025-02-20 12:30:50 -05:00
query_constructors community: Bump ruff version to 0.9 (#29206) 2025-02-08 01:21:10 +00:00
retrievers community: add top_k as param to Needle Retriever (#29821) 2025-02-16 08:30:52 -05:00
storage community: Bump ruff version to 0.9 (#29206) 2025-02-08 01:21:10 +00:00
tools (Community): Added API Key for Jina Search API Wrapper (#29622) 2025-02-12 20:12:07 -08:00
utilities Community: Google Books API Tool (#27307) 2024-11-07 15:29:35 -08:00
utils
vectorstores community: Bump ruff version to 0.9 (#29206) 2025-02-08 01:21:10 +00:00
__init__.py
conftest.py community: Use Blockbuster to detect blocking calls in asyncio during tests (#29609) 2025-02-08 01:10:39 +00:00
test_cache.py community: Use Blockbuster to detect blocking calls in asyncio during tests (#29609) 2025-02-08 01:10:39 +00:00
test_dependencies.py community: Use Blockbuster to detect blocking calls in asyncio during tests (#29609) 2025-02-08 01:10:39 +00:00
test_document_transformers.py
test_graph_vectorstores.py
test_imports.py community: Bump ruff version to 0.9 (#29206) 2025-02-08 01:21:10 +00:00
test_sql_database_schema.py
test_sql_database.py
test_sqlalchemy.py