Git Product home page Git Product logo

api-pilot's Introduction

API Chat

Crates.io PyPI - Version

Chat with your API!

Note: The swagger to OpenAI IDL conversion only supports swagger2. The implementation is found in swagger_to_openai

Local usage

To get started

Requirements

  • OpenAI API key in .env.example - OPENAI_API_KEY
  • A swagger2 file.
  • (optional) A web server to run the requests against - HOST
  • (optional) Docker if you wish to run against the mock-api
  • (optional) Rust if you wish to develop on the swagger to openai idl project (s2o).

Setup

1. Set the Environment variables

The necessary environment variables is defined in .env.example. 2. Create a python >= 3.12 environement.

2 Set up python virtual environment

In order to run the cli-chat you need python 3.12 or later installed. Best practise is to create a virtual environment using commands python3 -m venv assistant. On unix systems it's possible to run python3 --version to get the current python3 version. If the version is below 3.12 you likely need to download it. If after installing the latest python3 you still get the old version when you run python3 --version then you need to symlink the python3 version to the lastest download. This can be done like this

    > PYTHON_PATH=$(which python3.12)
    > ln -s $PYTHON_PATH /usr/bin/python3

There's also a just recipe for creating a venv.

3 Build and run project

Please follow the guide in the cli-chat readme to get up and running.

Package usage

It is also possible to use the project without running it locally. This can be done by installing the api-assistant using pip.

pip install api-assistant

Interact with your API

You are now ready to run the assistant against your swagger.

An example is to generate a swagger from the mock-api and run it locally using docker.

    > api-chat --swagger ../idls/swagger_2/swagger.json

Project structure

The project is structured in separate folder where some of the project depends on each other. The projects are

  • ๐Ÿšง api-chat: Exposes the api chat through a flask api. This is still under construction.
  • swagger_to_openai: The engine that converts Swagger2 (OpenAPI) to the OpenAI IDL expected as input to the assistant. Note Swagger3 -> OpenAI IDL is still in ๐Ÿšง
  • cli-chat: Allows users to chat with a OpenAI IDL in the terminal.
  • mock-api: A basic go rest api that can be used to generate swagger and also used as a web server for the cli chat.
  • idls: A scratch area for IDLs and Swaggers to be tested with the cli-chat.

Support

Please file an issue if any of the above operations fails and we will support you as soon as possible.

api-pilot's People

Contributors

0xksure avatar

Watchers

 avatar

Forkers

erlendr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.