mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-18 18:53:10 +00:00
Update modal.py (#11588)
feat: Raise KeyError when 'prompt' key is missing in JSON response This commit updates the error handling in the code to raise a KeyError when the 'prompt' key is not found in the JSON response. This change makes the code more explicit about the nature of the error, helping to improve clarity and debugging. @baskaryan, @eyurtsev.
This commit is contained in:
parent
2038c7fd5d
commit
4b6fdd7bf0
@ -91,7 +91,7 @@ class Modal(LLM):
|
||||
if prompt in response.json()["prompt"]:
|
||||
response_json = response.json()
|
||||
except KeyError:
|
||||
raise ValueError("LangChain requires 'prompt' key in response.")
|
||||
raise KeyError("LangChain requires 'prompt' key in response.")
|
||||
text = response_json["prompt"]
|
||||
if stop is not None:
|
||||
# I believe this is required since the stop tokens
|
||||
|
Loading…
Reference in New Issue
Block a user