Blog

Introducing GPTScript v0.7

June 4, 2024 by craig-jellick

GPTScript v0.7 dropped recently and we wanted to take this time to share its notable changes with you. Read on for details of the features and fixes in this release.

OpenAPI v2 support

Back in v0.4, we introduced OpenAPI support. With that release, we only supported the latest version of OpenAPI – v3. What we’ve found since then is that v2 is still quite common out in the real world. So in this release, we’ve introduced support for OpenAPI v2. You can see our very own Bill Maxwell demo integrating with Digital Ocean’s OpenAPI schema in this past livestream. If you have a Digital Ocean account and want to try out an AI-powered chatbot, checkout Bill’s do-chat project.

Workspace tools removed (and replaced with something better)

In v0.6, we announced new workspace functions. However, we have since realized these tools weren’t quite the right fit. As such, we’ve removed them. Now, you can leverage a workspace in your gptscripts by specifying the workspace context tool like so:

Name: Your Friendly Neighborhood Assistant
Tools: ...
Context: github.com/gptscript-ai/context/workspace
Chat: true

This context will let GPTScript (and the LLM) know that the workspace directory should be preferred for reading and writing files. You can specify a workspace thusly:

gptscript --workspace ~/Documents my-helper.gpt

If you don’t specify a workspace, a temporary one will be created that will be cleaned up once the script exits.

Chat history context tool

Speaking of context tools, we’ve also introduced the history context tool. If you have multiple chat tools in your script, by default when you transition from chatting with one to the next, the history of your previous conversation will be forgotten. To have that history preserved, you just need to include this tool. Here’s a (somewhat silly) example of GPTScript that has multiple chat tools and makes use of this feature:

Name: Joke Teller
Context: my-context
Chat: true

When the user asks you to tell them a joke, use your tools to pick a themed joke to tell. If the user gives you a theme, do your best to use a tool that matches that theme. If the user's theme doesn't match any you have, just tell them a math joke.

---
Name: Pirate Joker
Description: Tells pirate themed jokes
Context: my-context
Chat: true

You are an expert in telling pirate themed jokes. Tell the user pirate themed jokes. Do not call "Pirate Joker" to tell the joke - just come up with one. If they ask you to tell you a joke of a different theme, try to use a different tool.

---
Name: Robot Joker
Description: Tells robot themed jokes
Context: my-context
Chat: true

You are an expert in telling robot themed jokes. Tell the user robot themed jokes. Do not call "Robot Joker" to tell the joke - just come up with one.If they ask you to tell you a joke of a different theme, try to use a different tool.

---
Name: my-context
Description: Sets the context for all tools
Export: Pirate Joker, Robot Joker, Joke Teller
Export Context: github.com/gptscript-ai/context/history

And here’s an example conversation making use of this history context:

$ gptscript --tui context.gpt

  Sure! Just let me know if you have a specific theme in mind for the joke, or if you'd like me to pick one for you.

> Tell me a pirate joke

  Why don't pirates shower before they walk the plank?

  Because they'll just wash up on shore later!

> tell me a robot joke

  Why did the robot go on a diet?

  Because it had too many bytes!

> Remember the pirate joke you told me? Tell me that again but just replace pirate with robot

  Why don't robots shower before they walk the plank?

  Because they'll just wash up on shore later!

To see the difference in behavior with and without this new feature, just comment out the last line of the script.

Housekeeping!

We’ve made several other smaller changes that are worth calling out. Here they are:

  • The default model used is now gpt-4o
  • We’ve cleaned up and expanded the list of models providers we support. See here for details
  • You can now rename tools using as in the Tools line, like so:
    • Tools: github.com/gptscript-ai/browser as my-web-browser. This can help disambiguate similar tools
  • We now collect and log token usage. It will show up like this:
    • 16:12:32 usage [total=290] [prompt=267] [completion=23]
  • We fixed some Windows related bugs that we’re causing Python-based tools to fail

Wrapping Up

That’s it for this overview of the v0.7 release. v0.8 will be coming soon and we’re excited to introduce some new UX features in that release, so keep an eye out! As always, check out the release notes for more details on this release and join us on Discord if you have any questions or feedback.

Releated Articles