Skip to content

Instantly share code, notes, and snippets.

@ThisCakeIsALie
Created September 5, 2021 19:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThisCakeIsALie/4fcee6261e97b5ed56db40bed719aede to your computer and use it in GitHub Desktop.
Save ThisCakeIsALie/4fcee6261e97b5ed56db40bed719aede to your computer and use it in GitHub Desktop.
Actionists Demo
import streamlit as st
import openai
import os
import re
openai.api_key = ('YOUR-API-KEY-HERE')
example_meeting = """Ashwin Swarup: Alright, let's let's start then. So, welcome to the Daily call. So I wanted a basic update on where we are on ditto, so mitesh can even brought update on that.
Mitesh Gupta: Oh yeah. So deter we have finally our position was in this Marketplace and we have got our latest app available on the marketplace with the updates, about the installation steps and new screenshots. We are waiting to put a new video so that will get a new release next week. Early next week. Also we're in talk with the Eric, the representative person of Zendesk where he can help us with the marketing of video. I have to reach out to him.
Ashwin Swarup: Yeah I also got a video, the latest video from Anitage looks good. So I sent it for approval to James. So let's see if he approves it, I will send you notes if he does.
Mitesh Gupta: Can you invite me for the next call with James as well?
Ashwin Swarup: Yeah, I will.
Mitesh Gupta: Yeah. I have also seen the Google analytics page for Dito and I've seen around 8 to 15 requests there. People have visited our page.
Ashwin Swarup: That's good as it is only two days since deployment. Let's see how it goes. All right, what's the status on Chiron?
Siddhant Bane: So in terms of testing we have done few unit tests and today we have pushed them. I think we can review them and basically approve our pull requests and we will be done with that. Apart from that we are working on the chat server where as we discussed in yesterday's meeting, we are going to incorporate handoff feature. Also, the scalability issues that we were facing, we're going to address. From that Shashank can update.
Shashank M: Oh yeah. So from my side, I had a few Test cases remaining. And after that, you have also told me to make a few more code changes to the API for the document passing an intense generation. So, we made the remaining changes and I've pushed the code and with the HTTP action file on the HTTP download and upload code, which I had written. So I've put the changes for that as well. So I just have to sit with Throne to make the UI changes. So yeah, so after that I'm done with the unit test case now I just have a few Service Test cases remaining. So once I'm done with that, I'll push it for you to see.
Ashwin Swarup: And the knowledge graph test cases are also done? The part where we were trying to do question augmentation?
Shashank M: Knowledge graph test cases? So it's divided into two parts and the first one, the document passing test cases are all done.
Ashwin Swarup: Yeah.
Shashank M: With the other one which was added the generated intense and responses we were facing a few issues. So we just need to get the edge cases out. So if it's failing we need to give the particular output messages. So yeah, that's almost done.
Ashwin Swarup: All right. Sounds good. Thanks a lot, guys. So, we talk tomorrow then? I will schedule a meeting for 9 am."""
task_prompt = """Give a brief summary what the meeting was about.
---
{}
---
What tasks is {} supposed to do (all future tasks)?
1."""
participant_prompt = """Extract a list of all participants of the following meeting.
---
{}
---
Participants:
-"""
summary_prompt = """Summarize the following meeting.
---
{}
---
Write a paragraph about the meeting:"""
# GPT3 Text to Command
response = openai.Completion.create(
engine="davinci-instruct-beta",
prompt= task_prompt.format(example_meeting, 'Ashwin Swarup'),
temperature=0.15,
max_tokens=100,
top_p=1.0,
frequency_penalty=0.2,
presence_penalty=0.0,
stop=["\n\n"]
)
def get_participants(meeting_text):
response = openai.Completion.create(
engine="davinci-instruct-beta",
prompt=participant_prompt.format(meeting_text),
temperature=0.15,
max_tokens=100,
top_p=1.0,
frequency_penalty=0.2,
presence_penalty=0.0,
stop=["\n\n"]
)
response_text = response["choices"][0]["text"].strip()
names = [raw_name.strip() for raw_name in response_text.split('\n-')]
return names
def get_tasks_for_participant(meeting_text, participant_name):
response = openai.Completion.create(
engine="davinci-instruct-beta",
prompt=task_prompt.format(meeting_text, participant_name),
temperature=0.15,
max_tokens=100,
top_p=1.0,
frequency_penalty=0.2,
presence_penalty=0.0,
stop=["\n\n"]
)
response_text = response["choices"][0]["text"].strip()
tasks = re.split(r'\n\d\. ', response_text)
return tasks
def get_summary(meeting_text):
response = openai.Completion.create(
engine="davinci-instruct-beta",
prompt=summary_prompt.format(meeting_text),
temperature=0.15,
max_tokens=100,
top_p=1.0,
frequency_penalty=0.2,
presence_penalty=0.0
)
response_text = response["choices"][0]["text"].strip()
return response_text
'# Actionist'
meeting_notes = st.text_input('Please provide the transcript.')
run_button = st.button('Go over notes')
if run_button:
with st.spinner('Actionist is loading...'):
meeting_insights = ''
meeting_insights += '## Meeting summary\n'
summary = get_summary(meeting_notes)
meeting_insights += summary + '\n'
participants = get_participants(meeting_notes)
meeting_insights += '## Participants\n'
meeting_insights += ', '.join(participants) + '\n'
meeting_insights += '## Action items\n'
task_view = ''
for participant in participants:
tasks = get_tasks_for_participant(meeting_notes, participant)
task_view += f'* {participant}\n'
task_view += '\n'.join(f' * {task}' for task in tasks)
task_view += '\n'
meeting_insights += task_view
meeting_insights
st.download_button(label='Download meeting insights', data=meeting_insights, file_name='insights.txt', mime='text/plain')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment