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: Proof of Pizza - Agentic Dominos Ordering #1005

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

ropresearch
Copy link
Collaborator

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

@ropresearch ropresearch marked this pull request as ready for review December 12, 2024 06:35
@chandognft
Copy link

wow

@odilitime odilitime changed the base branch from main to develop December 12, 2024 07:19
Base automatically changed from develop to main December 13, 2024 02:37
@monilpat monilpat changed the base branch from main to develop December 13, 2024 04:26
Copy link
Collaborator

@monilpat monilpat left a 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);
Copy link
Collaborator

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({
Copy link
Collaborator

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

Copy link

@den0xR den0xR Dec 16, 2024

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 = `
Copy link
Collaborator

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 = (
Copy link
Collaborator

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,
Copy link
Collaborator

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);
Copy link
Collaborator

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: [
Copy link
Collaborator

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 (
Copy link
Collaborator

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: [
[
Copy link
Collaborator

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 = `
Copy link
Collaborator

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

@monilpat
Copy link
Collaborator

And merge conflicts :)

@monilpat
Copy link
Collaborator

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 :)

@ropresearch
Copy link
Collaborator Author

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!

@monilpat
Copy link
Collaborator

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 :)

Base automatically changed from develop to main December 13, 2024 19:07
@wtfsayo wtfsayo changed the base branch from main to develop January 6, 2025 17:23
Comment on lines 43 to 48
const match = text
.split('\n')[0]
.trim()
.replace("[", "")
.toUpperCase()
.replace("]", "")

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of "]".

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.

Suggested changeset 1
packages/core/src/parsing.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/core/src/parsing.ts b/packages/core/src/parsing.ts
--- a/packages/core/src/parsing.ts
+++ b/packages/core/src/parsing.ts
@@ -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);
EOF
@@ -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);
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
packages/core/src/parsing.ts Dismissed Show dismissed Hide dismissed
@wtfsayo wtfsayo added the testing label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants