Explore the docs ยป
Join our Discord
ยท
Website
ยท
Report Bug
ยท
Request Feature
Questions?
Book a call with us ยป
๐ Copilot Chatbot:
Build powerful in-app AI chatbots that can "see" the current app state + take action inside your app.
The AI chatbot can talk to your app frontend & backend, and to 3rd party services (Salesforce, Dropbox, etc.) via plugins.
AI "second brain" for your users, on tap.
๐ <CopilotTextarea />:
AI-assisted text generation. Drop-in replacement for any <textarea />.
Autocompletions + AI editing + generate from scratch. Indexed on your users' content.
Starting with React. Use any LLM.
Combines frontend SDKs, backend SDKs, and (optional) cloud infrastructure. Open-source ๐ช
- โ
A a drop-in
<textarea />
replacement. Supports all<textarea />
customizations. - โ Context-aware autocompletions โจ (like in GitHub Copilot)
- โ AI editing โจ - "list the client's top 3 pain points from the last call using @SalesforceData"
- ๐ฉ Generate from scratch โจ - automatically populate the initial content based on given context
- โ
App context & 3rd party context with
useMakeCopilotReadable
anduseMakeCopilotDocumentReadable
- โ Fully custsomizable prompt engineering
- ๐ฉ Arbitrary LLM chains.
- ๐ฉ Bold + italics.
- โ
Index on frontend app state (via
useMakeCopilotReadable
anduseMakeCopilotDocumentReadable
) - ๐ฉ Index on backend state
- โ
frontend function calling runtime (in-app actions) (via
useMakeCopilotActionable
) - ๐ฉ backend function calling runtime (auth enabled)
- ๐ฉ Autorun vs. "sensitive" functions (require user approval before execution).
- โ Cursor-style @document-referecing.
- โ Bring your own model
- ๐ฉ 3rd party plugins
- ๐ฉ execute arbitrary LLM chains
- ๐ฉ OpenAI assistants api
- โ Fully customize UI
2-min showcase + 2-min implementation tutorial:
copilot_full_demo_nxxpbr.3.mp4
npm i @copilotkit/react-core @copilotkit/react-ui @copilotkit/react-textarea
See quickstart in the docs
A drop-in <textarea /> replacement with context-aware Copilot autocompletions.
- Customizable
purpose
prompt. - Provide arbitrary context to inform autocompletions using
useMakeCopilotReadable
- Works with any backend/LLM, using
ChatlikeApiEndpoint
- Supports all
<textarea />
customizations
import "@copilotkit/react-textarea/styles.css"; // add to the app-global css
import { CopilotTextarea } from "@copilotkit/react-textarea";
import { CopilotProvider } from "@copilotkit/react-core";
// call ANYWHERE in your app to provide external context (make sure you wrap the app with a <CopilotProvider >):
// See below for more features (parent/child hierarchy, categories, etc.)
useMakeCopilotReadable(relevantInformation)
useMakeCopilotDocumentReadable(document)
return (
<CopilotProvider chatApiEndpoint="/api/copilotkit/chat"> {/* Global state & copilot logic. Put this around the entire app */}
<CopilotTextarea
className="p-4 w-1/2 aspect-square font-bold text-3xl bg-slate-800 text-white rounded-lg resize-none"
placeholder="A CopilotTextarea!"
autosuggestionsConfig={{
purposePrompt: "A COOL & SMOOTH announcement post about CopilotTextarea. Be brief. Be clear. Be cool.",
forwardedParams: { // additional arguments to customize autocompletions
max_tokens: 25,
stop: ["\n", ".", ","],
},
}}
/>
</CopilotProvider>
);
import "@copilotkit/react-ui/styles.css"; // add to the app-global css
import { CopilotProvider } from "@copilotkit/react-core";
import { CopilotSidebarUIProvider } from "@copilotkit/react-ui";
export default function App(): JSX.Element {
return (
<CopilotProvider chatApiEndpoint="/api/copilotkit/chat"> {/* Global state & copilot logic. Put this around the entire app */}
<CopilotSidebarUIProvider> {/* A built-in Copilot UI (or bring your own UI). Put around individual pages, or the entire app. */}
<YourContent />
</CopilotSidebarUIProvider>
</CopilotProvider>
);
}
- Batteries included. Add 2 React components, and your Copilot is live.
- Customize the built-in
CopilotSidebarUIProvider
UI -- or bring your own UI component. - Extremely hackable. Should the need arise, you can define 1st-class extensions just as powerful as
useMakeCopilotReadable
,useMakeCopilotActionable
, etc.
- Propagate useful information & granular app-state to the Copilot
- Easily maintain the hierarchical structure of information with
parentId
- One call to rule them all:
useMakeCopilotReadable
works both with the sidekick, and with CopilotTextarea.- Use the
contextCategories: string[]
param to route information to different places.
- Use the
import { useMakeCopilotReadable } from "@copilotkit/react-core";
function Employee(props: EmployeeProps): JSX.Element {
const { employeeName, workProfile, metadata } = props;
// propagate any information copilot
const employeeContextId = useMakeCopilotReadable(employeeName);
// Pass a parentID to maintain a hiearchical structure.
// Especially useful with child React components, list elements, etc.
useMakeCopilotReadable(workProfile.description(), employeeContextId);
useMakeCopilotReadable(metadata.description(), employeeContextId);
return (
// Render as usual...
);
}
import { useMakeCopilotActionable } from "@copilotkit/react-core";
function Department(props: DepartmentProps): JSX.Element {
// ...
// Let the copilot take action on behalf of the user.
useMakeCopilotActionable(
{
name: "setEmployeesAsSelected",
description: "Set the given employees as 'selected'",
argumentAnnotations: [
{
name: "employeeIds",
type: "array", items: { type: "string" }
description: "The IDs of employees to set as selected",
required: true
}
],
implementation: async (employeeIds) => setEmployeesAsSelected(employeeIds),
},
[]
);
// ...
}
- Plain typescript actions. Edit a textbox, navigate to a new page, or anythign you can think of.
- Specify arbitrary input types.
- โ
useMakeCopilotReadable
: give static information to the copilot, in sync with on-screen state - โ
useMakeCopilotActionable
: Let the copilot take action on behalf of the user - ๐ง
useMakeCopilotAskable
: let the copilot ask for additional information when needed (coming soon) - ๐ง
useEditCopilotMessage
: edit the (unsent) typed user message to the copilot (coming soon) - ๐ง copilot-assisted navigation: go to the best page to achieve some objective.
- ๐ง CopilotCloudKit: integrate arbitrary LLM logic / chains / RAG, using plain code.
- โ
<CopilotSidebarUIProvider>
: Built in, hackable Copilot UI (optional - you can bring your own UI). - โ
<CopilotTextarea />
: drop-in<textarea />
replacement with Copilot autocompletions.
- โ Vercel AI SDK
- โ OpenAI APIs
- ๐ง Langchain
- ๐ง Additional LLM providers
- โ React
- ๐ง Vue
- ๐ง Svelte
- ๐ง Swift (Mac + iOS)
Contributions are welcome! ๐
atai <at>
copilotkit.ai