Replies: 3 comments
-
Hey there, @forpr1093! I'm here to assist you with any bugs, questions, or contributions you might have. Let's work together to solve the issue you're facing. The request body for {
"input": "...",
"chat_history": [...]
} This is based on the example provided in the documentation: chain.invoke({"input": "...", "chat_history": [...]}) The from langchain.chains import create_retrieval_chain
from langchain.chains.combine_documents import create_stuff_documents_chain
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI
retriever = ... # Your retriever
llm = ChatOpenAI()
system_prompt = (
"Use the given context to answer the question. "
"If you don't know the answer, say you don't know. "
"Use three sentence maximum and keep the answer concise. "
"Context: {context}"
)
prompt = ChatPromptTemplate.from_messages(
[
("system", system_prompt),
("human", "{input}"),
]
)
question_answer_chain = create_stuff_documents_chain(llm, prompt)
chain = create_retrieval_chain(retriever, question_answer_chain)
chain.invoke({"input": query}) When making an HTTP call, ensure that the request body matches the expected structure: {
"input": "Your question here",
"chat_history": ["Previous message 1", "Previous message 2"]
} This should resolve the
|
Beta Was this translation helpful? Give feedback.
-
I'm having the same problem. My code is exactly the same as the one from dosubot but I always get the same error message and the playground doesn't take any input. |
Beta Was this translation helpful? Give feedback.
-
Same problem here any idea ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I am using the example from https://python.langchain.com/v0.1/docs/use_cases/question_answering/chat_history/.
I am able to get response while using
.invoke({input: input, chat_history: chat_history})
.However, when I tried to call it through http calls using the code below:
I received the errors below:
I have tried to take a look on the swagger doc, but the request body seems to be incompleted.

Any help will be appreciated! Thank you!
System Info
aiohttp==3.9.4
aiosignal==1.3.1
altair==5.3.0
annotated-types==0.6.0
anyio==4.3.0
asgiref==3.8.1
attrs==23.2.0
backoff==2.2.1
bcrypt==4.1.2
beautifulsoup4==4.12.3
black==24.4.0
blinker==1.7.0
boto3==1.34.105
botocore==1.34.105
bs4==0.0.2
build==1.2.1
cachetools==5.3.3
certifi==2024.2.2
charset-normalizer==3.3.2
chroma-hnswlib==0.7.1
chromadb==0.4.3
click==8.1.7
colorama==0.4.6
coloredlogs==15.0.1
dataclasses-json==0.6.4
Deprecated==1.2.14
distro==1.9.0
dnspython==2.6.1
docarray==0.40.0
docstring_parser==0.16
fastapi==0.99.1
filelock==3.13.4
flatbuffers==24.3.25
frozenlist==1.4.1
fsspec==2024.3.1
gitdb==4.0.11
GitPython==3.1.43
google-ai-generativelanguage==0.6.3
google-api-core==2.18.0
google-api-python-client==2.129.0
google-auth==2.29.0
google-auth-httplib2==0.2.0
google-cloud-aiplatform==1.47.0
google-cloud-bigquery==3.20.1
google-cloud-core==2.4.1
google-cloud-resource-manager==1.12.3
google-cloud-storage==2.16.0
google-crc32c==1.5.0
google-generativeai==0.5.3
google-resumable-media==2.7.0
googleapis-common-protos==1.63.0
greenlet==3.0.3
grpc-google-iam-v1==0.13.0
grpcio==1.62.1
grpcio-status==1.62.1
h11==0.14.0
hnswlib==0.8.0
httpcore==1.0.5
httplib2==0.22.0
httptools==0.6.1
httpx==0.27.0
httpx-sse==0.4.0
huggingface-hub==0.22.2
humanfriendly==10.0
idna==3.7
importlib-metadata==7.0.0
importlib_resources==6.4.0
Jinja2==3.1.3
jmespath==1.0.1
joblib==1.4.0
jsonpatch==1.33
jsonpointer==2.4
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
kubernetes==29.0.0
langchain==0.2.1
langchain-chroma==0.1.1
langchain-cli==0.0.21
langchain-community==0.2.1
langchain-core==0.2.1
langchain-experimental==0.0.59
langchain-google-genai==1.0.5
langchain-google-vertexai==1.0.4
langchain-mongodb==0.1.3
langchain-openai==0.1.7
langchain-postgres==0.0.3
langchain-text-splitters==0.2.0
langchainhub==0.1.16
langgraph==0.0.32
langserve==0.2.1
langsmith==0.1.47
logger==1.4
markdown-it-py==3.0.0
MarkupSafe==2.1.5
marshmallow==3.21.1
mdurl==0.1.2
mmh3==4.1.0
monotonic==1.6
mpmath==1.3.0
multidict==6.0.5
mypy-extensions==1.0.0
networkx==3.3
numpy==1.26.4
oauthlib==3.2.2
onnxruntime==1.17.3
openai==1.25.1
opentelemetry-api==1.24.0
opentelemetry-exporter-otlp-proto-common==1.24.0
opentelemetry-exporter-otlp-proto-grpc==1.24.0
opentelemetry-instrumentation==0.45b0
opentelemetry-instrumentation-asgi==0.45b0
opentelemetry-instrumentation-fastapi==0.45b0
opentelemetry-proto==1.24.0
opentelemetry-sdk==1.24.0
opentelemetry-semantic-conventions==0.45b0
opentelemetry-util-http==0.45b0
orjson==3.10.0
overrides==7.7.0
packaging==23.2
pandas==2.2.2
pathspec==0.12.1
pgvector==0.2.5
pillow==10.3.0
platformdirs==4.2.0
posthog==3.5.0
proto-plus==1.23.0
protobuf==4.25.3
psycopg==3.1.18
psycopg-binary==3.1.18
psycopg-pool==3.2.1
pulsar-client==3.5.0
pyarrow==15.0.2
pyasn1==0.6.0
pyasn1_modules==0.4.0
pydantic==1.10.13
pydantic_core==2.18.1
pydeck==0.8.1b0
Pygments==2.17.2
pymongo==4.6.3
pyparsing==3.1.2
pypdf==4.2.0
PyPika==0.48.9
pyproject-toml==0.0.10
pyproject_hooks==1.0.0
pyreadline3==3.4.1
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-multipart==0.0.9
pytz==2024.1
PyYAML==6.0.1
referencing==0.34.0
regex==2024.4.16
requests==2.31.0
requests-oauthlib==2.0.0
rich==13.7.1
rpds-py==0.18.0
rsa==4.9
s3transfer==0.10.1
safetensors==0.4.3
scikit-learn==1.4.2
scipy==1.13.0
sentence-transformers==2.6.1
shapely==2.0.3
shellingham==1.5.4
six==1.16.0
smmap==5.0.1
sniffio==1.3.1
soupsieve==2.5
SQLAlchemy==2.0.29
sse-starlette==1.8.2
starlette==0.27.0
streamlit==1.33.0
sympy==1.12
tenacity==8.2.3
threadpoolctl==3.4.0
tiktoken==0.7.0
tokenizers==0.15.2
toml==0.10.2
tomlkit==0.12.4
toolz==0.12.1
torch==2.2.2
tornado==6.4
tqdm==4.66.2
transformers==4.39.3
typer==0.9.4
types-protobuf==4.25.0.20240410
types-requests==2.31.0.20240406
typing-inspect==0.9.0
typing_extensions==4.11.0
tzdata==2024.1
uritemplate==4.1.1
urllib3==2.2.1
uvicorn==0.23.2
watchdog==4.0.0
watchfiles==0.21.0
websocket-client==1.7.0
websockets==12.0
wrapt==1.16.0
yarl==1.9.4
zipp==3.18.1
Beta Was this translation helpful? Give feedback.
All reactions