You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/index.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,11 @@ description: MongoDB Knowledge Service
7
7
8
8
The MongoDB Knowledge Service lets you learn about MongoDB using generative AI.
9
9
10
-
## Server
10
+
## Responses API
11
+
12
+
To build MongoDB-related conversational AI applications, use the [Responses API](./server/responses-api.md). The Responses API is compatible with the OpenAI API and provides MongoDB-specific knowledge through retrieval-augmented generation.
13
+
14
+
## Server OpenAPI Specification
11
15
12
16
To call the MongoDB Knowledge Service API, refer to the [OpenAPI specification](/server/openapi/).
Copy file name to clipboardExpand all lines: docs/docs/server/openapi.yaml
+1-76Lines changed: 1 addition & 76 deletions
Original file line number
Diff line number
Diff line change
@@ -304,82 +304,7 @@ paths:
304
304
305
305
You can rate or comment on a message using the [rateMessage](#operation/rateMessage) and [commentMessage](#operation/commentMessage) endpoints.
306
306
307
-
### Basic Example Usage
308
-
309
-
Example usage with OpenAI client `openai`:
310
-
```ts
311
-
import { OpenAI } from "openai";
312
-
313
-
const openai = new OpenAI({ baseURL: "https://knowledge.mongodb.com/api/v1" });
314
-
315
-
const response = await openai.responses.create({
316
-
model: "mongodb-chat-latest",
317
-
stream: true,
318
-
input: [
319
-
{
320
-
role: "user",
321
-
content: "So what's MongoDB anyways??",
322
-
},
323
-
],
324
-
instructions: "You are located on the MongoDB Atlas cloud platform. Use that as context to inform your response."
325
-
});
326
-
327
-
for await (const event of response) {
328
-
console.log(event);
329
-
}
330
-
```
331
-
332
-
Example usage with Vercel AI SDK client `@ai-sdk/openai` and `ai`:
333
-
```ts
334
-
import { streamText } from "ai";
335
-
// NOTE: we are using the AI SDK v5-beta with LanguageModelV2
336
-
import { createOpenAI } from "@ai-sdk/openai";
337
-
338
-
const model = createOpenAI({
339
-
baseURL: origin + API_PREFIX,
340
-
apiKey: TEST_OPENAI_API_KEY,
341
-
}).responses("mongodb-chat-latest");
342
-
343
-
const result = await streamText({
344
-
model,
345
-
prompt: "What is MongoDB?",
346
-
});
347
-
348
-
for await (const chunk of result.toUIMessageStream()) {
349
-
console.log(chunk);
350
-
}
351
-
```
352
-
**NOTE:** We currently only support streaming responses via `streamText`. Methods like `generateText` will not work.
353
-
354
-
### Features
355
-
356
-
#### Retrieval-Informed Answers
357
-
358
-
By default, the API performs retrieval augmented generation under the hood
359
-
to generate accurate and up-to-date responses about MongoDB products.
360
-
If you provide custom tools to the API via the `tools` parameter,
361
-
the API will choose to use the tool or the retrieval tool based on the `tool_choice` parameter.
362
-
363
-
Default behavior is to allow the model to choose the tool to use.
364
-
365
-
#### Personality
366
-
367
-
The AI API has the personality of a helpful MongoDB assistant. You cannot change this core personality.
368
-
369
-
You can augment the personality via the `instructions` parameter. (E.g. "You are a technical services engineer at MongoDB. Use that as context to inform your response.")
370
-
371
-
#### Guardrail
372
-
373
-
The API features a guardrail that helps ensure the input is appropriate for a MongoDB assistant.
374
-
This helps ensure the API isn't used for irrelevant or malicious purposes.
375
-
376
-
#### Tracing and Storage
377
-
378
-
All messages to the chatbot are traced and stored if `store: true`.
379
-
380
-
For access to chatbot data, reach out to the Education AI team (`#ask-education-ai` on Slack).
381
-
382
-
All data retention is in line with MongoDB data retention policies.
307
+
For more information on using the Responses API, refer to the [Responses API documentation](./responses-api).
0 commit comments