Giter VIP home page Giter VIP logo

kb_microservice's Introduction

KB Microservice

The KB Microservice is a Python-based application that provides a simple and efficient way to manage a knowledge base (KB) of articles. It allows users to create, search, and update KB articles through a RESTful API. The service uses OpenAI's GPT model to process and generate the content of the articles.

Endpoint Method Description Parameters Example Request
/create POST Creates a new KB article input: The text for the new KB article { "input": "This is the text for the new KB article." }
/search POST Searches for KB articles query: The search query { "query": "search query" }
/update POST Updates an existing KB article title: The title of the KB article to update
input: The new text for the KB article
{ "title": "Article 1", "input": "This is the updated text for the KB article." }

Setup

  1. Create key_openai.txt and place your API key within.
  2. Create kb/ directory for your KB articles.
  3. Install all requirements in requirements.txt.

Usage

  1. Run kb_microservice.py - this is a Flask app that runs on 999 by default.
  2. Test it using test_kb_service.py to create, search, and update KB articles.

How It Works

The KB Microservice uses Flask, a lightweight web framework for Python, to expose endpoints for creating, searching, and updating KB articles. The service uses YAML files to store the articles, and a directory text file to keep track of all the articles in the knowledge base.

The service uses OpenAI's GPT model to process user inputs and generate the content of the articles. The GPT model is a powerful language model that can generate human-like text based on the input it receives.

Creating KB Articles

To create a KB article, a POST request is made to the /create endpoint with a JSON payload containing the text for the article. The service then uses the GPT model to process the text and generate a JSON object containing the title, description, keywords, and body of the article. The article is then saved as a YAML file in the knowledge base directory.

Searching KB Articles

To search for KB articles, a POST request is made to the /search endpoint with a JSON payload containing the search query. The service first updates the directory of articles, then uses the GPT model to process the query and return a list of relevant article filenames. The service then opens each file, converts the YAML content to JSON, and returns the list of articles as a JSON response.

Updating KB Articles

To update a KB article, a POST request is made to the /update endpoint with a JSON payload containing the title of the article to update and the new text for the article. The service first opens the existing article, then uses the GPT model to process the new text and generate an updated JSON object for the article. The updated article is then saved back to the knowledge base directory.

Future Work

  1. Daily Journal (episodic memory)
    • Prioritize based on relevance, or temporal proximity
  2. Tasks (like internal Jira or Trello)
    • Prioritize based on ROI or heuristic imperatives (e.g. which tasks will reduce suffering the most, increase prosperity the most, and increase understanding the most)
  3. Dossiers (basically KB article on users)

kb_microservice's People

Contributors

daveshap avatar

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.