Skip to content

Commit 30f3d2e

Browse files
committed
quickstart consistency
1 parent 559f77c commit 30f3d2e

3 files changed

Lines changed: 32 additions & 15 deletions

File tree

docs/snippets/copilot-ui.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ You are almost there!
55
Now it's time to setup your Copilot UI.
66

77

8-
First, import the default styles in your root component:
8+
First, import the default styles in your root component (typically `layout.tsx`) :
99

10-
```tsx
10+
```tsx filename="layout.tsx"
1111
import "@copilotkit/react-ui/styles.css";
1212
```
1313

docs/snippets/self-hosting-copilot-runtime-configure-copilotkit-provider.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ For most use-cases, it's appropriate to wrap the `CopilotKit` provider around th
44

55
Point it at the Copilot Runtime URL you configured in the previous step.
66

7-
```tsx filename="layout.tsx" showLineNumbers {7, 9}
8-
"use client";
9-
7+
```tsx filename="layout.tsx" showLineNumbers {5,6,8}
108
import { CopilotKit } from "@copilotkit/react-core";
119

1210
export default function RootLayout({children}) {
1311
return (
14-
<CopilotKit runtimeUrl="<copilot-runtime-url-configured-in-the-previous-step>">
12+
{/* Make sure to use the URL you configured in the previous step */}
13+
<CopilotKit runtimeUrl="/api/copilotkit">
1514
{children}
1615
</CopilotKit>
1716
);

docs/snippets/self-hosting-copilot-runtime-create-endpoint.mdx

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ First, choose which LLM model you would like to use under the hood:
1515
OPENAI_API_KEY=your_api_key_here
1616
```
1717

18+
Please note that the code below uses GPT-4o, which requires a paid OpenAI API key.
19+
**If you are using a free OpenAI API key**, change the model to a different option such as "gpt-3.5-turbo".
20+
1821
#### Endpoint Setup
1922

2023
<Tabs items={['Next.js App Router', 'Next.js Pages Router', 'Node.js Express', 'Node.js HTTP', 'NestJS']}>
@@ -33,14 +36,17 @@ First, choose which LLM model you would like to use under the hood:
3336
import { NextRequest } from 'next/server';
3437

3538
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
36-
const llmAdapter = new OpenAIAdapter({ openai });
39+
const llmAdapter = new OpenAIAdapter({
40+
openai,
41+
model: "gpt-4o"
42+
});
3743

3844
const runtime = new CopilotRuntime();
3945

4046
export const POST = async (req: NextRequest) => {
4147
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
4248
runtime,
43-
llmAdapter,
49+
serviceAdapter: llmAdapter,
4450
endpoint: '/api/copilotkit',
4551
});
4652

@@ -65,15 +71,18 @@ First, choose which LLM model you would like to use under the hood:
6571
import OpenAI from 'openai';
6672

6773
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
68-
const llmAdapter = new OpenAIAdapter({ openai });
74+
const llmAdapter = new OpenAIAdapter({
75+
openai,
76+
model: "gpt-4o"
77+
});
6978

7079
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
7180
const runtime = new CopilotRuntime();
7281

7382
const handleRequest = copilotRuntimeNextJSPagesRouterEndpoint({
7483
endpoint: '/api/copilotkit',
7584
runtime,
76-
llmAdapter,
85+
serviceAdapter: llmAdapter,
7786
});
7887

7988
return await handleRequest(req, res);
@@ -100,14 +109,17 @@ First, choose which LLM model you would like to use under the hood:
100109

101110
const app = express();
102111
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
103-
const llmAdapter = new OpenAIAdapter({ openai });
112+
const llmAdapter = new OpenAIAdapter({
113+
openai,
114+
model: "gpt-4o"
115+
});
104116

105117
app.use('/copilotkit', (req, res, next) => {
106118
const runtime = new CopilotRuntime();
107119
const handler = copilotRuntimeNodeHttpEndpoint({
108120
endpoint: '/copilotkit',
109121
runtime,
110-
llmAdapter,
122+
serviceAdapter: llmAdapter,
111123
});
112124

113125
return handler(req, res, next);
@@ -135,14 +147,17 @@ First, choose which LLM model you would like to use under the hood:
135147
import OpenAI from 'openai';
136148

137149
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
138-
const llmAdapter = new OpenAIAdapter({ openai });
150+
const llmAdapter = new OpenAIAdapter({
151+
openai,
152+
model: "gpt-4o"
153+
});
139154

140155
const server = createServer((req, res) => {
141156
const runtime = new CopilotRuntime();
142157
const handler = copilotRuntimeNodeHttpEndpoint({
143158
endpoint: '/copilotkit',
144159
runtime,
145-
llmAdapter,
160+
serviceAdapter: llmAdapter,
146161
});
147162

148163
return handler(req, res);
@@ -170,7 +185,10 @@ First, choose which LLM model you would like to use under the hood:
170185
@All('/copilotkit')
171186
copilotkit(@Req() req: Request, @Res() res: Response) {
172187
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
173-
const llmAdapter = new OpenAIAdapter({ openai });
188+
const llmAdapter = new OpenAIAdapter({
189+
openai,
190+
model: "gpt-4o"
191+
});
174192
const runtime = new CopilotRuntime();
175193

176194
runtime.streamHttpServerResponse(req, res, llmAdapter);

0 commit comments

Comments
 (0)