mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
raise exception if optional param is not mapped to model
This commit is contained in:
parent
49f65b7eb8
commit
1cae080eb2
8 changed files with 155 additions and 112 deletions
|
@ -17,6 +17,11 @@ class HuggingfaceError(Exception):
|
|||
self.message
|
||||
) # Call the base class constructor with the parameters it needs
|
||||
|
||||
# contains any default values we need to pass to the provider
|
||||
HuggingfaceConfig = {
|
||||
"return_full_text": False # override by setting - completion(..,return_full_text=True)
|
||||
}
|
||||
|
||||
def validate_environment(api_key):
|
||||
headers = {
|
||||
"content-type": "application/json",
|
||||
|
@ -101,6 +106,11 @@ def completion(
|
|||
else:
|
||||
completion_url = f"https://api-inference.huggingface.co/models/{model}"
|
||||
|
||||
## Load Config
|
||||
for k, v in HuggingfaceConfig.items():
|
||||
if k not in optional_params:
|
||||
optional_params[k] = v
|
||||
|
||||
### MAP INPUT PARAMS
|
||||
if task == "conversational":
|
||||
inference_params = copy.deepcopy(optional_params)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue