mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-28 01:19:31 +00:00
docs: replace deprecated llama 3 model with sonar in ChatPerplexity example (#31716)
**Description:** Updates ChatPerplexity documentation to replace deprecated llama 3 model reference with the current sonar model in the API key example code block. **Issue:** N/A (maintenance update for deprecated model) **Dependencies:** No new dependencies required --------- Co-authored-by: Mason Daugherty <github@mdrxy.com>
This commit is contained in:
parent
8878a7b143
commit
cc4f5269b1
@ -106,9 +106,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"chat = ChatPerplexity(\n",
|
"chat = ChatPerplexity(temperature=0, pplx_api_key=\"YOUR_API_KEY\", model=\"sonar\")"
|
||||||
" temperature=0, pplx_api_key=\"YOUR_API_KEY\", model=\"llama-3-sonar-small-32k-online\"\n",
|
|
||||||
")"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -132,7 +130,7 @@
|
|||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"chat = ChatPerplexity(temperature=0, model=\"llama-3.1-sonar-small-128k-online\")"
|
"chat = ChatPerplexity(temperature=0, model=\"sonar\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -200,7 +198,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"chat = ChatPerplexity(temperature=0, model=\"llama-3.1-sonar-small-128k-online\")\n",
|
"chat = ChatPerplexity(temperature=0, model=\"sonar\")\n",
|
||||||
"prompt = ChatPromptTemplate.from_messages([(\"human\", \"Tell me a joke about {topic}\")])\n",
|
"prompt = ChatPromptTemplate.from_messages([(\"human\", \"Tell me a joke about {topic}\")])\n",
|
||||||
"chain = prompt | chat\n",
|
"chain = prompt | chat\n",
|
||||||
"response = chain.invoke({\"topic\": \"cats\"})\n",
|
"response = chain.invoke({\"topic\": \"cats\"})\n",
|
||||||
@ -235,7 +233,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"chat = ChatPerplexity(temperature=0.7, model=\"llama-3.1-sonar-small-128k-online\")\n",
|
"chat = ChatPerplexity(temperature=0.7, model=\"sonar\")\n",
|
||||||
"response = chat.invoke(\n",
|
"response = chat.invoke(\n",
|
||||||
" \"Tell me a joke about cats\", extra_body={\"search_recency_filter\": \"week\"}\n",
|
" \"Tell me a joke about cats\", extra_body={\"search_recency_filter\": \"week\"}\n",
|
||||||
")\n",
|
")\n",
|
||||||
@ -284,7 +282,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"chat = ChatPerplexity(temperature=0.7, model=\"llama-3.1-sonar-small-128k-online\")\n",
|
"chat = ChatPerplexity(temperature=0.7, model=\"sonar\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"for chunk in chat.stream(\"Give me a list of famous tourist attractions in Pakistan\"):\n",
|
"for chunk in chat.stream(\"Give me a list of famous tourist attractions in Pakistan\"):\n",
|
||||||
" print(chunk.content, end=\"\", flush=True)"
|
" print(chunk.content, end=\"\", flush=True)"
|
||||||
|
Loading…
Reference in New Issue
Block a user