-
Notifications
You must be signed in to change notification settings - Fork 0
Improve ask question docs #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe documentation for the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
api-reference/endpoints/ask-question.mdx (3)
34-36: Clarifyfetch_existingbehaviour and interaction withstreamThe parameter description is helpful, but it leaves two open questions:
- Is
fetch_existing=trueincompatible withstream=true?- Must the
questionbody field exactly match a previous request, or is theslugalso required?Adding a single sentence covering these points removes guess-work for integrators.
Example:Fetch an existing answer. When set to `true`, `stream` must be `false` and the `question` must exactly match a prior request; otherwise a 404 is returned.
105-110: Code-fence language tag deviates from existing patternOther examples use the form
```json 200.
To stay consistent (and keep syntax-highlighters happy), drop the parentheses:-```text 200 (stream=true) +```text 200The preceding prose already explains that this block corresponds to
stream=true.
130-204: Wrap example in<CodeGroup>and avoid top-levelawait
- Docs guidelines encourage Mintlify components—wrapping the JS example in
<CodeGroup>lets you add more languages later without re-structuring.- Most readers will copy-paste; top-level
awaitfails in non-ESM Node environments. Encapsulate calls in an async IIFE for broader compatibility.-## Code Examples - -### Streaming and Fetching The Answer - -This example demonstrates how to stream a response and then fetch the complete answer with metadata. - -```javascript +## Code Examples +<CodeGroup> + +### JavaScript · Stream then fetch full answer + +```javascript (async () => { // Configuration const API_KEY = 'your-api-key-here'; @@ const question = "Does Gurubase support Slack?"; -// 1. Ask with stream -await askGurubase(question); - -// 2. Then fetch the answer from the db (for the JSON fields) -await fetchExisting(question); + // 1️⃣ Stream the answer text + await askGurubase(question); + + // 2️⃣ Retrieve full JSON (references, trust_score, etc.) + await fetchExisting(question); +})();+
This keeps the snippet self-contained, aligns with the component guidelines, and avoids run-time surprises. </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 169ecd1a86c90cf8f84657e3a19c946501ceff68 and 54becc1a908cd288f6be4e245c52d0cb0783977a. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `api-reference/endpoints/ask-question.mdx` (4 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (2)</summary> <details> <summary>**/*.mdx</summary> **📄 CodeRabbit Inference Engine (CLAUDE.md)** > `**/*.mdx`: Use MDX format for all documentation files > Use Mintlify components like <Card>, <CardGroup>, <CodeGroup> for rich content > Include practical examples and code snippets in documentation > Use images from /images/ directory for visual guides Files: - `api-reference/endpoints/ask-question.mdx` </details> <details> <summary>api-reference/endpoints/**/*.mdx</summary> **📄 CodeRabbit Inference Engine (CLAUDE.md)** > API endpoint docs follow the structure in /api-reference/endpoints/ Files: - `api-reference/endpoints/ask-question.mdx` </details> </details> </details> <details> <summary>🔇 Additional comments (1)</summary><blockquote> <details> <summary>api-reference/endpoints/ask-question.mdx (1)</summary> `81-83`: **Good call-out on streaming vs JSON response** This note eliminates a common confusion between the two response modes. 👍 </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Summary by CodeRabbit
fetch_existingfor the answer endpoint.