-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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: Proof of Pizza - Agentic Dominos Ordering #1005
base: develop
Are you sure you want to change the base?
Conversation
wow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this honestly you are the GOAT for this!
modelClass: ModelClass.LARGE, | ||
}); | ||
|
||
console.log("[PIZZA-GEN][INTERACTIONS CLIENT] PIZZA check response: ", pizzaCheckResponse, " ", currentPost); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for CRUSHING this you are the GOAT for doing this! Can we elizaLogger everywhere instead
${currentPost}` | ||
+ pizzaDecisionFooter; | ||
|
||
const pizzaCheckResponse = await generateText({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Highly recommend using generateObjectV2 which returns a typesafe JSON instead of having the parse the response and hope for the best
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generateObjectV2 doesn't work with Groq, it throws "Error: Unknown model at getEncodingNameForModel". Is that a known thing?
in generateText it's hardcoded to gpt-4o
@@ -282,6 +290,37 @@ export class TwitterInteractionClient { | |||
this.client.saveRequestMessage(message, state); | |||
} | |||
|
|||
const pizzaCheck = ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, should this directly be added to the twitter client and if so should it be configurable as it seems like overkill to always run
@@ -31,6 +36,24 @@ export const parseShouldRespondFromText = ( | |||
: null; | |||
}; | |||
|
|||
export const parsePizzaDecisionFromText = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed if you use generateObjectV2
private readonly menuConfig = { | ||
defaultProductCode: "PIZZA", | ||
basePrices: { | ||
[PizzaSize.SMALL]: 9.99, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in this but would be good to make these fetched from the site re prices
return order; | ||
|
||
} catch (error) { | ||
console.error('Error processing order:', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elizaLogger :)
export const confirmOrder: Action = { | ||
name: "CONFIRM_ORDER", | ||
similes: ["FINALIZE_ORDER", "FINISH_ORDER", "PLACE_ORDER"], | ||
examples: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would recommend adding some
order.status = OrderStatus.CONFIRMED; | ||
await orderManager.saveOrder(userId, order); | ||
|
||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also could use callback here instead
description: "Ends the current pizza order and clears the order data.", | ||
similes: ["END_ORDER", "FINISH_ORDER", "COMPLETE_ORDER", "STOP_ORDER"], | ||
examples: [ | ||
[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the great examples
console.log("Existing order: ", existingOrder); | ||
|
||
// Extract order details from message using LLM | ||
const extractionTemplate = ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would consider moving the template and the schema definition to a new file template to templates.ts and schema to types.ts
And merge conflicts :) |
We may want to test out the different plugins via a quick screengrab. Once again most of these aren't blocking just wanted to share to help! I know you have SO much going on so thanks for taking the time for this @ropresearch :) |
Thanks guys! Yeah a bunch of this bc of how I have my agent set up, will adjust it for the main repo :) Also agree its overkill in the actual twitter client haha, was more for demo purposes! |
Yeah makes total sense! Awesome glad we are aligned! Great work :) |
packages/core/src/parsing.ts
Outdated
const match = text | ||
.split('\n')[0] | ||
.trim() | ||
.replace("[", "") | ||
.toUpperCase() | ||
.replace("]", "") |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 2 days ago
To fix the problem, we need to ensure that all occurrences of the character ]
are replaced in the input string. This can be achieved by using a regular expression with the global flag (g
). This way, the replace
method will replace all occurrences of the specified character in the string.
-
Copy modified line R27 -
Copy modified line R48
@@ -26,3 +26,3 @@ | ||
.toUpperCase() | ||
.replace("]", "") | ||
.replace(/\]/g, "") | ||
.match(/^(RESPOND|IGNORE|STOP)$/i); | ||
@@ -47,3 +47,3 @@ | ||
.toUpperCase() | ||
.replace("]", "") | ||
.replace(/\]/g, "") | ||
.match(/^(YES|NO)$/i); |
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Relates to: PROOF OF PIZZA
Risks
Needing to use ozempic after a few days
Background
What does this PR do?
Modifies the pizza plugin made by Shaw and also provides an example of direct api integration in the Twitter client (this is how I did it)
What kind of change is this?
Code change to a plugin PR and example in the Twitter client.
Also because it's just cool.
Documentation changes needed?
N/A
Testing
The plugin has not been tested, the example for the direct Twitter integration is fully tested and what I did.
Where should a reviewer start?
packages/plugin-pizza and packages/client-twitter/pizza.ts
Gonna link the twitter post lol
https://x.com/ropirito/status/1867013533243769100