ποΈ OpenCopilot: Build and embed open-source AI Copilots into your product with ease
Documentation: docs.opencopilot.dev
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:
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
- Example: Stripe Copilot
- End-to-end example: Ready Player Me Copilot
πΎ SaaS Copilot
- Example: HubSpot ChatSpot
π³ E-commerce Copilot
- Example: Shopify Copilot
See more use cases in docs.
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.
As prerequisites, you need to have Python 3.8+ and pip installed.
pip install opencopilot-ai
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.
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.
Please see the full documentation to:
- Start improving your copilot: customize your copilot by prompting, adding knowledge base, etc.
- Read more about the core features and stack choices of OpenCopilot in Overview.
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.
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
.