Xyne Documentation

repository·main·Indexed 20 days ago

https://github.com/xynehq/xyne

Xyne is an open-source, AI-first Search & Answer Engine for organizations that indexes fragmented work data from SaaS tools. Documentation covers portable deployment via Docker, authentication configuration for Google and Keycloak, Microsoft Graph SDK integration for OneDrive, Outlook, and Calendar, and evaluation frameworks using BEIR datasets.

Tokens
57.2K
Snippets
200
Records
263
Agent score
72%

What's inside Xyne

  1. Overview of Xyne AI Search & Answer Engine

    main

    Xyne is an open-source (Apache 2.0) AI-first Search & Answer Engine designed for work environments. It serves as an alternative to platforms like Glean, Gemini, and MS Copilot by connecting to fragmented SaaS applications (such as Google Workspace, Atlassian suite, Slack, and GitHub) to securely index data and map relationships.

    Key capabilities include:

    • Unified Search & Answer: Find files, triage issues, and get up-to-date answers with sources across all connected apps.
    • Permissions-aware: Live enforcement of existing application permissions ensures users only see data they are authorized to access.
    • Model Agnostic: Connects to any LLM or cloud provider, including local models via ollama (e.g., Deepseek).
    • Self-hosted: Can be deployed on laptops, on-premise, or in the cloud.
    • Privacy-focused: No training on user data or prompts, and no telemetry on usage.
    • High Performance: Utilizes multi-threaded data ingestion.
  2. Understand how commit types affect versioning

    main

    The project uses semantic-release, which determines the next version number based on your commit types:

    • Patch version (e.g., 1.0.1 → 1.0.2): Triggered by fix commits.
    • Minor version (e.g., 1.1.0 → 1.2.0): Triggered by feat commits.
    • Major version (e.g., 2.0.0 → 3.0.0): Triggered by feat! or commits containing BREAKING CHANGE: in the footer.
  3. Understand Xyne data persistence and backup

    main

    All application data is persisted in the ./data/ directory. This directory structure ensures that data survives container updates and restarts.

    Data Directory Structure

    • postgres-data/: PostgreSQL database files.
    • vespa-data/: Vespa search indices and models.
    • app-uploads/: User uploaded files.
    • app-logs/: Application logs.
    • app-migrations/: Drizzle ORM migration files (crucial for schema history).
    • grafana-storage/: Grafana dashboards.
    • loki-data/: Log storage.
    • prometheus-data/: Metrics storage.

    Backup Strategy

    To ensure data safety, regularly back up:

    1. postgres-data/ (The database).
    2. app-migrations/ (Schema history).
    3. app-uploads/ (User content).
    4. vespa-data/ (Note: Search indices can be rebuilt, but backing them up saves time).

    Migration Persistence

    Drizzle migrations are stored in app-migrations/. This ensures that schema changes are tracked and versioned automatically across container rebuilds.

  4. Understand the Microsoft Graph SDK integration components

    main

    The integration is split into two main functional areas:

    1. Client Module (client.ts)

    Responsible for the low-level communication with Microsoft:

    • createMicrosoftGraphClient: Creates a Microsoft Graph client instance.
    • makeGraphApiCall: Helper function for making API calls with retry logic.
    • makePagedGraphApiCall: Helper for handling paginated requests.
    • CustomAuthProvider: A custom authentication provider implementing the Microsoft Graph SDK interface.

    2. Main Integration (index.ts)

    Handles the high-level data processing for specific Microsoft services:

    • OneDrive Files: Metadata and content indexing.
    • Outlook Emails: Email content and metadata processing.
    • Calendar Events: Meeting details, attendees, and attachments.
    • Contacts: Contact information and organization details.
  5. Xyne as an Org Operating System (OrgOS)

    main
    Xyne is designed as an 'Org Operating System' (OrgOS) to provide the context necessary to augment both humans and AI Agents/Assistants. It provides the retrieval, memory, and tooling required to build AI-first internal applications and workflows tailored to specific organizational requirements.
  6. Handling breaking changes in commits

    main

    To signal a breaking change (which triggers a Major version bump in semantic-release), you must either:

    1. Add a ! after the type (e.g., feat!: description).
    2. Include BREAKING CHANGE: in the commit footer.

    Example:

    feat(api)!: update user authentication endpoints
    
    BREAKING CHANGE: The authentication endpoints have been updated.
    feat(api)!: update user authentication endpoints
    
    BREAKING CHANGE: The authentication endpoints have been updated.
    - /auth/login is now /api/v2/auth/login
    - /auth/logout is now /api/v2/auth/logout
  7. How the LLM-Based Search Quality Evaluation Script works

    main

    The evaluateSearchQualityLLM.ts script is a tool for quantitatively measuring the effectiveness of the Vespa search engine integration. It uses an LLM to simulate complex, conceptual user searches by generating queries based on actual document content, rather than relying on simple keyword matching.

    This allows developers to:

    • Benchmark search performance against LLM-generated queries.
    • Regression Test to ensure changes don't degrade relevance for complex queries.
    • Tune hybrid search parameters (specifically the alpha value).
    • Analyze Failures by using an LLM to explain why certain queries failed to retrieve target documents.
  8. Secure Jira Webhooks using HTTP Query Auth

    main

    Since Jira webhooks are sent from Atlassian's infrastructure, you can secure your endpoint by appending an authentication token as a query parameter to your webhookUrl.

    1. Configure the JiraTrigger with a URL like: https://your-app.com/api/v1/webhook/jira/<id>?auth=your-secret-token.
    2. In your backend webhook handler, validate the auth query parameter before processing the event.
    const trigger = new JiraTrigger({
      // ... other config
      webhookUrl: 'https://your-app.com/api/v1/webhook/jira/<your-stable-webhook-id>?auth=your-secret-token',
    })
    
    // In your endpoint handler:
    app.post('/webhook/jira', (req, res) => {
      if (req.query.auth !== 'your-secret-token') {
        return res.status(403).send('Unauthorized')
      }
    
      // Process event
    })
  9. Choose an authentication method for data ingestion

    main

    Xyne supports two primary authentication methods for ingesting data. You only need to configure one of these types:

    • OAuth Authentication: Best suited for individual users running the application for testing or personal use.
    • Service Account Authentication: Best suited for organizations and production environments.

    Before attempting to ingest data, ensure you have already completed the setup for your chosen authentication method.

  10. How failure analysis works in search evaluation

    main

    When DEBUG_POOR_RANKINGS is set to true, the script performs an automated failure analysis to help debug search relevance issues.

    1. Identification: It identifies documents that are either not found in the search results or are ranked lower than the POOR_RANK_THRESHOLD (default 10).
    2. Data Collection: For these specific failures, it saves detailed debug_[HASH]_[TIMESTAMP].json files containing Vespa trace information and top result data.
    3. Reporting: It aggregates these failures to identify common patterns (e.g., issues with tokenization or term weighting) and generates a search_failure_analysis.md report with actionable recommendations.
  11. Access the ingestion connector in the Xyne UI

    main

    After successfully logging in with your Google account and starting the application, you can access the ingestion interface via the UI:

    1. Navigate to the main application screen in your browser.
    2. Locate the plug icon on the left-hand side of the interface. This icon represents the connector.
    3. Clicking the connector will allow you to choose your ingestion method based on your configured authentication (either Oauth Account or Service Account).
  12. Configure Domain-Wide Delegation for Service Accounts

    main

    To allow the service account to access user data within your Google Workspace, a Workspace Admin must configure Domain-Wide Delegation.

    1. Navigate to Domain Wide Delegation in the Google Admin console.
    2. Click Add New.
    3. Paste the OAuth Client Id (found in your service account JSON key file).
    4. Paste the required scopes listed below into the scopes field.
    5. Click Authorize.
    https://www.googleapis.com/auth/drive.readonly,https://www.googleapis.com/auth/documents.readonly,https://www.googleapis.com/auth/spreadsheets.readonly,https://www.googleapis.com/auth/presentations.readonly,https://www.googleapis.com/auth/contacts.readonly,https://www.googleapis.com/auth/contacts.other.readonly,https://www.googleapis.com/auth/gmail.readonly,https://www.googleapis.com/auth/calendar.events.readonly,https://www.googleapis.com/auth/admin.directory.user.readonly