python sdk for XunFei (iFLYTEK) Spark AI
Project description
English | 中文
what is?
- python sdk for XunFei (iFLYTEK) Spark AI
how to use
-
get Spark AI api in https://www.xfyun.cn/
-
install
pip install spark-ai-sdk
- use
from spark_ai_sdk.spark_ai import SparkAI
history1 = []
# -------------------------
APP_ID = "xxxxx"
APISecret = "xxxxxxxxxxxxxxxxxxxxx"
APIKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
API_URL = "wss://spark-api.xf-yun.com/v1.1/chat"
# ------------------------
server = SparkAI(
app_id=APP_ID,
api_key=APIKey,
api_secret=APISecret,
api_url=API_URL
)
while True:
query1 = input("User: ")
if query1 == "exit" or query1 == "stop":
break
for response1, history1 in server.chat_stream(query1, history1):
print("\rAI: ", response1, end="")
print("")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spark-ai-sdk-0.0.4.tar.gz
(3.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spark-ai-sdk-0.0.4.tar.gz.
File metadata
- Download URL: spark-ai-sdk-0.0.4.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f39d10c1fb89e74ed8e2ca85de4d2dc3eb9a7bec7647a34d65baef3757d6388e
|
|
| MD5 |
2c93ed0754070e8129964d76e21c3d84
|
|
| BLAKE2b-256 |
24ce9d551b1833e1e58d56b051cbc4b107be4a5130baa342c83374c7df6a98a0
|
File details
Details for the file spark_ai_sdk-0.0.4-py3-none-any.whl.
File metadata
- Download URL: spark_ai_sdk-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0532ed84d85db4df25f1ca2ca8944f2908b971352338145ac4eab5926fe451b5
|
|
| MD5 |
f8de1c24d19b13334c307b817e3e9feb
|
|
| BLAKE2b-256 |
0f18846e0268267ccf875e8f29d7790003092a6917f398e9c17b352a3642eea3
|