mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
fix(openai.py): fix linting issues
This commit is contained in:
parent
a94c09c13c
commit
d7f7694848
1 changed files with 8 additions and 9 deletions
|
@ -233,9 +233,9 @@ class OpenAIChatCompletion(BaseLLM):
|
|||
|
||||
async def acompletion(self,
|
||||
data: dict,
|
||||
model_response: ModelResponse,
|
||||
api_base: str,
|
||||
api_key: str):
|
||||
model_response: ModelResponse,
|
||||
api_key: Optional[str]=None,
|
||||
api_base: Optional[str]=None):
|
||||
response = None
|
||||
try:
|
||||
openai_aclient = AsyncOpenAI(api_key=api_key, base_url=api_base)
|
||||
|
@ -251,8 +251,8 @@ class OpenAIChatCompletion(BaseLLM):
|
|||
logging_obj,
|
||||
data: dict,
|
||||
model: str,
|
||||
api_key: str,
|
||||
api_base: str
|
||||
api_key: Optional[str]=None,
|
||||
api_base: Optional[str]=None
|
||||
):
|
||||
openai_client = OpenAI(api_key=api_key, base_url=api_base)
|
||||
response = openai_client.chat.completions.create(**data)
|
||||
|
@ -264,15 +264,14 @@ class OpenAIChatCompletion(BaseLLM):
|
|||
logging_obj,
|
||||
data: dict,
|
||||
model: str,
|
||||
api_key: str,
|
||||
api_base: str):
|
||||
api_key: Optional[str]=None,
|
||||
api_base: Optional[str]=None):
|
||||
openai_aclient = AsyncOpenAI(api_key=api_key, base_url=api_base)
|
||||
response = await openai_aclient.chat.completions.create(**data)
|
||||
streamwrapper = CustomStreamWrapper(completion_stream=response, model=model, custom_llm_provider="openai",logging_obj=logging_obj)
|
||||
async for transformed_chunk in streamwrapper:
|
||||
yield transformed_chunk
|
||||
|
||||
|
||||
def embedding(self,
|
||||
model: str,
|
||||
input: list,
|
||||
|
@ -284,7 +283,7 @@ class OpenAIChatCompletion(BaseLLM):
|
|||
super().embedding()
|
||||
exception_mapping_worked = False
|
||||
try:
|
||||
openai_client = OpenAI(api_key=api_key, api_base=api_base)
|
||||
openai_client = OpenAI(api_key=api_key, base_url=api_base)
|
||||
model = model
|
||||
data = {
|
||||
"model": model,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue