mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-08 04:25:46 +00:00
docs: Fix some issues with sparkllm use cases (#17674)
This commit is contained in:
parent
5985454269
commit
32db9e74e4
@ -14,6 +14,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
|
"id": "b895d98989d4de01",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## Basic use"
|
"## Basic use"
|
||||||
@ -21,13 +22,25 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 10,
|
||||||
"id": "43daa39972d4c533",
|
"id": "43daa39972d4c533",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"ExecuteTime": {
|
||||||
"is_executing": true
|
"end_time": "2024-02-17T07:55:44.526904Z",
|
||||||
|
"start_time": "2024-02-17T07:55:43.166698Z"
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"collapsed": false
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": "AIMessage(content='Hello! How can I help you today?')"
|
||||||
|
},
|
||||||
|
"execution_count": 10,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"\"\"\"For basic init and call\"\"\"\n",
|
"\"\"\"For basic init and call\"\"\"\n",
|
||||||
"from langchain_community.chat_models import ChatSparkLLM\n",
|
"from langchain_community.chat_models import ChatSparkLLM\n",
|
||||||
@ -62,14 +75,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 13,
|
||||||
"id": "7dc162bd65fec08f",
|
"id": "7dc162bd65fec08f",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false
|
"collapsed": false
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Hello! How can I help you today?"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"chat = ChatSparkLLM(streaming=True)\n",
|
"chat = ChatSparkLLM(\n",
|
||||||
|
" spark_app_id=\"<app_id>\",\n",
|
||||||
|
" spark_api_key=\"<api_key>\",\n",
|
||||||
|
" spark_api_secret=\"<api_secret>\",\n",
|
||||||
|
" streaming=True,\n",
|
||||||
|
")\n",
|
||||||
"for chunk in chat.stream(\"Hello!\"):\n",
|
"for chunk in chat.stream(\"Hello!\"):\n",
|
||||||
" print(chunk.content, end=\"\")"
|
" print(chunk.content, end=\"\")"
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user