acmeyer / opencopilot

πŸ•ŠοΈ Build and embed open-source AI Copilots into your product with ease

Home Page:https://opencopilot.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  • Join our Discord and ask.
  • Report bugs or feature requests in GitHub issues.
  • Directly email Taivo, Co-founder & CTO of OpenCopilot: taivo@opencopilot.dev.

About

πŸ•ŠοΈ Build and embed open-source AI Copilots into your product with ease

https://opencopilot.dev

License:MIT License


Languages

Language:Python 100.0%