Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chat_gpt): compress chats once tasks are completed #366

Merged
merged 3 commits into from
Nov 3, 2023

Conversation

stakach
Copy link
Member

@stakach stakach commented Nov 2, 2023

ensures we have the tokens to continue making requests

ensures we have the tokens to continue making requests
@stakach stakach requested a review from naqvis November 2, 2023 05:42
@github-actions github-actions bot added the type: enhancement new feature or request label Nov 2, 2023
@stakach
Copy link
Member Author

stakach commented Nov 2, 2023

example request and response

please cancel todays 5pm meeting
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Schedule.get_my_schedule({\"email\" => \"[email protected]\", \"start\" => \"2023-11-02T00:00:00\", \"end\" => \"2023-11-02T23:59:59\"})","type":"progress","function":"call_function","usage":{"prompt_tokens":817,"completion_tokens":83,"total_tokens":900}}
{"chat_id":"chats-G5tr54Bhb7","message":"checking Schedule capabilities","type":"progress","function":"list_function_schemas","usage":{"prompt_tokens":928,"completion_tokens":17,"total_tokens":945}}
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Schedule.my_schedule({\"day_offset\" => 0})","type":"progress","function":"call_function","usage":{"prompt_tokens":2116,"completion_tokens":38,"total_tokens":2154}}
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Schedule.cancel({\"event_id\" => \"AAkALgAAAAAAHYQDEapmEc2byACqAC-EWg0ApV810214AkKuCMYmDwSNcAAAn0Bb1gAA\"})","type":"progress","function":"call_function","usage":{"prompt_tokens":2375,"completion_tokens":79,"total_tokens":2454}}
{"chat_id":"chats-G5tr54Bhb7","message":"condensing progress: Cancelled the meeting scheduled for today at 5pm","type":"progress","function":"task_complete","usage":{"prompt_tokens":2472,"completion_tokens":24,"total_tokens":2496},"compressed_usage":817}
{"chat_id":"chats-G5tr54Bhb7","message":"I've taken care of the 5pm meeting scheduled for today; it's now cancelled. Is there anything else you need assistance with today?","type":"response","usage":{"prompt_tokens":840,"completion_tokens":30,"total_tokens":870},"compressed_usage":870}
yes, could you please book a meeting for 6pm?
{"chat_id":"chats-G5tr54Bhb7","message":"checking Schedule capabilities","type":"progress","function":"list_function_schemas","usage":{"prompt_tokens":917,"completion_tokens":17,"total_tokens":934}}
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Schedule.get_schedules({\"emails\" => [\"[email protected]\"], \"day_offset\" => 0})","type":"progress","function":"call_function","usage":{"prompt_tokens":2105,"completion_tokens":56,"total_tokens":2161}}
{"chat_id":"chats-G5tr54Bhb7","message":"checking Workplace capabilities","type":"progress","function":"list_function_schemas","usage":{"prompt_tokens":2196,"completion_tokens":18,"total_tokens":2214}}
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Workplace.meeting_rooms({\"minimum_capacity\" => 1})","type":"progress","function":"call_function","usage":{"prompt_tokens":2893,"completion_tokens":39,"total_tokens":2932}}
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Workplace.levels({})","type":"progress","function":"call_function","usage":{"prompt_tokens":2978,"completion_tokens":28,"total_tokens":3006}}
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Workplace.meeting_rooms({\"minimum_capacity\" => 1, \"level_id\" => \"zone-Do2HJ00hTG\"})","type":"progress","function":"call_function","usage":{"prompt_tokens":3238,"completion_tokens":55,"total_tokens":3293}}
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Schedule.get_schedules({\"emails\" => [\"[email protected]\", \"[email protected]\", \"[email protected]\", \"[email protected]\", \"[email protected]\"], \"day_offset\" => 0})","type":"progress","function":"call_function","usage":{"prompt_tokens":3657,"completion_tokens":108,"total_tokens":3765}}
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Schedule.create({\"event\" => {\"title\" => \"Meeting\", \"location\" => \"Room 4\", \"host\" => \"Isaiah Langer\", \"attendees\" => [{\"name\" => \"Isaiah Langer\", \"email\" => \"[email protected]\"}, {\"name\" => \"Room 4\", \"email\" => \"[email protected]\", \"resource\" => true}], \"starting\" => \"2023-11-02T18:00:00+11:00\", \"all_day\" => false}})","type":"progress","function":"call_function","usage":{"prompt_tokens":3920,"completion_tokens":168,"total_tokens":4088}}
{"chat_id":"chats-G5tr54Bhb7","message":"performing action: Schedule.create({\"event\" => {\"title\" => \"Meeting\", \"location\" => \"Sydney Room 4\", \"host\" => \"[email protected]\", \"attendees\" => [{\"name\" => \"Isaiah Langer\", \"email\" => \"[email protected]\"}, {\"name\" => \"Sydney Room 4\", \"email\" => \"[email protected]\", \"resource\" => true}], \"starting\" => \"2023-11-02T18:00:00+11:00\", \"ending\" => \"2023-11-02T19:00:00+11:00\", \"all_day\" => false}})","type":"progress","function":"call_function","usage":{"prompt_tokens":4119,"completion_tokens":200,"total_tokens":4319}}
{"chat_id":"chats-G5tr54Bhb7","message":"condensing progress: Booked a meeting for 6pm today in the Sydney Room 4","type":"progress","function":"task_complete","usage":{"prompt_tokens":4538,"completion_tokens":29,"total_tokens":4567},"compressed_usage":917}
{"chat_id":"chats-G5tr54Bhb7","message":"I've secured a booking for a meeting at 6pm today in the Sydney Room 4. What can I assist you with next?","type":"response","usage":{"prompt_tokens":945,"completion_tokens":29,"total_tokens":974},"compressed_usage":974}

Copy link
Contributor

@naqvis naqvis left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added type: enhancement new feature or request and removed type: enhancement new feature or request labels Nov 3, 2023
@github-actions github-actions bot added type: enhancement new feature or request and removed type: enhancement new feature or request labels Nov 3, 2023
@stakach stakach merged commit d74716c into master Nov 3, 2023
8 of 10 checks passed
@stakach stakach deleted the gpt-token-reduction branch November 3, 2023 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement new feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants