You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.llms import VolcEngineMaasLLM
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import PromptTemplate
import os
model = VolcEngineMaasLLM(model=os.getenv("DOUBAO_LITE_MODEL"),
volc_engine_maas_ak=os.getenv("AK"),
volc_engine_maas_sk=os.getenv("SK"))
chain = PromptTemplate.from_template("give a joke") | model | StrOutputParser()
result = chain.invoke({})
print(result)
Error Message and Stack Trace (if applicable)
F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\python.exe "F:\SteamLibrary\steamapps\common\Arma 3@LLM\llm_test\test.py"
Traceback (most recent call last):
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\volcengine\maas\MaasService.py", line 46, in chat
res = self.json("chat", {}, json.dumps(req).encode("utf-8"))
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\volcengine\base\Service.py", line 194, in json
raise Exception(resp.text.encode("utf-8"))
Exception: b'{"req_id":"20250306204342B5A4D1F2F69844335E30","error":{"code":"APINotSupport","code_n":1709828,"message":"\xe6\x9a\x82\xe4\xb8\x8d\xe6\x94\xaf\xe6\x8c\x81\xe8\xaf\xa5\xe6\x8e\xa5\xe5\x8f\xa3, \xe6\x88\x96\xe8\x80\x85\xe8\x81\x94\xe7\xb3\xbb\xe5\xb9\xb3\xe5\x8f\xb0\xe6\x8a\x80\xe6\x9c\xaf\xe5\x90\x8c\xe5\xad\xa6\xe8\xbf\x9b\xe8\xa1\x8c\xe8\xa7\xa3\xe5\x86\xb3"}}'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\SteamLibrary\steamapps\common\Arma 3@LLM\llm_test\test.py", line 11, in
result = chain.invoke({})
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\runnables\base.py", line 3024, in invoke
input = context.run(step.invoke, input, config)
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 387, in invoke
self.generate_prompt(
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 760, in generate_prompt
return self.generate(prompt_strings, stop=stop, callbacks=callbacks, **kwargs)
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 963, in generate
output = self._generate_helper(
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 784, in _generate_helper
self._generate(
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 1523, in _generate
self._call(prompt, stop=stop, run_manager=run_manager, **kwargs)
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_community\llms\volcengine_maas.py", line 163, in _call
response = self.client.chat(params)
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\volcengine\maas\MaasService.py", line 58, in chat
raise MaasException(resp.error.code_n, resp.error.code, resp.error.message, resp.req_id)
volcengine.maas.exception.MaasException: Detailed exception information is listed below.
req_id: 20250306204342B5A4D1F2F69844335E30
code_n: 1709828
code: APINotSupport
message: 暂不支持该接口, 或者联系平台技术同学进行解决
进程已结束,退出代码1
Description
use VolcEngineMaasLLM object to create llm to chat failed
but Using the official example(www.volcengine.com) was successful
# pip install "volcengine-python-sdk[ark]"
import os
from volcenginesdkarkruntime import Ark
# 请确保您已将 AK SK 分别存储在环境变量 VOLC_ACCESSKEY 和 VOLC_SECRETKEY中
# 初始化Ark客户端,从环境变量中读取您的AKSK
client = Ark(
# 此为默认路径,您可根据业务所在地域进行配置
base_url="https://ark.cn-beijing.volces.com/api/v3",
# 从环境变量中获取您的Key鉴权。此为默认方式,您可根据需要进行修改
ak=os.getenv("AK"),
sk=os.getenv("SK"),
)
# Non-streaming:
print("----- standard request -----")
completion = client.chat.completions.create(
# 指定您创建的方舟推理接入点 ID,此处已帮您修改为您的推理接入点 ID
model=os.getenv("DOUBAO_LITE_MODEL"),
messages=[
{"role": "system", "content": "你是人工智能助手"},
{"role": "user", "content": "常见的十字花科植物有哪些?"},
],
# 免费开启推理会话应用层加密,访问 https://www.volcengine.com/docs/82379/1389905 了解更多
extra_headers={'x-is-encrypted': 'true'},
)
print(completion.choices[0].message.content)
# Streaming:
print("----- streaming request -----")
stream = client.chat.completions.create(
# 指定您创建的方舟推理接入点 ID,此处已帮您修改为您的推理接入点 ID
model=os.getenv("DOUBAO_LITE_MODEL"),
messages=[
{"role": "system", "content": "你是人工智能助手"},
{"role": "user", "content": "常见的十字花科植物有哪些?"},
],
# 免费开启推理会话应用层加密,访问 https://www.volcengine.com/docs/82379/1389905 了解更多
extra_headers={'x-is-encrypted': 'true'},
# 响应内容是否流式返回
stream=True,
)
for chunk in stream:
if not chunk.choices:
continue
print(chunk.choices[0].delta.content, end="")
print()
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\python.exe "F:\SteamLibrary\steamapps\common\Arma 3@LLM\llm_test\test.py"
Traceback (most recent call last):
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\volcengine\maas\MaasService.py", line 46, in chat
res = self.json("chat", {}, json.dumps(req).encode("utf-8"))
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\volcengine\base\Service.py", line 194, in json
raise Exception(resp.text.encode("utf-8"))
Exception: b'{"req_id":"20250306204342B5A4D1F2F69844335E30","error":{"code":"APINotSupport","code_n":1709828,"message":"\xe6\x9a\x82\xe4\xb8\x8d\xe6\x94\xaf\xe6\x8c\x81\xe8\xaf\xa5\xe6\x8e\xa5\xe5\x8f\xa3, \xe6\x88\x96\xe8\x80\x85\xe8\x81\x94\xe7\xb3\xbb\xe5\xb9\xb3\xe5\x8f\xb0\xe6\x8a\x80\xe6\x9c\xaf\xe5\x90\x8c\xe5\xad\xa6\xe8\xbf\x9b\xe8\xa1\x8c\xe8\xa7\xa3\xe5\x86\xb3"}}'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\SteamLibrary\steamapps\common\Arma 3@LLM\llm_test\test.py", line 11, in
result = chain.invoke({})
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\runnables\base.py", line 3024, in invoke
input = context.run(step.invoke, input, config)
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 387, in invoke
self.generate_prompt(
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 760, in generate_prompt
return self.generate(prompt_strings, stop=stop, callbacks=callbacks, **kwargs)
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 963, in generate
output = self._generate_helper(
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 784, in _generate_helper
self._generate(
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_core\language_models\llms.py", line 1523, in _generate
self._call(prompt, stop=stop, run_manager=run_manager, **kwargs)
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\langchain_community\llms\volcengine_maas.py", line 163, in _call
response = self.client.chat(params)
File "F:\SteamLibrary\steamapps\workshop\content\107410\1751569185\python-310-embed-amd64\lib\site-packages\volcengine\maas\MaasService.py", line 58, in chat
raise MaasException(resp.error.code_n, resp.error.code, resp.error.message, resp.req_id)
volcengine.maas.exception.MaasException: Detailed exception information is listed below.
req_id: 20250306204342B5A4D1F2F69844335E30
code_n: 1709828
code: APINotSupport
message: 暂不支持该接口, 或者联系平台技术同学进行解决
进程已结束,退出代码1
Description
use VolcEngineMaasLLM object to create llm to chat failed
but Using the official example(www.volcengine.com) was successful
System Info
aiobotocore==2.12.3
aiohappyeyeballs==2.4.0
aiohttp==3.10.5
aioitertools==0.7.1
aiosignal==1.2.0
alabaster==0.7.16
altair==5.0.1
anaconda-anon-usage==0.4.4
anaconda-catalogs==0.2.0
anaconda-client==1.12.3
anaconda-cloud-auth==0.5.1
anaconda-navigator==2.6.3
anaconda-project==0.11.1
annotated-types==0.6.0
anyio==4.2.0
appdirs==1.4.4
archspec==0.2.3
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
arrow==1.2.3
asgiref==3.8.1
astroid==2.14.2
astropy==6.1.3
astropy-iers-data==0.2024.9.2.0.33.23
asttokens==2.0.5
async-lru==2.0.4
atomicwrites==1.4.0
attrs==23.1.0
Automat==20.2.0
autopep8==2.0.4
Babel==2.11.0
backoff==2.2.1
bcrypt==4.2.1
beautifulsoup4==4.12.3
binaryornot==0.4.4
black==24.8.0
bleach==4.1.0
blinker==1.6.2
bokeh==3.6.0
boltons==23.0.0
botocore==1.34.69
Bottleneck==1.3.7
Brotli==1.0.9
build==1.2.2.post1
cachetools==5.3.3
certifi==2024.8.30
cffi==1.17.1
chardet==4.0.0
charset-normalizer==3.3.2
chroma-hnswlib==0.7.6
chromadb==0.6.3
click==8.1.7
cloudpickle==3.0.0
colorama==0.4.6
colorcet==3.1.0
coloredlogs==15.0.1
comm==0.2.1
conda==24.9.2
conda-build==24.9.0
conda-content-trust==0.2.0
conda_index==0.5.0
conda-libmamba-solver==24.9.0
conda-pack==0.7.1
conda-package-handling==2.3.0
conda_package_streaming==0.10.0
conda-repo-cli==1.0.114
conda-token==0.5.0+1.g2209e04
constantly==23.10.4
contourpy==1.2.0
cookiecutter==2.6.0
cryptography==43.0.3
cssselect==1.2.0
cycler==0.11.0
cytoolz==0.12.2
dask==2024.8.2
dask-expr==1.1.13
dataclasses-json==0.6.7
datashader==0.16.3
debugpy==1.6.7
decorator==5.1.1
defusedxml==0.7.1
Deprecated==1.2.18
diff-match-patch==20200713
dill==0.3.8
distributed==2024.8.2
distro==1.9.0
docstring-to-markdown==0.11
docutils==0.18.1
durationpy==0.9
et-xmlfile==1.1.0
executing==0.8.3
fastapi==0.115.8
fastjsonschema==2.16.2
filelock==3.13.1
flake8==7.0.0
Flask==3.0.3
flatbuffers==25.2.10
fonttools==4.51.0
frozendict==2.4.2
frozenlist==1.4.0
fsspec==2024.6.1
gensim==4.3.3
gitdb==4.0.7
GitPython==3.1.43
google==3.0.0
google-auth==2.38.0
googleapis-common-protos==1.66.0
greenlet==3.0.1
grpcio==1.70.0
h11==0.14.0
h5py==3.11.0
HeapDict==1.0.1
holoviews==1.19.1
httpcore==1.0.2
httptools==0.6.4
httpx==0.27.0
httpx-sse==0.4.0
huggingface-hub==0.28.1
humanfriendly==10.0
hvplot==0.11.0
hyperlink==21.0.0
idna==3.7
imagecodecs==2023.1.23
imageio==2.33.1
imagesize==1.4.1
imbalanced-learn==0.12.3
importlib-metadata==7.0.1
importlib_resources==6.5.2
incremental==22.10.0
inflection==0.5.1
iniconfig==1.1.1
intake==2.0.7
intervaltree==3.1.0
ipykernel==6.28.0
ipython==8.27.0
ipython-genutils==0.2.0
ipywidgets==7.8.1
isort==5.13.2
itemadapter==0.3.0
itemloaders==1.1.0
itsdangerous==2.2.0
jaraco.classes==3.2.1
jedi==0.19.1
jellyfish==1.0.1
Jinja2==3.1.4
jiter==0.8.2
jmespath==1.0.1
joblib==1.4.2
json5==0.9.6
jsonpatch==1.33
jsonpointer==2.1
jsonschema==4.23.0
jsonschema-specifications==2023.7.1
jupyter==1.0.0
jupyter_client==8.6.0
jupyter-console==6.6.3
jupyter_core==5.7.2
jupyter-events==0.10.0
jupyter-lsp==2.2.0
jupyter_server==2.14.1
jupyter_server_terminals==0.4.4
jupyterlab==4.2.5
jupyterlab-pygments==0.1.2
jupyterlab_server==2.27.3
jupyterlab-widgets==1.0.0
keyring==24.3.1
kiwisolver==1.4.4
kubernetes==32.0.0
langchain==0.3.18
langchain-chroma==0.2.1
langchain-community==0.3.17
langchain-core==0.3.34
langchain-experimental==0.3.4
langchain-openai==0.3.3
langchain-text-splitters==0.3.6
langchainhub==0.1.21
langsmith==0.3.6
lazy_loader==0.4
lazy-object-proxy==1.10.0
lckr_jupyterlab_variableinspector==3.1.0
libarchive-c==5.1
libmambapy==1.5.8
linkify-it-py==2.0.0
llvmlite==0.43.0
lmdb==1.4.1
locket==1.0.0
lxml==5.2.1
lz4==4.3.2
Markdown==3.4.1
markdown-it-py==2.2.0
MarkupSafe==2.1.3
marshmallow==3.26.1
matplotlib==3.9.2
matplotlib-inline==0.1.6
mccabe==0.7.0
mdit-py-plugins==0.3.0
mdurl==0.1.0
menuinst==2.1.2
mistune==2.0.4
mkl_fft==1.3.10
mkl_random==1.2.7
mkl-service==2.4.0
mmh3==5.1.0
monotonic==1.6
more-itertools==10.3.0
mpmath==1.3.0
msgpack==1.0.3
multidict==6.0.4
multipledispatch==0.6.0
mypy==1.11.2
mypy-extensions==1.0.0
navigator-updater==0.5.1
nbclient==0.8.0
nbconvert==7.16.4
nbformat==5.10.4
nest-asyncio==1.6.0
networkx==3.3
nltk==3.9.1
notebook==7.2.2
notebook_shim==0.2.3
numba==0.60.0
numexpr==2.8.7
numpy==1.26.4
numpydoc==1.7.0
oauthlib==3.2.2
onnxruntime==1.20.1
openai==1.61.1
openpyxl==3.1.5
opentelemetry-api==1.30.0
opentelemetry-exporter-otlp-proto-common==1.30.0
opentelemetry-exporter-otlp-proto-grpc==1.30.0
opentelemetry-instrumentation==0.51b0
opentelemetry-instrumentation-asgi==0.51b0
opentelemetry-instrumentation-fastapi==0.51b0
opentelemetry-proto==1.30.0
opentelemetry-sdk==1.30.0
opentelemetry-semantic-conventions==0.51b0
opentelemetry-util-http==0.51b0
orjson==3.10.15
overrides==7.4.0
packaging==24.1
pandas==2.2.2
pandocfilters==1.5.0
panel==1.5.2
param==2.1.1
paramiko==2.8.1
parsel==1.8.1
parso==0.8.3
partd==1.4.1
pathspec==0.10.3
patsy==0.5.6
pexpect==4.8.0
pickleshare==0.7.5
pillow==10.4.0
pip==25.0
pkce==1.0.3
pkginfo==1.10.0
platformdirs==3.10.0
plotly==5.24.1
pluggy==1.0.0
ply==3.11
posthog==3.12.1
prometheus-client==0.14.1
prompt-toolkit==3.0.43
Protego==0.1.16
protobuf==5.29.3
psutil==5.9.0
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0
py-cpuinfo==9.0.0
pyarrow==16.1.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycodestyle==2.11.1
pycosat==0.6.6
pycparser==2.21
pycryptodome==3.9.9
pyct==0.5.0
pycurl==7.45.3
pydantic==2.8.2
pydantic_core==2.20.1
pydantic-settings==2.7.1
pydeck==0.8.0
PyDispatcher==2.0.5
pydocstyle==6.3.0
pyerfa==2.0.1.4
pyflakes==3.2.0
Pygments==2.15.1
PyJWT==2.8.0
pylint==2.16.2
pylint-venv==3.0.3
pyls-spyder==0.4.0
PyNaCl==1.5.0
pyodbc==5.1.0
pyOpenSSL==24.2.1
pyparsing==3.1.2
PyPika==0.48.9
pyproject_hooks==1.2.0
PyQt5==5.15.10
PyQt5-sip==12.13.0
PyQtWebEngine==5.15.6
pyreadline3==3.5.4
PySocks==1.7.1
pytest==7.4.4
python-dateutil==2.9.0.post0
python-dotenv==0.21.0
python-json-logger==2.0.7
python-lsp-black==2.0.0
python-lsp-jsonrpc==1.1.2
python-lsp-server==1.10.0
python-slugify==5.0.2
pytoolconfig==1.2.6
pytz==2020.5
pyviz_comms==3.0.2
PyWavelets==1.7.0
pywin32==305.1
pywin32-ctypes==0.2.2
pywinpty==2.0.10
PyYAML==6.0.1
pyzmq==25.1.2
QDarkStyle==3.2.3
qstylizer==0.2.2
QtAwesome==1.3.1
qtconsole==5.5.1
QtPy==2.4.1
queuelib==1.6.2
referencing==0.30.2
regex==2024.9.11
requests==2.32.3
requests-file==1.5.1
requests-oauthlib==2.0.0
requests-toolbelt==1.0.0
retry==0.9.2
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rich==13.7.1
rope==1.12.0
rpds-py==0.10.6
rsa==4.9
Rtree==1.0.1
ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
ruamel-yaml-conda==0.17.21
s3fs==2024.6.1
scikit-image==0.24.0
scikit-learn==1.5.1
scipy==1.13.1
Scrapy==2.11.1
seaborn==0.13.2
semver==3.0.2
Send2Trash==1.8.2
service-identity==18.1.0
setuptools==75.1.0
shellingham==1.5.4
sip==6.7.12
six==1.16.0
smart-open==5.2.1
smmap==4.0.0
sniffio==1.3.0
snowballstemmer==2.2.0
sortedcontainers==2.4.0
soupsieve==2.5
Sphinx==7.3.7
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.10
spyder==5.5.1
spyder-kernels==2.5.0
SQLAlchemy==2.0.34
stack-data==0.2.0
starlette==0.45.3
statsmodels==0.14.2
streamlit==1.37.1
sympy==1.13.2
tables==3.10.1
tabulate==0.9.0
tblib==1.7.0
tenacity==8.2.3
terminado==0.17.1
text-unidecode==1.3
textdistance==4.2.1
threadpoolctl==3.5.0
three-merge==0.1.1
tifffile==2023.4.12
tiktoken==0.8.0
tinycss2==1.2.1
tldextract==5.1.2
tokenizers==0.21.0
toml==0.10.2
tomli==2.0.1
tomlkit==0.11.1
toolz==0.12.0
tornado==6.4.1
tqdm==4.66.5
traitlets==5.14.3
truststore==0.8.0
Twisted==23.10.0
twisted-iocpsupport==1.0.2
typer==0.15.1
types-requests==2.32.0.20241016
typing_extensions==4.11.0
typing-inspect==0.9.0
tzdata==2023.3
uc-micro-py==1.0.1
ujson==5.10.0
unicodedata2==15.1.0
Unidecode==1.3.8
urllib3==2.2.3
uvicorn==0.34.0
volcengine==1.0.174
volcengine-python-sdk==1.0.126
w3lib==2.1.2
watchdog==4.0.1
watchfiles==1.0.4
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.8.0
websockets==14.2
Werkzeug==3.0.3
whatthepatch==1.0.2
wheel==0.44.0
widgetsnbextension==3.6.6
win-inet-pton==1.1.0
wrapt==1.14.1
xarray==2023.6.0
xlwings==0.32.1
xyzservices==2022.9.0
yapf==0.40.2
yarl==1.11.0
zict==3.0.0
zipp==3.17.0
zope.interface==5.4.0
zstandard==0.23.0
The text was updated successfully, but these errors were encountered: