Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 1.47 KB

File metadata and controls

49 lines (35 loc) · 1.47 KB

AI Functions in Typescript - Simple Example

This example Typescript project uses @jumploops/magic to simulate the use of AI functions on a simple set of presidential data.

Features

  • 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)

Installation

  1. Clone this repository
    git clone https://github.com/jumploops/magic-example.git
  2. Install dependencies using npm
    cd magic example
    npm install

Usage

  1. Run the example using the following command:

    npx ts-node president.ts
  2. The output will display information about the presidents, whether they shared the same birth state, and if they were contemporaries.

Example Output

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

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT License