langchain/tests/unit_tests
Junlin Zhou 5f17c57174
Update chat agents' output parser to extract action by regex (#7511)
Currently `ChatOutputParser` extracts actions by splitting the text on
"```", and then load the second part as a json string.

But sometimes the LLM will wrap the action in markdown code block like:

````markdown
```json
{
  "action": "foo",
  "action_input": "bar"
}
```
````

Splitting text on "```" will cause `OutputParserException` in such case.

This PR changes the behaviour to extract the `$JSON_BLOB` by regex, so
that it can handle both ` ``` ``` ` and ` ```json ``` `

@hinthornw

---------

Co-authored-by: Junlin Zhou <jlzhou@zjuici.com>
2023-07-12 03:12:02 -04:00
..
agents Update chat agents' output parser to extract action by regex (#7511) 2023-07-12 03:12:02 -04:00
callbacks Make Ref Example Threadsafe (#7383) 2023-07-07 21:50:42 -07:00
chains Docs combine document chain (#6994) 2023-07-04 12:51:04 -06:00
chat_models Harrison/split schema dir (#7025) 2023-07-01 13:39:19 -04:00
client Base language model docstrings (#7104) 2023-07-07 16:09:10 -04:00
data
docstore Enable InMemoryDocstore to be constructed without providing a dict (#6976) 2023-07-05 16:56:31 -04:00
document_loaders Document loader for Cube Semantic Layer (#6882) 2023-07-05 15:18:12 -07:00
evaluation Add String Distance and Embedding Evaluators (#7123) 2023-07-07 21:44:31 -07:00
examples Doc refactor (#6300) 2023-06-16 11:52:56 -07:00
llms Harrison/split schema dir (#7025) 2023-07-01 13:39:19 -04:00
load Include placeholder value for all secrets, not just kwargs (#6421) 2023-06-19 15:41:45 +01:00
memory Add ZepMemory; improve ZepChatMessageHistory handling of metadata; Fix bugs (#7444) 2023-07-10 01:53:49 -04:00
output_parsers Re-use Trajectory Evaluator (#7248) 2023-07-06 07:00:24 -07:00
prompts Jinja2 validation changed to issue warnings rather than issuing exceptions. (#7161) 2023-07-05 14:04:29 -04:00
retrievers Add serialized object to retriever start callback (#7074) 2023-07-05 18:04:43 +01:00
tools Fix: Recognize List at from_function (#7178) 2023-07-06 17:22:09 -04:00
utilities
vectorstores Add maximal relevance search to SKLearnVectorStore (#5430) 2023-05-30 16:13:33 -07:00
__init__.py
conftest.py
test_bash.py
test_cache.py Unset Cache in Tests (#7362) 2023-07-07 11:05:09 -07:00
test_dependencies.py Docs combine document chain (#6994) 2023-07-04 12:51:04 -06:00
test_document_transformers.py
test_formatting.py
test_math_utils.py
test_pytest_config.py
test_python.py
test_schema.py Harrison/split schema dir (#7025) 2023-07-01 13:39:19 -04:00
test_sql_database_schema.py
test_sql_database.py Fix SQLAlchemy truncating text when it is too big (#5206) 2023-06-01 21:33:31 -04:00
test_sqlalchemy.py unit test sqlalachemy (#7582) 2023-07-12 03:03:16 -04:00
test_text_splitter.py Fix inconsistent behavior of CharacterTextSplitter when changing keep_separator (#7263) 2023-07-06 09:30:03 -04:00
test_utils.py Refac package version check (#7312) 2023-07-07 01:21:53 -04:00