unico-js
v0.1.0
Published
A Javascript library to interact with the UNICO API.
Readme
UNICO JavaScript Library
A JavaScript library to interact with the UNICO API. This library allows developers to easily integrate their applications with the UNICO platform by providing a simple interface to the available API endpoints. With just an API key, users can authenticate and start interacting with UNICO services, including retrieving available agents, add contexts and generating completions.
Getting Started
npm i unico-jsCreate a client
- Default environment (production):
const client = new UnicoClient("your-unico-api-key");- Point to another UNICO environment (develop purpouses only):
const client = new UnicoClient("your-unico-api-key", "your-unico-api-base-url");Retrieve your agents
const agents: Agent[] = await client.agents.retrieve();
console.log(agents);Create a completion
const completion: Completion = await client.agents.completions.create("agent-id", "Hello World!");
console.log(completion);Add contexts to an agent
await client.agents.contexts.create("agent-id", ["context 1", "context 2"]);Development
Install nvm (node version manager):
Use the same node version from the
.nvmrcfile:- For Windows:
nvm use $(Get-Content .nvmrc) - For Other Systems:
nvm use
- For Windows:
Install the necessary packages:
npm install
Before pushing
- See if you have any rebase to do (you must have the updated commits history before pushing to avoid conflicts between main and your branch):
git fetch
git pull origin main --rebase- Dry run npm publish to check if your code will be deployed:
npm publish --dry-run- Check for vulnerabilities to avoid security issues:
npm audit --audit-level=high- Lint your code to avoid ESLint errors (if the following command return errors or warnings you must resolve them before pushing):
npm run lint- Update the library version based on your changes (make sure to commit the changes before running the following command):
npm version patchContributing
If you want to contribute to UNICO JavaScript Library, follow these steps:
- Create a new branch for your changes (
git checkout -b your-branch-name). - Make your changes and commit them (
git commit -m 'Changed something'). - Push your branch (
git push origin your-branch-name). - Open a pull request.
Contact
For more information, contact the UNICO support team at: [email protected]
