[core: minor] fix getters (#15181)

This commit is contained in:
Harrison Chase 2023-12-26 12:32:55 -08:00 committed by GitHub
parent 56fad2e8ff
commit b4a0d206d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -109,8 +109,6 @@ def _config_with_context(
raise ValueError(
f"Deadlock detected between context keys {key} and {dep}"
)
if len(getters) < 1:
raise ValueError(f"Expected at least one getter for context key {key}")
if len(setters) != 1:
raise ValueError(f"Expected exactly one setter for context key {key}")
setter_idx = setters[0][1]
@ -119,7 +117,8 @@ def _config_with_context(
f"Context setter for key {key} must be defined after all getters."
)
context_funcs[getters[0][0].id] = partial(getter, events[key], values)
if getters:
context_funcs[getters[0][0].id] = partial(getter, events[key], values)
context_funcs[setters[0][0].id] = partial(setter, events[key], values)
return patch_config(config, configurable=context_funcs)

View File

@ -8,6 +8,7 @@ EXPECTED_ALL = [
"LLM",
"LanguageModelInput",
"LanguageModelOutput",
"LanguageModelLike",
"get_tokenizer",
"LanguageModelLike",
]