Skip to content

docs: Add docs for new runtime parameters feature #296

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

marcelomendoncasoares
Copy link
Contributor

@marcelomendoncasoares marcelomendoncasoares commented Jun 10, 2025

Add docs for the new setRuntimeParameter feature as implemented on Serverpod's PR 3627.

Summary by CodeRabbit

  • Documentation
    • Expanded guidance on optimizing vector similarity searches, including advice on setting runtime parameters for queries.
    • Added a new section detailing how to use runtime parameters to fine-tune PostgreSQL query behavior, with examples for vector searches and index configurations.

Copy link

coderabbitai bot commented Jun 19, 2025

📝 Walkthrough

Walkthrough

The documentation was updated to expand guidance on optimizing vector similarity searches, now including advice on tuning runtime parameters. Additionally, a new document was added that introduces and explains the use of runtime parameters in Serverpod for fine-tuning PostgreSQL query execution, with detailed examples and descriptions for vector search optimization.

Changes

File(s) Change Summary
docs/06-concepts/06-database/06-filter.md Expanded documentation tip to include guidance on tuning runtime parameters for vector similarity searches.
docs/06-concepts/06-database/12-runtime-parameters.md Added new documentation explaining runtime parameters, usage scopes, and vector search optimization options.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Docs
    User->>Docs: Reads about vector similarity search optimization
    Docs-->>User: Suggests creating vector indexes and tuning runtime parameters
    User->>Docs: Reads runtime parameters documentation
    Docs-->>User: Explains global/local parameters, vector search options, and code examples
Loading

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
docs/06-concepts/06-database/12-runtime-parameters.md (4)

38-49: Import context for combined groups example
This snippet builds on the previous one but reuses the same types. Recommend adding a note that the package:serverpod/serverpod.dart import applies here as well for clarity.


59-85: Include import for VectorIndexQueryOptions
The general vector optimization example introduces VectorIndexQueryOptions without an import. Suggest adding:

import 'package:serverpod/serverpod.dart';

to the top of the snippet.


107-120: Add import for IVFFLAT options
The IVFFLAT example uses IvfFlatIndexQueryOptions but lacks an import. Recommend adding:

import 'package:serverpod/serverpod.dart';

124-128: Minor punctuation in enum description
Add a comma for clarity in the relaxed scan description:

-Allows slightly out-of-order results but provides better recall.
+Allows slightly out-of-order results, but provides better recall.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93acd33 and ffcbb35.

📒 Files selected for processing (2)
  • docs/06-concepts/06-database/06-filter.md (1 hunks)
  • docs/06-concepts/06-database/12-runtime-parameters.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/06-concepts/06-database/12-runtime-parameters.md

[uncategorized] ~126-~126: Loose punctuation mark.
Context: ... scanning: - IterativeScan.strict: Ensures results are in exact order by d...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~127-~127: Loose punctuation mark.
Context: ...recision). - IterativeScan.relaxed: Allows slightly out-of-order results bu...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~127-~127: Possible missing comma found.
Context: ...**: Allows slightly out-of-order results but provides better recall. ## Setting glo...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test build
🔇 Additional comments (6)
docs/06-concepts/06-database/12-runtime-parameters.md (5)

1-3: Strong title and concise intro
The heading and introduction clearly explain the purpose and benefit of runtime parameters.


5-7: Clear cautionary warning
The warning block effectively highlights risks of tuning database parameters without testing.


9-15: Well-defined parameter scopes
The explanation of global vs. local scopes is precise and easy to follow.


87-104: HNSW optimization snippet is complete
This section includes the import and all necessary details for HnswIndexQueryOptions. No changes needed.


130-152: Caution: internal API import
Importing from package:serverpod/src/server/serverpod.dart accesses internal APIs that may change. Confirm that this is intended and consider warning users about potential breaking changes in future releases.

docs/06-concepts/06-database/06-filter.md (1)

274-277: Verify link to runtime parameters
The tip now references [runtime parameters](runtime-parameters). Please confirm this anchor resolves correctly in the generated site.

Comment on lines +16 to +36
```dart
var hnswOptions = HnswIndexQueryOptions(efSearch: 40);

// Global scope - affects all queries in this session
await session.db.setRuntimeParameters([hnswOptions]);

// Local scope - only affects current transaction
await session.db.transaction((transaction) async {
await session.db.setRuntimeParameters([hnswOptions], transaction: transaction);

var results = await Document.db.find(
session,
where: (t) => t.embedding.distanceCosine(queryVector) < 0.5,
limit: 10,
orderBy: (t) => t.embedding.distanceCosine(queryVector),
transaction: transaction,
);

return results;
});
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add import for serverpod package
The Dart snippet uses HnswIndexQueryOptions but omits the required import. To ensure the example compiles, add at the top:

import 'package:serverpod/serverpod.dart';
🤖 Prompt for AI Agents
In docs/06-concepts/06-database/12-runtime-parameters.md around lines 16 to 36,
the Dart code snippet uses HnswIndexQueryOptions but does not include the
necessary import statement. Add the import line "import
'package:serverpod/serverpod.dart';" at the top of the code snippet to ensure it
compiles correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant