Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: langchain integration input/output format #1114

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

desaxce
Copy link
Collaborator

@desaxce desaxce commented Jul 4, 2024

Changes:

  • added process_content to get content according to language
  • applied it to input / output / variables

To test:

Had to remove process content on output because of error:

2024-07-04 10:01:24 - An output parsing error occurred. In order to pass this error back to the agent and have it try again, pass `handle_parsing_errors=True` to the AgentExecutor. This is the error: Could not parse LLM output: Question: I need to order pizza for a hackathon. How many should I order?
Thought: To determine how many pizzas to order, I need to know the number of people attending the hackathon and the average number of pizza slices each person is expected to eat. Additionally, I need to know how many slices are in each pizza.
Action:

{
"action": human,
"action_input": How many people are attending the hackathon, how many slices does each person typically eat, and how many slices are in each pizza?
}

Traceback (most recent call last):
  File "/Users/desaxce/miniconda3/envs/chainlit/lib/python3.12/site-packages/langchain/agents/chat/output_parser.py", line 35, in parse
    response = json.loads(action.strip())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/desaxce/miniconda3/envs/chainlit/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/desaxce/miniconda3/envs/chainlit/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/desaxce/miniconda3/envs/chainlit/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 13 (char 14)

@willydouhard willydouhard merged commit 73dd0fb into main Jul 24, 2024
4 checks passed
@willydouhard willydouhard deleted the hugues/langchain-fixes branch July 24, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants