fix(main.py): map list input to ollama prompt input format

This commit is contained in:
Krrish Dholakia 2024-02-16 09:56:59 -08:00
parent dca9103b09
commit 944afcb5d1
2 changed files with 29 additions and 2 deletions

View file

@ -24,6 +24,7 @@ from openai import (
PermissionDeniedError,
)
import httpx
from typing import Optional
class AuthenticationError(AuthenticationError): # type: ignore
@ -50,11 +51,19 @@ class NotFoundError(NotFoundError): # type: ignore
class BadRequestError(BadRequestError): # type: ignore
def __init__(self, message, model, llm_provider, response: httpx.Response):
def __init__(
self, message, model, llm_provider, response: Optional[httpx.Response] = None
):
self.status_code = 400
self.message = message
self.model = model
self.llm_provider = llm_provider
response = response or httpx.Response(
status_code=self.status_code,
request=httpx.Request(
method="GET", url="https://litellm.ai"
), # mock request object
)
super().__init__(
self.message, response=response, body=None
) # Call the base class constructor with the parameters it needs