This example Typescript project uses @jumploops/magic to simulate the use of AI functions on a simple set of presidential data.
- Fetch information about US presidents
- Determine if two presidents were born in the same state
- Determine if two presidents were contemporaries
- Fetch one random president (AI-powered)
- Fetch two random presidents (AI-powered)
- Clone this repository
git clone https://github.com/jumploops/magic-example.git
- Install dependencies using
npmcd magic example npm install
-
Run the example using the following command:
npx ts-node president.ts
-
The output will display information about the presidents, whether they shared the same birth state, and if they were contemporaries.
Were George Washington and John Adams born in the same state? false
Were George Washington and John Adams contemporaries? true
{ name: 'Thomas Jefferson', birthState: 'Virginia', birthDate: '1743-04-12T22:35:06.343Z', deceasedDate: '1826-07-03T22:35:06.343Z', termStart: 1801, termEnd: 1809 }
Were George Washington and Thomas Jefferson born in the same state? true
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.