JSPM

  • Created
  • Published
  • Downloads 1600
  • Score
    100M100P100Q112924F
  • License MIT

Package Exports

  • @statelyai/agent
  • @statelyai/agent/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@statelyai/agent) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Stately Agent (alpha)

🚧 Documentation in progress! Please see the examples directory for working examples.

Installation

Install openai, and @statelyai/agent:

npm install openai @statelyai/agent

Usage

Work in progress. For now, see the examples:

  • Joke generator
    • Demonstrates agent.fromChatCompletion(...) to generate a joke and provide a joke rating
    • Demonstrates agent.fromEvent(...) to choose whether to keep generating jokes or stop
  • Tic-tac-toe
    • Demonstrates agent.fromEvent(...) to have an agent play itself in a game of tic-tac-toe with precise events
    • Demonstrates agent.fromChatCompletionStream(...) to produce a game report at the end of the game
  • Weather
    • Demonstrates using Tavily as an external API
    • Demonstrates agent.fromEvent(...) to only use Tavily to get the weather if the user provides a valid location

Examples

First, clone this repo locally. To run the examples in this repo, create a .env file at the root of the repo with the following contents:

OPENAI_API_KEY="your-openai-api-key"

Then, install the dependencies (npm install) and run the examples:

npm run example joke
# or:
# npm run example ticTacToe