Spaces:
Runtime error
Runtime error
Updated to use key
Browse files
app.py
CHANGED
@@ -7,7 +7,8 @@ from urllib.error import HTTPError
|
|
7 |
default_system = 'You are a helpful assistant.'
|
8 |
|
9 |
API_URL = os.getenv('API_URL')
|
10 |
-
|
|
|
11 |
|
12 |
History = List[Tuple[str, str]]
|
13 |
Messages = List[Dict[str, str]]
|
@@ -41,7 +42,6 @@ def model_chat(query: Optional[str], history: Optional[History]) -> Generator[Tu
|
|
41 |
history = []
|
42 |
messages = history_to_messages(history, system)
|
43 |
messages.append({'role': 'user', 'content': query})
|
44 |
-
oai_client.completions.create()
|
45 |
gen = oai_client.chat.completions.create(
|
46 |
model='dicta-il/dictalm2.0-instruct',
|
47 |
messages=messages,
|
|
|
7 |
default_system = 'You are a helpful assistant.'
|
8 |
|
9 |
API_URL = os.getenv('API_URL')
|
10 |
+
API_KEY = os.getenv('API_KEY')
|
11 |
+
oai_client = openai.OpenAI(api_key=API_KEY, base_url=API_URL)
|
12 |
|
13 |
History = List[Tuple[str, str]]
|
14 |
Messages = List[Dict[str, str]]
|
|
|
42 |
history = []
|
43 |
messages = history_to_messages(history, system)
|
44 |
messages.append({'role': 'user', 'content': query})
|
|
|
45 |
gen = oai_client.chat.completions.create(
|
46 |
model='dicta-il/dictalm2.0-instruct',
|
47 |
messages=messages,
|