Description
Checked other resources
- I added a very descriptive title to this issue.
- I searched the LangChain documentation with the integrated search.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
from langchain_community.chat_models import ChatPerplexity
from dotenv import load_dotenv
load_dotenv()
chat_perplexity = ChatPerplexity(model="sonar-pro", temperature=0.8)
response = chat_perplexity.invoke("Tell me about Michael Jordan.", extra_body={"return_related_questions": True, "return_images": True})
print(response)
Error Message and Stack Trace (if applicable)
Not error message, but the following response is returned, with no related questions or images appended to the response:
content='Michael Jeffrey Jordan, born on February 17, 1963, is widely regarded as one of the greatest basketball players of all time[1][2]. Known by his initials MJ and nicknames "Air Jordan" and "His Airness," Jordan\'s extraordinary career in the National Basketball Association (NBA) spanned 15 seasons, primarily with the Chicago Bulls[1].\n\nJordan\'s basketball journey began at the University of North Carolina, where he won the NCAA championship in 1982 as a freshman[1]. He was drafted third overall by the Chicago Bulls in 1984 and quickly emerged as a league star[1][2].\n\nDuring his NBA career, Jordan achieved numerous accolades:\n\n- Six NBA championships with the Chicago Bulls (1991-93, 1996-98)[1][2]\n- Five NBA Most Valuable Player (MVP) awards[2]\n- Ten scoring titles[2]\n- Two Olympic gold medals (1984 and 1992)[2]\n- Defensive Player of the Year in 1988[2]\n\nJordan\'s scoring prowess was legendary, averaging 30.1 points per game over his career[3]. He was known for his clutch performances, fierce competitiveness, and unparalleled work ethic[1].\n\nOff the court, Jordan became a global cultural icon and successful businessman. He has a long-standing partnership with Nike, creating the iconic Air Jordan brand[5]. After retiring, he became an owner of the Charlotte Hornets NBA team[2].\n\nJordan\'s impact on basketball and popular culture is immeasurable. He helped popularize the NBA globally in the 1980s and 1990s[1] and continues to inspire athletes and fans worldwide.' additional_kwargs={'citations': ['https://en.wikipedia.org/wiki/Michael_Jordan', 'https://www.britannica.com/biography/Michael-Jordan', 'https://www.biography.com/athletes/michael-jordan', 'https://wonderopolis.org/wonder/Who-Is-Michael-Jordan', 'https://basketballmuseumofillinois.com/15-fun-facts-about-his-airness-basketball-legend-michael-jordan/', 'https://projects.theplayerstribune.com/legend-of-michael-jordan', 'https://www.espn.com/nba/player/bio/_/id/1035/michael-jordan', 'https://www.youtube.com/watch?v=EFkI9Pn-ELI', 'https://www.youtube.com/watch?v=mmi1O1zKocE']} response_metadata={} id='run-de922f0d-2925-443a-be24-357c73e5d851-0' usage_metadata={'input_tokens': 6, 'output_tokens': 345, 'total_tokens': 351}
Description
I am trying to use the return_related_questions
and return_images
parameters in the extra_body
parameter of the invoke
method of the ChatPerplexity
class, but the response does not include related questions or images. The response only includes the main content about Michael Jordan. That is because the return_related_questions
and return_images
parameters are not appended to the response body.
message = AIMessage(
content=response.choices[0].message.content,
additional_kwargs={"citations": response.citations},
usage_metadata=usage_metadata,
)
System Info
System Information
OS: Windows
OS Version: 10.0.26100
Python Version: 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
Package Information
langchain_core: 0.3.41
langchain: 0.3.20
langchain_community: 0.3.19
langsmith: 0.3.1
langchain_openai: 0.3.2
langchain_text_splitters: 0.3.6
Optional packages not installed
langserve
Other Dependencies
aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
dataclasses-json<0.7,>=0.5.7: Installed. No version info available.
httpx: 0.28.1
httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
jsonpatch<2.0,>=1.33: Installed. No version info available.
langchain-anthropic;: Installed. No version info available.
langchain-aws;: Installed. No version info available.
langchain-cohere;: Installed. No version info available.
langchain-community;: Installed. No version info available.
langchain-core<1.0.0,>=0.3.34: Installed. No version info available.
langchain-core<1.0.0,>=0.3.41: Installed. No version info available.
langchain-deepseek;: Installed. No version info available.
langchain-fireworks;: Installed. No version info available.
langchain-google-genai;: Installed. No version info available.
langchain-google-vertexai;: Installed. No version info available.
langchain-groq;: Installed. No version info available.
langchain-huggingface;: Installed. No version info available.
langchain-mistralai;: Installed. No version info available.
langchain-ollama;: Installed. No version info available.
langchain-openai;: Installed. No version info available.
langchain-text-splitters<1.0.0,>=0.3.6: Installed. No version info available.
langchain-together;: Installed. No version info available.
langchain-xai;: Installed. No version info available.
langchain<1.0.0,>=0.3.20: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
langsmith<0.4,>=0.1.17: Installed. No version info available.
numpy<3,>=1.26.2: Installed. No version info available.
openai: 1.60.0
orjson: 3.10.15
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.10.6
pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.
pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
pydantic<3.0.0,>=2.7.4: Installed. No version info available.
pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
pytest: 8.3.4
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.3
requests-toolbelt: 1.0.0
requests<3,>=2: Installed. No version info available.
rich: 13.9.4
SQLAlchemy<3,>=1.4: Installed. No version info available.
tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken: 0.8.0
typing-extensions>=4.7: Installed. No version info available.
zstandard: 0.23.0