You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/core/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr

374 lines
8.3 KiB
Plaintext

# serializer version: 1
# name: test_fallbacks[chain]
'''
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableSequence"
],
"kwargs": {
"first": {
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableParallel"
],
"kwargs": {
"steps": {
"buz": {
"lc": 1,
"type": "not_implemented",
"id": [
"langchain_core",
"runnables",
"base",
"RunnableLambda"
],
"repr": "RunnableLambda(lambda x: x)"
}
}
}
},
"middle": [],
"last": {
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableWithFallbacks"
],
"kwargs": {
"runnable": {
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableSequence"
],
"kwargs": {
"first": {
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"prompts",
"prompt",
"PromptTemplate"
],
"kwargs": {
"input_variables": [
"buz"
],
"template": "what did baz say to {buz}",
"template_format": "f-string",
"partial_variables": {}
}
},
"middle": [],
"last": {
"lc": 1,
"type": "not_implemented",
"id": [
"tests",
"unit_tests",
"fake",
"llm",
"FakeListLLM"
],
"repr": "FakeListLLM(responses=['foo'], i=1)"
},
"name": null
}
},
"fallbacks": [
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableSequence"
],
"kwargs": {
"first": {
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"prompts",
"prompt",
"PromptTemplate"
],
"kwargs": {
"input_variables": [
"buz"
],
"template": "what did baz say to {buz}",
"template_format": "f-string",
"partial_variables": {}
}
},
"middle": [],
"last": {
"lc": 1,
"type": "not_implemented",
"id": [
"tests",
"unit_tests",
"fake",
"llm",
"FakeListLLM"
],
"repr": "FakeListLLM(responses=['bar'])"
},
"name": null
}
}
],
"exceptions_to_handle": [
{
"lc": 1,
"type": "not_implemented",
"id": [
"builtins",
"Exception"
],
"repr": "<class 'Exception'>"
}
],
"exception_key": null
}
},
"name": null
}
}
'''
# ---
# name: test_fallbacks[chain_pass_exceptions]
'''
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableSequence"
],
"kwargs": {
"first": {
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableParallel"
],
"kwargs": {
"steps": {
"text": {
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnablePassthrough"
],
"kwargs": {
"func": null,
"afunc": null,
"input_type": null
}
}
}
}
},
"middle": [],
"last": {
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableWithFallbacks"
],
"kwargs": {
"runnable": {
"lc": 1,
"type": "not_implemented",
"id": [
"langchain_core",
"runnables",
"base",
"RunnableLambda"
],
"repr": "RunnableLambda(_raise_error)"
},
"fallbacks": [
{
"lc": 1,
"type": "not_implemented",
"id": [
"langchain_core",
"runnables",
"base",
"RunnableLambda"
],
"repr": "RunnableLambda(_dont_raise_error)"
}
],
"exceptions_to_handle": [
{
"lc": 1,
"type": "not_implemented",
"id": [
"builtins",
"Exception"
],
"repr": "<class 'Exception'>"
}
],
"exception_key": "exception"
}
},
"name": null
}
}
'''
# ---
# name: test_fallbacks[llm]
'''
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableWithFallbacks"
],
"kwargs": {
"runnable": {
"lc": 1,
"type": "not_implemented",
"id": [
"tests",
"unit_tests",
"fake",
"llm",
"FakeListLLM"
],
"repr": "FakeListLLM(responses=['foo'], i=1)"
},
"fallbacks": [
{
"lc": 1,
"type": "not_implemented",
"id": [
"tests",
"unit_tests",
"fake",
"llm",
"FakeListLLM"
],
"repr": "FakeListLLM(responses=['bar'])"
}
],
"exceptions_to_handle": [
{
"lc": 1,
"type": "not_implemented",
"id": [
"builtins",
"Exception"
],
"repr": "<class 'Exception'>"
}
],
"exception_key": null
}
}
'''
# ---
# name: test_fallbacks[llm_multi]
'''
{
"lc": 1,
"type": "constructor",
"id": [
"langchain",
"schema",
"runnable",
"RunnableWithFallbacks"
],
"kwargs": {
"runnable": {
"lc": 1,
"type": "not_implemented",
"id": [
"tests",
"unit_tests",
"fake",
"llm",
"FakeListLLM"
],
"repr": "FakeListLLM(responses=['foo'], i=1)"
},
"fallbacks": [
{
"lc": 1,
"type": "not_implemented",
"id": [
"tests",
"unit_tests",
"fake",
"llm",
"FakeListLLM"
],
"repr": "FakeListLLM(responses=['baz'], i=1)"
},
{
"lc": 1,
"type": "not_implemented",
"id": [
"tests",
"unit_tests",
"fake",
"llm",
"FakeListLLM"
],
"repr": "FakeListLLM(responses=['bar'])"
}
],
"exceptions_to_handle": [
{
"lc": 1,
"type": "not_implemented",
"id": [
"builtins",
"Exception"
],
"repr": "<class 'Exception'>"
}
],
"exception_key": null
}
}
'''
# ---