Spaces:
Runtime error
Runtime error
Update Tags_Extractor.py
Browse files- Tags_Extractor.py +5 -13
Tags_Extractor.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
-
|
3 |
-
|
|
|
4 |
|
5 |
|
6 |
|
@@ -13,7 +14,7 @@ class Tags:
|
|
13 |
# openai.api_base = os.getenv['api_base']
|
14 |
# openai.api_version = os.getenv['api_version']
|
15 |
# openai.api_key = os.getenv['api_key']
|
16 |
-
|
17 |
|
18 |
|
19 |
def extract_tags(self,extracted_summary):
|
@@ -31,16 +32,7 @@ class Tags:
|
|
31 |
]
|
32 |
|
33 |
# Call OpenAI GPT-3.5-turbo
|
34 |
-
chat_completion =
|
35 |
-
engine="ChatGPT",
|
36 |
-
messages = conversation,
|
37 |
-
temperature=0.7,
|
38 |
-
max_tokens=800,
|
39 |
-
top_p=0.95,
|
40 |
-
frequency_penalty=0,
|
41 |
-
presence_penalty=0,
|
42 |
-
stop=None
|
43 |
-
)
|
44 |
response = chat_completion.choices[0].message.content
|
45 |
return response
|
46 |
|
|
|
1 |
import os
|
2 |
+
from openai import AzureOpenAI
|
3 |
+
|
4 |
+
|
5 |
|
6 |
|
7 |
|
|
|
14 |
# openai.api_base = os.getenv['api_base']
|
15 |
# openai.api_version = os.getenv['api_version']
|
16 |
# openai.api_key = os.getenv['api_key']
|
17 |
+
self.client = AzureOpenAI()
|
18 |
|
19 |
|
20 |
def extract_tags(self,extracted_summary):
|
|
|
32 |
]
|
33 |
|
34 |
# Call OpenAI GPT-3.5-turbo
|
35 |
+
chat_completion = self.client.completions.create(model="ChatGPT", prompt=conversation, max_tokens=500)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
response = chat_completion.choices[0].message.content
|
37 |
return response
|
38 |
|