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

How to save/extract executed code #83

Closed
Lodimup opened this issue Jan 6, 2025 · 1 comment
Closed

How to save/extract executed code #83

Lodimup opened this issue Jan 6, 2025 · 1 comment

Comments

@Lodimup
Copy link

Lodimup commented Jan 6, 2025

Is it possible to save the executed code? It's already in the log. It will be very useful.
ex.

╭─ Executing this code: ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│    1 attractions_list = [                                                                                                                    │
│    2     ["Attraction", "Description"],                                                                                                      │
│    3     ["Sensoji Temple", "The oldest temple in Tokyo, offering beautiful architecture and a rich history."],                              │
│    4     ["Nakamise Shopping Street", "A historic shopping street with souvenirs and traditional snacks."],                                  │
│    5     ["Kibi Dango", "A traditional rice cake snack available at Nakamise Street."],                                                      │
│    6     ["Asakusa Jinja", "A historic Shinto shrine that survived the bombings during WWII."],                                              │
│    7     ["Kimono Experience", "Rent a kimono and walk around Asakusa."],                                                                    │
│    8     ["Asakusa Culture Tourist Information Center", "A building with unique architecture, great for photos."],                           │
│    9     ["Tokyo Skytree", "The tallest structure in Tokyo, offering panoramic views."],                                                     │
│   10     ["Hanayashiki", "Japan’s oldest amusement park with nostalgic charm."],                                                             │
│   11     ["Demboin Garden", "A serene Japanese garden adjacent to Sensoji Temple."],                                                         │
│   12     ["Azuma-bashi Bridge", "An iconic bridge offering views of the Tokyo Skytree."]                                                     │
│   13 ]                                                                                                                                       │
│   14                                                                                                                                         │
│   15 # Convert the list to CSV format (string)                                                                                               │
│   16 csv_data = "\n".join([",".join(row) for row in attractions_list])                                                                       │
│   17                                                                                                                                         │
│   18 # Save the CSV data to file                                                                                                             │
│   19 save_csv(data=csv_data, filename='asakusa_trip.csv')                                                                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@aymeric-roucher
Copy link
Collaborator

You can extract the code action from a step's tool_call attribute:
For instance:
agent.logs[2].tool_call.arguments

@Lodimup Lodimup closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants