Spaces:
Running
Running
naveenvenkatesh
commited on
Commit
•
079e8aa
1
Parent(s):
39070dd
Update Tags_Extractor.py
Browse files- Tags_Extractor.py +14 -7
Tags_Extractor.py
CHANGED
@@ -7,7 +7,10 @@ class Tags:
|
|
7 |
"""
|
8 |
Initialize the Extractor class.
|
9 |
"""
|
10 |
-
|
|
|
|
|
|
|
11 |
|
12 |
|
13 |
def extract_tags(self,extracted_summary):
|
@@ -25,12 +28,16 @@ class Tags:
|
|
25 |
]
|
26 |
|
27 |
# Call OpenAI GPT-3.5-turbo
|
28 |
-
chat_completion =
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
34 |
response = chat_completion.choices[0].message.content
|
35 |
return response
|
36 |
|
|
|
7 |
"""
|
8 |
Initialize the Extractor class.
|
9 |
"""
|
10 |
+
openai.api_type = os.getenv['api_type']
|
11 |
+
openai.api_base = os.getenv['api_base']
|
12 |
+
openai.api_version = os.getenv['api_version']
|
13 |
+
openai.api_key = os.getenv['api_key']
|
14 |
|
15 |
|
16 |
def extract_tags(self,extracted_summary):
|
|
|
28 |
]
|
29 |
|
30 |
# Call OpenAI GPT-3.5-turbo
|
31 |
+
chat_completion = openai.ChatCompletion.create(
|
32 |
+
engine="ChatGPT",
|
33 |
+
messages = conversation,
|
34 |
+
temperature=0.7,
|
35 |
+
max_tokens=800,
|
36 |
+
top_p=0.95,
|
37 |
+
frequency_penalty=0,
|
38 |
+
presence_penalty=0,
|
39 |
+
stop=None
|
40 |
+
)
|
41 |
response = chat_completion.choices[0].message.content
|
42 |
return response
|
43 |
|