Skip to content

Conversation

@bscheurm
Copy link
Collaborator

Added Jupyter notebook and helper scripts to enable getting conversations data from a Cosmos DB and creating an Excel spreadsheet for analysis.


return container

def got_conversations(start_date = None, end_date = None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gOt conversations ? :D

def extend_dataframe(df):
# "Promote" the content form the user_query and chat_response columns to the top level of the dataframe
df['user_input'] = df['user_query'].apply(lambda x: x['content'] if pd.notnull(x) and 'content' in x else None)
df['answer'] = df['chat_response'].apply(lambda x: x['choices'][0]['messages'][0]['content'] if pd.notnull(x) and 'choices' in x and len(x['choices']) > 0 and 'messages' in x['choices'][0] and len(x['choices'][0]['messages']) > 0 and 'content' in x['choices'][0]['messages'][0] else None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to check for message count>0 and choice count > 0 here before extracting ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe all the needed checks are there. I formatted it across multiple lines for readability. Please let me know if this covers your concern.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sorry about that.. readable now

lakshmicas
lakshmicas previously approved these changes Jan 31, 2024
lakshmicas
lakshmicas previously approved these changes Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants