@brian-ai/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.3.7 • Public • Published

@brian-ai/sdk

Welcome to the official repository for the Brian Typescript SDK.

📦 Installation

The Brian SDK is available as an npm package. In order to add it to your project, you need to run one of the following commands:

# Using npm
npm install @brian-ai/sdk

# Using yarn
yarn add @brian-ai/sdk

# Using pnpm
pnpm add @brian-ai/sdk

# Using bun
bun add @brian-ai/sdk

⚒️ Usage

Once you have it installed in your project, you just need to import it and instantiate a new BrianSDK object:

// Using ES6 imports
import { BrianSDK } from "@brian-ai/sdk";

const options = {
  apiKey: process.env.BRIAN_API_KEY,
};

const brian = new BrianSDK(options);

// Using CommonJS imports
const { BrianSDK } = require("@brian-ai/sdk");

const brian = new BrianSDK(options);

⚙️ SDK initialization options

The BrianSDK constructor accepts an object with the following properties:

Property Type Description Required
apiUrl string The API url you'll be calling. Default is https://api.brianknows.org for EU based projects. YOu can change it with https://us-api.brianknows.org for better latency in the US.
apiKey string The API key used to call the Brian APIs.
apiVersion v0 The API version. Only v0 is available right now.

📚 SDK methods

The BrianSDK object exposes the following methods:

Method name Description
ask Calls the Brian API /agent/knowledge method. Returns an AI-generated for the given prompt.
extract Calls the Brian API /agent/parameters-extraction method. Returns the extracted parameters from the given prompt
generateCode Calls the Brian API /agent/smart-contracts method. Returns an AI-generated Solidity Smart Contract based on the prompt.
transact Calls the Brian API /agent/transaction method. Returns one or more transactions ready to be executed, generated from the given prompt.

📖 Examples

Check the tests/index.tests.ts file to see some examples on how to use the SDK.

🤝 Changelog

Check the CHANGELOG for the latests changes in the SDK.

🛡️ License

This project is licensed under the terms of the MIT license. See LICENSE for more details.

‼️ Disclaimer

This code is being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the code. It has not been audited and as such there can be no assurance it will work as intended, and users may experience delays, failures, errors, omissions or loss of transmitted information. Nothing in this repo should be construed as investment advice or legal advice for any particular facts or circumstances and is not meant to replace competent counsel. It is strongly advised for you to contact a reputable attorney in your jurisdiction for any questions or concerns with respect thereto. Brian is not liable for any use of the foregoing, and users should proceed with caution and use at their own risk.

Package Sidebar

Install

npm i @brian-ai/sdk

Weekly Downloads

232

Version

0.3.7

License

MIT

Unpacked Size

195 kB

Total Files

11

Last publish

Collaborators

  • brian-admin