From 847f4bbaef017c842c2b9661cb484ca5b9fc8069 Mon Sep 17 00:00:00 2001 From: Steve Androulakis Date: Mon, 26 May 2025 14:13:59 -0700 Subject: [PATCH] Review dallastexas92 nostripekey (#35) * Update setup.md Detail that the stripe key must be commented out in order to create a dummy invoice * Update create_invoice.py Remove the example invoice function as the 'else' statement already captures this * Update setup.md Edited verbiage for the create invoice explanation * cover empty stripe api env --------- Co-authored-by: Dallas Young <33672687+dallastexas92@users.noreply.github.com> --- setup.md | 4 ++-- tools/create_invoice.py | 14 +------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/setup.md b/setup.md index 57400af..61cbaad 100644 --- a/setup.md +++ b/setup.md @@ -166,7 +166,7 @@ Here is configuration guidance for specific goals. Travel and financial goals ha * Requires a Stripe key for the `create_invoice` tool. Set this in the `STRIPE_API_KEY` environment variable in .env * It's free to sign up and get a key at [Stripe](https://stripe.com/) * Set permissions for read-write on: `Credit Notes, Invoices, Customers and Customer Sessions` - * If you're lazy go to `tools/create_invoice.py` and replace the `create_invoice` function with the mock `create_invoice_example` that exists in the same file. + * If you don't have a Stripe key, comment out the STRIPE_API_KEY in the .env file, and a dummy invoice will be created rather than a Stripe invoice. The function can be found in `tools/create_invoice.py` ### Goal: Find a Premier League match, book train tickets to it and invoice the user for the cost (Replay 2025 Keynote) - `AGENT_GOAL=goal_match_train_invoice` - Focuses on Premier League match attendance with train booking and invoice generation @@ -252,4 +252,4 @@ For more details, check out [adding goals and tools guide](./adding-goals-and-to [ ] `cd frontend`, `npm install`, `npx vite`
[ ] Access the UI at `http://localhost:5173`
-And that's it! Happy AI Agent Exploring! \ No newline at end of file +And that's it! Happy AI Agent Exploring! diff --git a/tools/create_invoice.py b/tools/create_invoice.py index 9fcd1aa..3084845 100644 --- a/tools/create_invoice.py +++ b/tools/create_invoice.py @@ -27,7 +27,7 @@ def ensure_customer_exists( def create_invoice(args: dict) -> dict: """Create and finalize a Stripe invoice.""" # If an API key exists in the env file, find or create customer - if stripe.api_key is not None: + if stripe.api_key is not None and stripe.api_key != "": customer_id = ensure_customer_exists( args.get("customer_id"), args.get("email", "default@example.com") ) @@ -69,15 +69,3 @@ def create_invoice(args: dict) -> dict: "invoiceURL": "https://pay.example.com/invoice/12345", "reference": "INV-12345", } - -def create_invoice_example(args: dict) -> dict: - """ - This is an example implementation of the CreateInvoice tool - Doesn't call any external services, just returns a dummy response - """ - print("[CreateInvoice] Creating invoice with:", args) - return { - "invoiceStatus": "generated", - "invoiceURL": "https://pay.example.com/invoice/12345", - "reference": "INV-12345", - }