Skip to content

Conversation

@jcabrero
Copy link
Member

@jcabrero jcabrero commented Aug 29, 2025

This PR implements nilDB prompt storage integration in nilAI, allowing NUC tokens to include prompt documents that will be automatically injected into chat completions. The main changes include adding nilDB document handling to the authentication system, creating a new delegation endpoint for prompt store access, and modifying chat completion logic to support prompt injection from nilDB documents.

  • nilDB Integration: Added PromptDocument extraction from NUC tokens and prompt injection into chat completions
  • NilDB Delegation Endpoint: Created REST endpoint for getting delegation tokens for prompt storage
  • Configuration Updates: Modified default parameter handling and dependency versions

@jcabrero jcabrero force-pushed the feat/nildb_prompt_storage branch from 92b3ef5 to 65998b3 Compare September 4, 2025 11:25
@jcabrero jcabrero force-pushed the feat/nildb_prompt_storage branch from 4c29bff to f0746bf Compare September 8, 2025 09:51
@jcabrero jcabrero marked this pull request as ready for review September 8, 2025 10:22
@jcabrero jcabrero requested a review from Copilot September 10, 2025 09:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements nilDB prompt storage integration in nilAI, allowing NUC tokens to include prompt documents that will be automatically injected into chat completions. The main changes include adding nilDB document handling to the authentication system, creating a new delegation endpoint for prompt store access, and modifying chat completion logic to support prompt injection from nilDB documents.

  • nilDB Integration: Added PromptDocument extraction from NUC tokens and prompt injection into chat completions
  • NilDB Delegation Endpoint: Created REST endpoint for getting delegation tokens for prompt storage
  • Configuration Updates: Modified default parameter handling and dependency versions

Reviewed Changes

Copilot reviewed 29 out of 32 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/nuc_helpers/test_usage.py Refactored to use shared dummy classes from init.py
tests/unit/nuc_helpers/test_nildb_document.py Added comprehensive tests for PromptDocument extraction from NUC tokens
tests/unit/nuc_helpers/init.py Created shared test utilities with dummy NUC token classes
tests/unit/nilai_api/routers/test_private.py Updated mock configuration for authentication tests
tests/unit/nilai_api/routers/test_nildb_endpoints.py Added tests for new nilDB delegation and chat completion endpoints
tests/unit/nilai_api/handlers/test_nildb_handler.py Added tests for nilDB handler functions
tests/unit/nilai_api/conftest.py Added sentence transformer mocking for testing
tests/unit/nilai_api/auth/test_strategies.py Added tests for authentication strategies with prompt document support
tests/unit/nilai_api/auth/test_nuc.py Added tests for NUC token prompt document extraction
tests/e2e/test_http.py Added end-to-end tests for nilDB functionality
tests/e2e/nuc.py Extended NUC token generation with document ID support
scripts/docker-composer.py Added volume preservation option for development environments
packages/nilai-common/src/nilai_common/api_model.py Changed ChatRequest defaults to None for better flexibility
nilai-auth/nuc-helpers/src/nuc_helpers/usage.py Fixed return type documentation
nilai-auth/nuc-helpers/src/nuc_helpers/nildb_document.py Added PromptDocument class for extracting document metadata from tokens
nilai-auth/nuc-helpers/src/nuc_helpers/helpers.py Extended delegation token creation with document metadata support
nilai-auth/nuc-helpers/pyproject.toml Updated nuc dependency version constraint
nilai-api/src/nilai_api/routers/private.py Added nilDB delegation endpoint and prompt injection logic
nilai-api/src/nilai_api/handlers/nildb/handler.py Implemented core nilDB client operations
nilai-api/src/nilai_api/handlers/nildb/config.py Added configuration handling for nilDB connections
nilai-api/src/nilai_api/handlers/nildb/api_model.py Added API models for delegation requests/responses
nilai-api/src/nilai_api/db/users.py Added subscription owner property to UserData
nilai-api/src/nilai_api/auth/strategies.py Updated auth strategies to include prompt document extraction
nilai-api/src/nilai_api/auth/nuc.py Added prompt document extraction function
nilai-api/src/nilai_api/auth/common.py Extended AuthenticationInfo with prompt document field
nilai-api/pyproject.toml Added secretvaults dependency for nilDB integration
conftest.py Added global pytest configuration
.github/workflows/cicd.yml Added environment variable setup for nilDB configuration
.env.ci Added nilDB configuration variables

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jcabrero jcabrero requested a review from blefo September 11, 2025 08:01
@jcabrero jcabrero merged commit db43dac into main Sep 12, 2025
8 checks passed
@jcabrero jcabrero linked an issue Oct 8, 2025 that may be closed by this pull request
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.

Prompt Storage and Retrieval with nilDB and nilAI

2 participants