chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
from .query_data import query_data
|
||||
from .todos import manage_todos, Todo
|
||||
|
||||
__all__ = ["query_data", "manage_todos", "Todo"]
|
||||
@@ -0,0 +1,16 @@
|
||||
date,category,amount,type
|
||||
2026-01-05,Food,42.50,expense
|
||||
2026-01-10,Transport,15.00,expense
|
||||
2026-01-15,Salary,3500.00,income
|
||||
2026-01-20,Entertainment,80.00,expense
|
||||
2026-01-25,Utilities,120.00,expense
|
||||
2026-02-03,Food,55.20,expense
|
||||
2026-02-08,Freelance,800.00,income
|
||||
2026-02-14,Dining,65.00,expense
|
||||
2026-02-20,Transport,22.50,expense
|
||||
2026-02-28,Salary,3500.00,income
|
||||
2026-03-05,Groceries,95.40,expense
|
||||
2026-03-10,Gym,40.00,expense
|
||||
2026-03-15,Salary,3500.00,income
|
||||
2026-03-18,Coffee,18.75,expense
|
||||
2026-03-22,Books,35.00,expense
|
||||
|
@@ -0,0 +1,21 @@
|
||||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import csv
|
||||
import os
|
||||
from strands import tool
|
||||
|
||||
|
||||
@tool
|
||||
def query_data(query: str) -> str:
|
||||
"""
|
||||
Query financial data from the database. Use this tool to fetch data before
|
||||
rendering any charts. Returns CSV-formatted data relevant to the query.
|
||||
"""
|
||||
db_path = os.path.join(os.path.dirname(__file__), "db.csv")
|
||||
try:
|
||||
with open(db_path, "r") as f:
|
||||
content = f.read()
|
||||
return content
|
||||
except FileNotFoundError:
|
||||
return "No data available."
|
||||
@@ -0,0 +1,23 @@
|
||||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
from typing import Literal, TypedDict
|
||||
|
||||
from strands import tool
|
||||
|
||||
|
||||
class Todo(TypedDict):
|
||||
id: str
|
||||
title: str
|
||||
description: str
|
||||
emoji: str
|
||||
status: Literal["pending", "completed"]
|
||||
|
||||
|
||||
@tool
|
||||
def manage_todos(todos: list) -> str:
|
||||
"""
|
||||
Manage the current todos. Replaces the entire todo list.
|
||||
Each todo should have: id (str), title (str), description (str), emoji (str), status ('pending' or 'completed').
|
||||
"""
|
||||
return "Todos updated successfully"
|
||||
Reference in New Issue
Block a user