Spaces:
Sleeping
Sleeping
Update functions.py
Browse files- functions.py +13 -13
functions.py
CHANGED
@@ -120,7 +120,7 @@ def get_podcast_summary(podcast_transcript):
|
|
120 |
def get_podcast_guest(podcast_transcript):
|
121 |
'''Get guest name, professional title, organization name'''
|
122 |
|
123 |
-
|
124 |
model="gpt-3.5-turbo-16k",
|
125 |
messages=[{"role": "user", "content": podcast_transcript}],
|
126 |
functions=[
|
@@ -151,20 +151,20 @@ def get_podcast_guest(podcast_transcript):
|
|
151 |
function_call={"name": "get_podcast_guest_information"}
|
152 |
)
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
|
167 |
-
|
168 |
|
169 |
@st.cache_data
|
170 |
def get_podcast_highlights(podcast_transcript):
|
|
|
120 |
def get_podcast_guest(podcast_transcript):
|
121 |
'''Get guest name, professional title, organization name'''
|
122 |
|
123 |
+
completion = openai.ChatCompletion.create(
|
124 |
model="gpt-3.5-turbo-16k",
|
125 |
messages=[{"role": "user", "content": podcast_transcript}],
|
126 |
functions=[
|
|
|
151 |
function_call={"name": "get_podcast_guest_information"}
|
152 |
)
|
153 |
|
154 |
+
podcast_guest = ""
|
155 |
+
podcast_guest_org = ""
|
156 |
+
podcast_guest_title = ""
|
157 |
+
response_message = completion["choices"][0]["message"]
|
158 |
+
|
159 |
+
if response_message.get("function_call"):
|
160 |
|
161 |
+
function_name = response_message["function_call"]["name"]
|
162 |
+
function_args = json.loads(response_message["function_call"]["arguments"])
|
163 |
+
podcast_guest=function_args.get("guest_name")
|
164 |
+
podcast_guest_org=function_args.get("guest_organization")
|
165 |
+
podcast_guest_title=function_args.get("guest_title")
|
166 |
|
167 |
+
return (podcast_guest,podcast_guest_org,podcast_guest_title)
|
168 |
|
169 |
@st.cache_data
|
170 |
def get_podcast_highlights(podcast_transcript):
|