Git Product home page Git Product logo

opencopilot's Introduction

OpenCopilot

๐Ÿ•Š๏ธ OpenCopilot: Build and embed open-source AI Copilots into your product with ease

Unit tests E2E tests Package version Package version Package version

Documentation: docs.opencopilot.dev

Overview

Copilots are becoming the new paradigm how to build successful LLM-based applications, as seen by Github , Shopify, Brex, Hubspot, etc Copilots. Yet, building a Copilot that goes beyond a Twitter demo is extremely complex as it's time-consuming, unreliable and feels like a massive undertaking. Moreover, existing solutions such as Microsoft Copilot Stack are closed-source. Building an LLM-app today feels like:

Author: Soham Chatterjee

OpenCopilot solves this problem so building your own Copilot becomes intuitive, fast and reliable - all so you can build your copilot in a single day. For example, you can build Copilots such as:

๐Ÿ› ๏ธ Developer tooling Copilot

๐Ÿ’พ SaaS Copilot

๐Ÿ’ณ E-commerce Copilot

See more use cases in docs.

OpenCopilot overview

OpenCopilot provides one coherent end-to-end stack which is purposely designed for building a variety of copilots. From LLM selection (OSS LLMs upcoming), knowledge base, monitoring, evaluation, etc - it covers all the needs to build a useful copilot.

opencopilot_stack

Quickstart

As prerequisites, you need to have Python 3.8+ and pip installed.

1. Install the Python package

pip install opencopilot-ai

2. Create a minimal Copilot

Into a Python file (for example, copilot.py), add:

from opencopilot import OpenCopilot

copilot = OpenCopilot(
    openai_api_key="your-openai-api-key",
    llm_model_name="gpt-4",
    prompt_file="my_prompt.txt"
    )

# Run the copilot
copilot()

Make sure your custom prompt file exists: in my_prompt.txt, add the following:

Your are a Parrot Copilot. Your purpose is to repeat what the user says, but in a different wording.

=========
{context}
=========

{history}
User: {question}
Parrot Copilot answer in Markdown:

The template variables will be filled at runtime; see our docs on Prompting if you'd like to learn more.

3. Run the Copilot

python copilot.py

That's it! Your minimal copilot is now running as an API service, at localhost:3000 by default ๐ŸŽ‰

You can chat with it by calling the API:

curl -X 'POST' \
  'http://127.0.0.1:3000/v0/conversation/85ceff11-8072-47c8-a09a-ef846b024c04' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "inputs": "Hi! Who are you?"
}'

See the interactive Swagger docs for full API documentation.

๐Ÿ“– Customizing, improving, testing and deploying your Copilot

Please see the full documentation to:

Optional: front-end

If you'd like to have a front-end for your Copilot, then you can easily deploy it. As a pre-requisite, you need to have pnpm installed.

First, clone the opencopilotdev/opencopilot-frontend repository:

git clone https://github.com/opencopilotdev/opencopilot-frontend

Then, setup the environment variables:

cd opencopilot-frontend
cp .env.example .env

Install the dependencies:

pnpm install

Run the front-end application:

pnpm run dev

You can now access the front-end at http://localhost:3001.

Getting help

If you have any questions about OpenCopilot, feel free to do any of the following:

opencopilot's People

Contributors

kasparpeterson avatar kgrofelnik avatar kristjanpeterson1 avatar johannestk avatar taivop avatar dependabot[bot] 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.