Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/superagent-ai/superagent-js
Superagent Javascript SDK
https://github.com/superagent-ai/superagent-js
agent ai javascript llm superagent
Last synced: 6 days ago
JSON representation
Superagent Javascript SDK
- Host: GitHub
- URL: https://github.com/superagent-ai/superagent-js
- Owner: superagent-ai
- Created: 2023-05-19T18:24:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-23T06:41:26.000Z (6 months ago)
- Last Synced: 2024-10-06T02:05:12.790Z (about 1 month ago)
- Topics: agent, ai, javascript, llm, superagent
- Language: TypeScript
- Homepage: https://docs.superagent.sh
- Size: 1.27 MB
- Stars: 91
- Watchers: 4
- Forks: 31
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Superagent JavaScript SDK 🥷
### The open framework for building AI Assistants
[![npm shield](https://img.shields.io/npm/v/superagentai-js)](https://www.npmjs.com/package/superagentai-js)
-----
Superagent is an open source framework that enables any developer to integrate production ready AI Assistants into any application in a matter of minutes.
-----
## Installation
Add this dependency to your project's build file:
```bash
npm install superagentai-js
# or
yarn add superagentai-js
```## Usage
```ts
import { Superagent, SuperAgentClient } from "superagentai-js";const client = new SuperAgentClient(token="API_TOKEN")
const agent = await client.agent.create({
name: "My Agent",
description: "My Awesome Agent",
isActive: True,
llmModel: "GPT_4_1106_PREVIEW",
promprt: "You are a helpful assistant"
});output = await client.agent.invoke(agent.data.id, {
input: "Hi there!",
enableStreaming: false,
sessionId: "123",
});console.log("Received response from superagent", agent.data)
```## Handling Exceptions
All exceptions thrown by the SDK will sublcass [SuperAgentError](./src/errors/SuperAgentError.ts).
```ts
improt { SuperAgentError } from "superagentai-js";try {
client.agent.invoke(...)
} catch (err) {
if (err instanceof SuperAgentError) {
console.log(err.statusCode);
console.log(err.message);
}
}
```## Acknowledgements
A special thanks to the [Fern](https://buildwithfern.com/) team for all support with the Superagent libraries and SDKs ❤️.
## Beta status
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version. This way, you can install the
same version each time without breaking changes unless you are intentionally looking for the latest version.## Contributing
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved
over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we
will not be able to merge it as-is. We suggest opening an issue first to discuss with us!On the other hand, contributions to the README are always very welcome!