gptscript-ai / gptscript

Build AI assistants that interact with your systems
https://gptscript.ai
Apache License 2.0
2.78k stars 245 forks source link

TUI - Chat exits when tool execution encounters errors. #573

Open sangee2004 opened 1 week ago

sangee2004 commented 1 week ago

gptscript version v0.0.0-dev-53f7fbde-dirty

Steps to reproduce the problem:

  1. Chat with the local-files-demo with claude-3-5-sonnet-20240620 provider using the example prompts given in docs - https://docs.gptscript.ai/examples/local-files - gptscript --default-model 'claude-3-5-sonnet-20240620 from github.com/gptscript-ai/claude3-anthropic-provider' --workspace . github.com/gptscript-ai/local-files-demo

`

  1. It tries to use structuredDataQuerier tool for Can you make a cleaned up csv of it? and fails since ".txt" file is not supported.

Yes. Can you make a cleaned up csv of it?

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ Call Arguments:                                                                                                                                                                    
│                                                                                                                                                                                    
│ structuredDataQuerier {"file": "/Users/sangeethahariharan/local-files-demo/sample-data/key_contacts.txt", "prompt": "Clean and structure the key contacts data. Create a table wit.
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

┌──────────────────────────────────────────────────────────────────────────────────────────────┐
│ Call Arguments:                                                                              │
│                                                                                              │
│ loadData {"file": "/Users/sangeethahariharan/local-files-demo/sample-data/key_contacts.txt"} │
└──────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────┐
│ Call Arguments:                                      │
│                                                      │
│ createDatabaseFile {"dbFile": "key_contacts.duckdb"} │
└──────────────────────────────────────────────────────┘

Running create-database-file from github.com/gptscript-ai/structured-data-querier

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Success, The database already exists at /Users/sangeethahariharan/local-files-demo/sample-data/key_contacts.duckdb. │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Call Arguments:                                                                                                                 │
│                                                                                                                                 │
│ readSchema {"dbFile": "key_contacts.duckdb", "file": "/Users/sangeethahariharan/local-files-demo/sample-data/key_contacts.txt"} │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Running read-schema from github.com/gptscript-ai/structured-data-querier

┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ Error, Unsupported file type. Please provide a .json, .ndjson, .jsonl, .csv, or .xlsx file. │
└─────────────────────────────────────────────────────────────────────────────────────────────┘
                                                                                               2024/06/26 16:19:27 ERROR: Error, Unsupported file type. Please provide a .json, .ndjson, .jsonl, .csv, or .xlsx file.

: exit status 1

In this case , if I instruct the LLM to use read tool specifically it would succeed like Can you make a cleaned up csv of it? Use read tool for this. .

Expected Behavior: Error should be presented to the user and he should still be present in the context of chat so that they are able to alter the chat messages and move forward.

njhale commented 5 days ago

Reproduced this on v0.9.1 and have some notes: