adjust code format

This commit is contained in:
liangxinbing 2025-03-08 15:54:23 +08:00
parent 35e3b5d94b
commit dc28e9187b
14 changed files with 25 additions and 28 deletions

View File

@ -24,6 +24,7 @@ class LLMSettings(BaseModel):
api_type: str = Field(..., description="AzureOpenai or Openai")
api_version: str = Field(..., description="Azure Openai version if AzureOpenai")
class AppConfig(BaseModel):
llm: Dict[str, LLMSettings]
@ -79,7 +80,6 @@ class Config:
"temperature": base_llm.get("temperature", 1.0),
"api_type": base_llm.get("api_type", ""),
"api_version": base_llm.get("api_version", ""),
}
config_dict = {

View File

@ -2,11 +2,11 @@ from typing import Dict, List, Literal, Optional, Union
from openai import (
APIError,
AsyncAzureOpenAI,
AsyncOpenAI,
AuthenticationError,
OpenAIError,
RateLimitError,
AsyncAzureOpenAI
)
from tenacity import retry, stop_after_attempt, wait_random_exponential
@ -44,12 +44,10 @@ class LLM:
self.client = AsyncAzureOpenAI(
base_url=self.base_url,
api_key=self.api_key,
api_version=self.api_version
api_version=self.api_version,
)
else:
self.client = AsyncOpenAI(
api_key=self.api_key, base_url=self.base_url
)
self.client = AsyncOpenAI(api_key=self.api_key, base_url=self.base_url)
@staticmethod
def format_messages(messages: List[Union[dict, Message]]) -> List[dict]:

View File

@ -1,4 +1,3 @@
import asyncio
import os
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}"
except Exception as e:
return f"Error saving file: {str(e)}"

View File

@ -1,4 +1,5 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()