Skip to main content

No project description provided

Project description

API Assistant

The API assistant is a ChatGPT assistant on top of an OpenAI IDL json file. The CLI will based on prompts find the correct request and send it with the provided arguments.

You can run the CLI from your terminal with

api-chat --idl=<OPENAI_IDL_PATH>

Installation

The tool is available at pypi and can be installed using pip

pip install api-assistant

Extra - convert a swagger to OpenAI IDL

If you have generated a swagger (OpenAPI) for you API then you can use the s2o (swagger to openai) tool to convert it to a OpenAI IDL format. The tool can be installed with the cargo CLI that follows the rust installation.

If you have cargo installed then you can install it with

cargo install s2o

In order to interact with the cli there are some environment variables that needs to be present.

Environment variables - REQUIRED

  • OPENAI_API_KEY: An OpenAI api key
  • HOST: The host of the API that you wish to query. Ex: http://localhost:8000
  • ASSISTANT_INSTRUCTIONS: A description (prompt) to the assistant of its purpose. Ex: For a payments api a typical instruction could be "ou are a wrapper around a payments api. Use the provided endpoints to answer user questions. Sometimes functions has to be combined to achieve the intended result."

CLI Arguments

There is only one argument to the CLI itself

  • idl: The path to the OpenAI IDL json. Ex: api-chat --idl=./idls/openai.idl.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

api_assistant-0.4.0.tar.gz (14.0 kB view hashes)

Uploaded Source

Built Distribution

api_assistant-0.4.0-cp310-cp310-macosx_11_0_arm64.whl (284.8 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page