Formatting & improving imports

This commit is contained in:
2024-02-23 09:50:43 +01:00
parent aa5c03b17e
commit 32b6b5c42e
40 changed files with 148 additions and 150 deletions

View File

@@ -1,9 +1,7 @@
import openai
import gradio as gr
import openai
import orjson
from abc import ABC, abstractmethod
from .BaseLLMEngine import BaseLLMEngine
OPENAI_POSSIBLE_MODELS = [ # Theese shall be the openai models supporting force_json
@@ -22,15 +20,15 @@ class OpenaiLLMEngine(BaseLLMEngine):
super().__init__()
def generate(
self,
system_prompt: str,
chat_prompt: str,
max_tokens: int = 512,
temperature: float = 1.0,
json_mode: bool = False,
top_p: float = 1,
frequency_penalty: float = 0,
presence_penalty: float = 0,
self,
system_prompt: str,
chat_prompt: str,
max_tokens: int = 512,
temperature: float = 1.0,
json_mode: bool = False,
top_p: float = 1,
frequency_penalty: float = 0,
presence_penalty: float = 0,
) -> str | dict:
response = openai.chat.completions.create(
model=self.model,