adjust code format
This commit is contained in:
parent
35e3b5d94b
commit
dc28e9187b
@ -24,6 +24,7 @@ class LLMSettings(BaseModel):
|
|||||||
api_type: str = Field(..., description="AzureOpenai or Openai")
|
api_type: str = Field(..., description="AzureOpenai or Openai")
|
||||||
api_version: str = Field(..., description="Azure Openai version if AzureOpenai")
|
api_version: str = Field(..., description="Azure Openai version if AzureOpenai")
|
||||||
|
|
||||||
|
|
||||||
class AppConfig(BaseModel):
|
class AppConfig(BaseModel):
|
||||||
llm: Dict[str, LLMSettings]
|
llm: Dict[str, LLMSettings]
|
||||||
|
|
||||||
@ -79,7 +80,6 @@ class Config:
|
|||||||
"temperature": base_llm.get("temperature", 1.0),
|
"temperature": base_llm.get("temperature", 1.0),
|
||||||
"api_type": base_llm.get("api_type", ""),
|
"api_type": base_llm.get("api_type", ""),
|
||||||
"api_version": base_llm.get("api_version", ""),
|
"api_version": base_llm.get("api_version", ""),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config_dict = {
|
config_dict = {
|
||||||
|
@ -2,11 +2,11 @@ from typing import Dict, List, Literal, Optional, Union
|
|||||||
|
|
||||||
from openai import (
|
from openai import (
|
||||||
APIError,
|
APIError,
|
||||||
|
AsyncAzureOpenAI,
|
||||||
AsyncOpenAI,
|
AsyncOpenAI,
|
||||||
AuthenticationError,
|
AuthenticationError,
|
||||||
OpenAIError,
|
OpenAIError,
|
||||||
RateLimitError,
|
RateLimitError,
|
||||||
AsyncAzureOpenAI
|
|
||||||
)
|
)
|
||||||
from tenacity import retry, stop_after_attempt, wait_random_exponential
|
from tenacity import retry, stop_after_attempt, wait_random_exponential
|
||||||
|
|
||||||
@ -44,12 +44,10 @@ class LLM:
|
|||||||
self.client = AsyncAzureOpenAI(
|
self.client = AsyncAzureOpenAI(
|
||||||
base_url=self.base_url,
|
base_url=self.base_url,
|
||||||
api_key=self.api_key,
|
api_key=self.api_key,
|
||||||
api_version=self.api_version
|
api_version=self.api_version,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.client = AsyncOpenAI(
|
self.client = AsyncOpenAI(api_key=self.api_key, base_url=self.base_url)
|
||||||
api_key=self.api_key, base_url=self.base_url
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def format_messages(messages: List[Union[dict, Message]]) -> List[dict]:
|
def format_messages(messages: List[Union[dict, Message]]) -> List[dict]:
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import asyncio
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import aiofiles
|
import aiofiles
|
||||||
@ -58,4 +57,3 @@ The tool accepts content and a file path, and saves the content to that location
|
|||||||
return f"Content successfully saved to {file_path}"
|
return f"Content successfully saved to {file_path}"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f"Error saving file: {str(e)}"
|
return f"Error saving file: {str(e)}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user