Skip to content

debbly/tool-typescript-example-anthropic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anthropic Tool Example - Typescript

terminal image

A simple one page Express app using Anthropic's Tool feature to get the weather using OpenWeather Map. All necessary code is in the app.ts file.

Getting Started

Once you've forked the repository, install all dependencies using:

npm install

Get necessary API keys from Anthropic and OpenWeather. Create a .env file with the following:

ANTHROPIC_API_KEY=
OPENWEATHER_API_KEY=

To start the application:

npm start

Make requests:

curl -X POST -H "Content-Type: application/json" -d '{"message": "What is the weather in SF?"}'

The location is currently hardcoded to be SF, in order to have the application be more flexible you can use the function.ts file as a reference to build out a dynamic location <> weather app (hint, pull out the city, county, and other necessary information to pass to the relevant functions).

While function.ts file is not being used, it is a cleaner way to separate out the tool code and serves as an example of how you can extend this application.

Documentation and Reading

Currently, there isn't much documentation for the feature on Typescript. You can check out some writing about Tool here:

About

Demo using Anthropic tool in typescript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published