showcase/shell-docs/src/content/reference/v1/hooks/useCopilotAdditionalInstructions.mdx
{ /*
useCopilotAdditionalInstructions is a React hook that provides additional instructions
to the Copilot.In its most basic usage, useCopilotAdditionalInstructions accepts a single string argument representing the instructions to be added to the Copilot.
import { useCopilotAdditionalInstructions } from "@copilotkit/react-core";
export function MyComponent() {
useCopilotAdditionalInstructions({
instructions: "Do not answer questions about the weather.",
});
}
You can also conditionally add instructions based on the state of your app.
import { useCopilotAdditionalInstructions } from "@copilotkit/react-core";
export function MyComponent() {
const [showInstructions, setShowInstructions] = useState(false);
useCopilotAdditionalInstructions({
available: showInstructions ? "enabled" : "disabled",
instructions: "Do not answer questions about the weather.",
});
}
You are a helpful assistant.
Additionally, follow these instructions:
- Do not answer questions about the weather.
- Do not answer questions about the stock market.