Fix: Aivvm: KeyError: ''

and TypeError: issubclass() arg 1 must be a class
This commit is contained in:
Heiner Lohaus 2023-09-23 15:35:17 +02:00
parent bf78b4d033
commit 4edd7518de
2 changed files with 10 additions and 4 deletions

View File

@ -2,7 +2,7 @@ from __future__ import annotations
import requests import requests
from .base_provider import BaseProvider from .base_provider import BaseProvider
from ..typing import Any, CreateResult from ..typing import CreateResult
models = { models = {
'gpt-3.5-turbo': {'id': 'gpt-3.5-turbo', 'name': 'GPT-3.5'}, 'gpt-3.5-turbo': {'id': 'gpt-3.5-turbo', 'name': 'GPT-3.5'},
@ -26,8 +26,14 @@ class Aivvm(BaseProvider):
def create_completion(cls, def create_completion(cls,
model: str, model: str,
messages: list[dict[str, str]], messages: list[dict[str, str]],
stream: bool, **kwargs: Any) -> CreateResult: stream: bool,
**kwargs
) -> CreateResult:
if not model:
model = "gpt-3.5-turbo"
elif model not in models:
raise ValueError(f"Model are not supported: {model}")
headers = { headers = {
"authority" : "chat.aivvm.com", "authority" : "chat.aivvm.com",
"accept" : "*/*", "accept" : "*/*",

View File

@ -24,7 +24,7 @@ from .Provider import (
class Model: class Model:
name: str name: str
base_provider: str base_provider: str
best_provider: Union[type[BaseProvider], tuple[type[BaseProvider]]] = None best_provider: Union[type[BaseProvider], RetryProvider] = None
# Config for HuggingChat, OpenAssistant # Config for HuggingChat, OpenAssistant
# Works for Liaobots, H2o, OpenaiChat, Yqcloud, You # Works for Liaobots, H2o, OpenaiChat, Yqcloud, You