New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

function-agents

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

function-agents

A collection of Function Agents with specific purposes, utilizing the OpenAI API.

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-72.22%
Maintainers
1
Weekly downloads
 
Created
Source

function-agents

Introduction

function-agents is a collection of Function Agents with specific purposes, designed to simplify various tasks. To use these agents, you'll need to pass an OpenAI API Key upon construction. This package allows you to interact with different OpenAI agents, transforming unstructured text into a structured JSON response.

For more examples and the full documentation, please visit https://platform.openai.com/docs/guides/gpt/function-calling.

Installation

To install the package, run the following command:

npm install function-agents

Dependencies

  • Node.js
  • OpenAI API Key

Getting Started

Import the package and initialize it as follows:

import { OpenAIDataTransformationAgent } from 'function-agents';

Usage

OpenAIDataTransformationAgent

This agent is responsible for transforming unstructured text into a structured JSON response using OpenAI's API.

import { OpenAIDataTransformationAgent } from 'function-agents';

// Your function definition and system message here.
const functionDefinition = {
  // ...
};

const systemMessage = 'Your system message here';

const agent = new OpenAIDataTransformationAgent(
  'your-openai-api-key',
  'gpt-3.5-turbo-0613',
  functionDefinition,
  systemMessage
);

const response = await agent.transformer('your unstructured text');
Parameters
  1. openai_api_key: Your OpenAI API Key.
  2. model: The name of the OpenAI model. Must be either gpt-3.5-turbo-0613 or gpt-4-0613 or gpt-4-32k-0613
  3. functionDefinition: The function definition in JSON format.
  4. systemMessage: The system message in string format.
Return Value

The transformer function for OpenAIDataTransformationAgent returns a Promise of type FunctionAgentResponse.

type FunctionAgentResponse = {
  response: any;
  success: boolean;
  error?: unknown;
};

Contributing

We welcome contributions! Please feel free to submit a pull request.

License

This package is under the MIT License. See LICENSE file for more details.

Keywords

FAQs

Package last updated on 27 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc