SparkLLM is a large-scale cognitive model independently developed by iFLYTEK. It has cross-domain knowledge and language understanding ability by learning a large amount of texts, codes and images. It can understand and perform tasks based on natural dialogue.
PrerequisiteIFLYTEK_SPARK_APP_ID
, IFLYTEK_SPARK_API_KEY
and IFLYTEK_SPARK_API_SECRET
or pass parameters when creating ChatSparkLLM
as the demo above.import os
os.environ["IFLYTEK_SPARK_APP_ID"] = "app_id"
os.environ["IFLYTEK_SPARK_API_KEY"] = "api_key"
os.environ["IFLYTEK_SPARK_API_SECRET"] = "api_secret"
from langchain_community.llms import SparkLLM
llm = SparkLLM()
res = llm.invoke("What's your name?")
print(res)
/Users/liugddx/code/langchain/libs/core/langchain_core/_api/deprecation.py:117: LangChainDeprecationWarning: The function `__call__` was deprecated in LangChain 0.1.7 and will be removed in 0.2.0. Use invoke instead.
warn_deprecated(
``````output
My name is iFLYTEK Spark. How can I assist you today?
res = llm.generate(prompts=["hello!"])
res
LLMResult(generations=[[Generation(text='Hello! How can I assist you today?')]], llm_output=None, run=[RunInfo(run_id=UUID('d8cdcd41-a698-4cbf-a28d-e74f9cd2037b'))])
for res in llm.stream("foo:"):
print(res)
Hello! How can I assist you today?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4