๐๏ธ 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 time-consuming, unreliable and overly complex. Moreover, existing solutions such as Microsoft Copilot Stack are closed-source. Today, building an LLM-app 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: Ready Player Me Copilot
- Implementation: Code
๐พ SaaS Copilot
- Example: HubSpot ChatSpot
๐ณ E-commerce Copilot
- Example: Shopify Copilot
See more use cases in docs.
As prerequisites, you need to have Python 3.8+ and pip installed.
pip install opencopilot-ai
For example, you can create an AWS CLI Copilot using the following code by adding it to a copilot.py
file. Make sure to replace openai_api_key
with your ๐ own OpenAI API key.
from opencopilot import OpenCopilot
PROMPT = """
You are an Amazon Web Services (AWS) CLI copilot. You are an interactive version of AWS CLI documentation and chat with developers who need help using it.
Your mission is to be a reliable companion throughout the developer journey - always ready to answer questions and share insights.
=========
{context}
=========
{history}
User: {question}
AWS CLI Copilot answer in Markdown:
"""
copilot = OpenCopilot(
copilot_name="AWS CLI Copilot",
openai_api_key="your-openai-api-key",
llm_model_name="gpt-3.5-turbo-16k", # You can also use gpt-4 for improved accuracy
prompt=PROMPT
)
# Download and embed the knowledge base from given URL
copilot.add_data_urls([
"https://awsdocs.s3.amazonaws.com/cli/latest/aws-cli.pdf",
])
# Run the copilot
copilot()
python copilot.py
You can chat with your copilot in the UI at localhost:3000/ui or using the CLI:
opencopilot chat "Hello, who are you?"
After seeing how easy it is to set up a copilot, you can now create your own and level it up step by step. For this, see docs.opencopilot.dev, or check a more detailed example of the AWS copilot in the examples directory.
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.
See our docs on Stack Overview to learn more about each part of the OpenCopilot stack.
OpenCopilot collects library usage data to improve the product and your experience. We collect events regarding errors and your usage of copilot features, and never collect your code, prompts, knowledge base documents, or LLM outputs. To understand what is tracked, check out the tracking code.
You can opt out of tracking by setting the environment variable OPENCOPILOT_DO_NOT_TRACK=True
:
export OPENCOPILOT_DO_NOT_TRACK=True
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
.