diff --git a/.vscode/launch.template.jsonc b/.vscode/launch.template.jsonc index 1f1faed097d..5404c4a6839 100644 --- a/.vscode/launch.template.jsonc +++ b/.vscode/launch.template.jsonc @@ -17,7 +17,7 @@ } }, { - "name": "Run All Danswer Services", + "name": "Run All Onyx Services", "configurations": [ "Web Server", "Model Server", @@ -122,7 +122,7 @@ "PYTHONUNBUFFERED": "1" }, "args": [ - "danswer.main:app", + "onyx.main:app", "--reload", "--port", "8080" @@ -139,7 +139,7 @@ "consoleName": "Slack Bot", "type": "debugpy", "request": "launch", - "program": "danswer/danswerbot/slack/listener.py", + "program": "onyx/onyxbot/slack/listener.py", "cwd": "${workspaceFolder}/backend", "envFile": "${workspaceFolder}/.vscode/.env", "env": { @@ -166,7 +166,7 @@ }, "args": [ "-A", - "danswer.background.celery.versioned_apps.primary", + "onyx.background.celery.versioned_apps.primary", "worker", "--pool=threads", "--concurrency=4", @@ -195,7 +195,7 @@ }, "args": [ "-A", - "danswer.background.celery.versioned_apps.light", + "onyx.background.celery.versioned_apps.light", "worker", "--pool=threads", "--concurrency=64", @@ -224,7 +224,7 @@ }, "args": [ "-A", - "danswer.background.celery.versioned_apps.heavy", + "onyx.background.celery.versioned_apps.heavy", "worker", "--pool=threads", "--concurrency=4", @@ -254,7 +254,7 @@ }, "args": [ "-A", - "danswer.background.celery.versioned_apps.indexing", + "onyx.background.celery.versioned_apps.indexing", "worker", "--pool=threads", "--concurrency=1", @@ -283,7 +283,7 @@ }, "args": [ "-A", - "danswer.background.celery.versioned_apps.beat", + "onyx.background.celery.versioned_apps.beat", "beat", "--loglevel=INFO", ], @@ -308,7 +308,7 @@ "args": [ "-v" // Specify a sepcific module/test to run or provide nothing to run all tests - //"tests/unit/danswer/llm/answering/test_prune_and_merge.py" + //"tests/unit/onyx/llm/answering/test_prune_and_merge.py" ], "presentation": { "group": "2", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 736c482252f..5a803712107 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,32 +1,34 @@ - + -# Contributing to Danswer -Hey there! We are so excited that you're interested in Danswer. +# Contributing to Onyx -As an open source project in a rapidly changing space, we welcome all contributions. +Hey there! We are so excited that you're interested in Onyx. +As an open source project in a rapidly changing space, we welcome all contributions. ## 💃 Guidelines + ### Contribution Opportunities -The [GitHub Issues](https://github.com/danswer-ai/danswer/issues) page is a great place to start for contribution ideas. + +The [GitHub Issues](https://github.com/onyx-dot-app/onyx/issues) page is a great place to start for contribution ideas. Issues that have been explicitly approved by the maintainers (aligned with the direction of the project) will be marked with the `approved by maintainers` label. Issues marked `good first issue` are an especially great place to start. **Connectors** to other tools are another great place to contribute. For details on how, refer to this -[README.md](https://github.com/danswer-ai/danswer/blob/main/backend/danswer/connectors/README.md). +[README.md](https://github.com/onyx-dot-app/onyx/blob/main/backend/onyx/connectors/README.md). If you have a new/different contribution in mind, we'd love to hear about it! -Your input is vital to making sure that Danswer moves in the right direction. +Your input is vital to making sure that Onyx moves in the right direction. Before starting on implementation, please raise a GitHub issue. -And always feel free to message us (Chris Weaver / Yuhong Sun) on -[Slack](https://join.slack.com/t/danswer/shared_invite/zt-2lcmqw703-071hBuZBfNEOGUsLa5PXvQ) / -[Discord](https://discord.gg/TDJ59cGV2X) directly about anything at all. - +And always feel free to message us (Chris Weaver / Yuhong Sun) on +[Slack](https://join.slack.com/t/danswer/shared_invite/zt-1w76msxmd-HJHLe3KNFIAIzk_0dSOKaQ) / +[Discord](https://discord.gg/TDJ59cGV2X) directly about anything at all. ### Contributing Code + To contribute to this project, please follow the ["fork and pull request"](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) workflow. When opening a pull request, mention related issues and feel free to tag relevant maintainers. @@ -34,72 +36,78 @@ When opening a pull request, mention related issues and feel free to tag relevan Before creating a pull request please make sure that the new changes conform to the formatting and linting requirements. See the [Formatting and Linting](#formatting-and-linting) section for how to run these checks locally. - ### Getting Help 🙋 + Our goal is to make contributing as easy as possible. If you run into any issues please don't hesitate to reach out. That way we can help future contributors and users can avoid the same issue. We also have support channels and generally interesting discussions on our -[Slack](https://join.slack.com/t/danswer/shared_invite/zt-2afut44lv-Rw3kSWu6_OmdAXRpCv80DQ) -and +[Slack](https://join.slack.com/t/danswer/shared_invite/zt-1w76msxmd-HJHLe3KNFIAIzk_0dSOKaQ) +and [Discord](https://discord.gg/TDJ59cGV2X). We would love to see you there! - ## Get Started 🚀 -Danswer being a fully functional app, relies on some external software, specifically: + +Onyx being a fully functional app, relies on some external software, specifically: + - [Postgres](https://www.postgresql.org/) (Relational DB) - [Vespa](https://vespa.ai/) (Vector DB/Search Engine) - [Redis](https://redis.io/) (Cache) - [Nginx](https://nginx.org/) (Not needed for development flows generally) - > **Note:** -> This guide provides instructions to build and run Danswer locally from source with Docker containers providing the above external software. We believe this combination is easier for -> development purposes. If you prefer to use pre-built container images, we provide instructions on running the full Danswer stack within Docker below. - +> This guide provides instructions to build and run Onyx locally from source with Docker containers providing the above external software. We believe this combination is easier for +> development purposes. If you prefer to use pre-built container images, we provide instructions on running the full Onyx stack within Docker below. ### Local Set Up + Be sure to use Python version 3.11. For instructions on installing Python 3.11 on macOS, refer to the [CONTRIBUTING_MACOS.md](./CONTRIBUTING_MACOS.md) readme. If using a lower version, modifications will have to be made to the code. If using a higher version, sometimes some libraries will not be available (i.e. we had problems with Tensorflow in the past with higher versions of python). - #### Backend: Python requirements + Currently, we use pip and recommend creating a virtual environment. For convenience here's a command for it: + ```bash python -m venv .venv source .venv/bin/activate ``` > **Note:** -> This virtual environment MUST NOT be set up WITHIN the danswer directory if you plan on using mypy within certain IDEs. -> For simplicity, we recommend setting up the virtual environment outside of the danswer directory. +> This virtual environment MUST NOT be set up WITHIN the onyx directory if you plan on using mypy within certain IDEs. +> For simplicity, we recommend setting up the virtual environment outside of the onyx directory. _For Windows, activate the virtual environment using Command Prompt:_ + ```bash .venv\Scripts\activate ``` + If using PowerShell, the command slightly differs: + ```powershell .venv\Scripts\Activate.ps1 ``` Install the required python dependencies: + ```bash -pip install -r danswer/backend/requirements/default.txt -pip install -r danswer/backend/requirements/dev.txt -pip install -r danswer/backend/requirements/ee.txt -pip install -r danswer/backend/requirements/model_server.txt +pip install -r onyx/backend/requirements/default.txt +pip install -r onyx/backend/requirements/dev.txt +pip install -r onyx/backend/requirements/ee.txt +pip install -r onyx/backend/requirements/model_server.txt ``` Install Playwright for Python (headless browser required by the Web Connector) In the activated Python virtualenv, install Playwright for Python by running: + ```bash playwright install ``` @@ -109,42 +117,50 @@ You may have to deactivate and reactivate your virtualenv for `playwright` to ap #### Frontend: Node dependencies Install [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) for the frontend. -Once the above is done, navigate to `danswer/web` run: +Once the above is done, navigate to `onyx/web` run: + ```bash npm i ``` #### Docker containers for external software + You will need Docker installed to run these containers. -First navigate to `danswer/deployment/docker_compose`, then start up Postgres/Vespa/Redis with: +First navigate to `onyx/deployment/docker_compose`, then start up Postgres/Vespa/Redis with: + ```bash -docker compose -f docker-compose.dev.yml -p danswer-stack up -d index relational_db cache +docker compose -f docker-compose.dev.yml -p onyx-stack up -d index relational_db cache ``` + (index refers to Vespa, relational_db refers to Postgres, and cache refers to Redis) +#### Running Onyx locally + +To start the frontend, navigate to `onyx/web` and run: -#### Running Danswer locally -To start the frontend, navigate to `danswer/web` and run: ```bash npm run dev ``` Next, start the model server which runs the local NLP models. -Navigate to `danswer/backend` and run: +Navigate to `onyx/backend` and run: + ```bash uvicorn model_server.main:app --reload --port 9000 ``` _For Windows (for compatibility with both PowerShell and Command Prompt):_ + ```bash powershell -Command "uvicorn model_server.main:app --reload --port 9000" ``` -The first time running Danswer, you will need to run the DB migrations for Postgres. +The first time running Onyx, you will need to run the DB migrations for Postgres. After the first time, this is no longer required unless the DB models change. -Navigate to `danswer/backend` and with the venv active, run: +Navigate to `onyx/backend` and with the venv active, run: + ```bash alembic upgrade head ``` @@ -152,21 +168,24 @@ alembic upgrade head Next, start the task queue which orchestrates the background jobs. Jobs that take more time are run async from the API server. -Still in `danswer/backend`, run: +Still in `onyx/backend`, run: + ```bash python ./scripts/dev_run_background_jobs.py ``` -To run the backend API server, navigate back to `danswer/backend` and run: +To run the backend API server, navigate back to `onyx/backend` and run: + ```bash -AUTH_TYPE=disabled uvicorn danswer.main:app --reload --port 8080 +AUTH_TYPE=disabled uvicorn onyx.main:app --reload --port 8080 ``` _For Windows (for compatibility with both PowerShell and Command Prompt):_ + ```bash powershell -Command " $env:AUTH_TYPE='disabled' - uvicorn danswer.main:app --reload --port 8080 + uvicorn onyx.main:app --reload --port 8080 " ``` @@ -182,57 +201,61 @@ You should now have 4 servers running: - Model server - Background jobs -Now, visit `http://localhost:3000` in your browser. You should see the Danswer onboarding wizard where you can connect your external LLM provider to Danswer. +Now, visit `http://localhost:3000` in your browser. You should see the Onyx onboarding wizard where you can connect your external LLM provider to Onyx. -You've successfully set up a local Danswer instance! 🏁 +You've successfully set up a local Onyx instance! 🏁 -#### Running the Danswer application in a container +#### Running the Onyx application in a container -You can run the full Danswer application stack from pre-built images including all external software dependencies. +You can run the full Onyx application stack from pre-built images including all external software dependencies. -Navigate to `danswer/deployment/docker_compose` and run: +Navigate to `onyx/deployment/docker_compose` and run: ```bash -docker compose -f docker-compose.dev.yml -p danswer-stack up -d +docker compose -f docker-compose.dev.yml -p onyx-stack up -d ``` -After Docker pulls and starts these containers, navigate to `http://localhost:3000` to use Danswer. +After Docker pulls and starts these containers, navigate to `http://localhost:3000` to use Onyx. -If you want to make changes to Danswer and run those changes in Docker, you can also build a local version of the Danswer container images that incorporates your changes like so: +If you want to make changes to Onyx and run those changes in Docker, you can also build a local version of the Onyx container images that incorporates your changes like so: ```bash -docker compose -f docker-compose.dev.yml -p danswer-stack up -d --build +docker compose -f docker-compose.dev.yml -p onyx-stack up -d --build ``` ### Formatting and Linting + #### Backend + For the backend, you'll need to setup pre-commit hooks (black / reorder-python-imports). First, install pre-commit (if you don't have it already) following the instructions [here](https://pre-commit.com/#installation). With the virtual environment active, install the pre-commit library with: + ```bash pip install pre-commit ``` -Then, from the `danswer/backend` directory, run: +Then, from the `onyx/backend` directory, run: + ```bash pre-commit install ``` Additionally, we use `mypy` for static type checking. -Danswer is fully type-annotated, and we want to keep it that way! -To run the mypy checks manually, run `python -m mypy .` from the `danswer/backend` directory. - +Onyx is fully type-annotated, and we want to keep it that way! +To run the mypy checks manually, run `python -m mypy .` from the `onyx/backend` directory. #### Web -We use `prettier` for formatting. The desired version (2.8.8) will be installed via a `npm i` from the `danswer/web` directory. -To run the formatter, use `npx prettier --write .` from the `danswer/web` directory. -Please double check that prettier passes before creating a pull request. +We use `prettier` for formatting. The desired version (2.8.8) will be installed via a `npm i` from the `onyx/web` directory. +To run the formatter, use `npx prettier --write .` from the `onyx/web` directory. +Please double check that prettier passes before creating a pull request. ### Release Process -Danswer loosely follows the SemVer versioning standard. + +Onyx loosely follows the SemVer versioning standard. Major changes are released with a "minor" version bump. Currently we use patch release versions to indicate small feature changes. A set of Docker containers will be pushed automatically to DockerHub with every tag. -You can see the containers [here](https://hub.docker.com/search?q=danswer%2F). +You can see the containers [here](https://hub.docker.com/search?q=onyx%2F). diff --git a/CONTRIBUTING_MACOS.md b/CONTRIBUTING_MACOS.md index 519eccffd51..d0d63b7ac94 100644 --- a/CONTRIBUTING_MACOS.md +++ b/CONTRIBUTING_MACOS.md @@ -1,15 +1,19 @@ ## Some additional notes for Mac Users -The base instructions to set up the development environment are located in [CONTRIBUTING.md](https://github.com/danswer-ai/danswer/blob/main/CONTRIBUTING.md). + +The base instructions to set up the development environment are located in [CONTRIBUTING.md](https://github.com/onyx-dot-app/onyx/blob/main/CONTRIBUTING.md). ### Setting up Python + Ensure [Homebrew](https://brew.sh/) is already set up. Then install python 3.11. + ```bash brew install python@3.11 ``` Add python 3.11 to your path: add the following line to ~/.zshrc + ``` export PATH="$(brew --prefix)/opt/python@3.11/libexec/bin:$PATH" ``` @@ -17,15 +21,16 @@ export PATH="$(brew --prefix)/opt/python@3.11/libexec/bin:$PATH" > **Note:** > You will need to open a new terminal for the path change above to take effect. - ### Setting up Docker -On macOS, you will need to install [Docker Desktop](https://www.docker.com/products/docker-desktop/) and -ensure it is running before continuing with the docker commands. +On macOS, you will need to install [Docker Desktop](https://www.docker.com/products/docker-desktop/) and +ensure it is running before continuing with the docker commands. ### Formatting and Linting + MacOS will likely require you to remove some quarantine attributes on some of the hooks for them to execute properly. After installing pre-commit, run the following command: + ```bash sudo xattr -r -d com.apple.quarantine ~/.cache/pre-commit -``` \ No newline at end of file +``` diff --git a/LICENSE b/LICENSE index d93c97f3141..ab0b64876f1 100644 --- a/LICENSE +++ b/LICENSE @@ -2,9 +2,9 @@ Copyright (c) 2023-present DanswerAI, Inc. Portions of this software are licensed as follows: -* All content that resides under "ee" directories of this repository, if that directory exists, is licensed under the license defined in "backend/ee/LICENSE". Specifically all content under "backend/ee" and "web/src/app/ee" is licensed under the license defined in "backend/ee/LICENSE". -* All third party components incorporated into the Danswer Software are licensed under the original license provided by the owner of the applicable component. -* Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below. +- All content that resides under "ee" directories of this repository, if that directory exists, is licensed under the license defined in "backend/ee/LICENSE". Specifically all content under "backend/ee" and "web/src/app/ee" is licensed under the license defined in "backend/ee/LICENSE". +- All third party components incorporated into the Onyx Software are licensed under the original license provided by the owner of the applicable component. +- Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 0b7f87ceaa4..3cac02eeed5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ +

@@ -12,7 +13,7 @@ Documentation - + Slack @@ -23,11 +24,11 @@

-[Onyx](https://www.onyx.app/) (Formerly Danswer) is the AI Assistant connected to your company's docs, apps, and people. -Onyx provides a Chat interface and plugs into any LLM of your choice. Onyx can be deployed anywhere and for any -scale - on a laptop, on-premise, or to cloud. Since you own the deployment, your user data and chats are fully in your -own control. Onyx is dual Licensed with most of it under MIT license and designed to be modular and easily extensible. The system also comes fully ready -for production usage with user authentication, role management (admin/basic users), chat persistence, and a UI for +[Onyx](https://www.onyx.app/) (Formerly Danswer) is the AI Assistant connected to your company's docs, apps, and people. +Onyx provides a Chat interface and plugs into any LLM of your choice. Onyx can be deployed anywhere and for any +scale - on a laptop, on-premise, or to cloud. Since you own the deployment, your user data and chats are fully in your +own control. Onyx is dual Licensed with most of it under MIT license and designed to be modular and easily extensible. The system also comes fully ready +for production usage with user authentication, role management (admin/basic users), chat persistence, and a UI for configuring AI Assistants. Onyx also serves as a Enterprise Search across all common workplace tools such as Slack, Google Drive, Confluence, etc. @@ -39,15 +40,13 @@ supported?" or "Where's the pull request for feature Y?" Onyx Web App: -https://github.com/danswer-ai/danswer/assets/32520769/563be14c-9304-47b5-bf0a-9049c2b6f410 - +https://github.com/onyx-dot-app/onyx/assets/32520769/563be14c-9304-47b5-bf0a-9049c2b6f410 Or, plug Onyx into your existing Slack workflows (more integrations to come 😁): -https://github.com/danswer-ai/danswer/assets/25087905/3e19739b-d178-4371-9a38-011430bdec1b +https://github.com/onyx-dot-app/onyx/assets/25087905/3e19739b-d178-4371-9a38-011430bdec1b - -For more details on the Admin UI to manage connectors and users, check out our +For more details on the Admin UI to manage connectors and users, check out our Full Video Demo! ## Deployment @@ -57,76 +56,78 @@ Onyx can easily be run locally (even on a laptop) or deployed on a virtual machi We also have built-in support for deployment on Kubernetes. Files for that can be found [here](https://github.com/onyx-dot-app/onyx/tree/main/deployment/kubernetes). +## 💃 Main Features -## 💃 Main Features -* Chat UI with the ability to select documents to chat with. -* Create custom AI Assistants with different prompts and backing knowledge sets. -* Connect Onyx with LLM of your choice (self-host for a fully airgapped solution). -* Document Search + AI Answers for natural language queries. -* Connectors to all common workplace tools like Google Drive, Confluence, Slack, etc. -* Slack integration to get answers and search results directly in Slack. - +- Chat UI with the ability to select documents to chat with. +- Create custom AI Assistants with different prompts and backing knowledge sets. +- Connect Onyx with LLM of your choice (self-host for a fully airgapped solution). +- Document Search + AI Answers for natural language queries. +- Connectors to all common workplace tools like Google Drive, Confluence, Slack, etc. +- Slack integration to get answers and search results directly in Slack. ## 🚧 Roadmap -* Chat/Prompt sharing with specific teammates and user groups. -* Multimodal model support, chat with images, video etc. -* Choosing between LLMs and parameters during chat session. -* Tool calling and agent configurations options. -* Organizational understanding and ability to locate and suggest experts from your team. +- Chat/Prompt sharing with specific teammates and user groups. +- Multimodal model support, chat with images, video etc. +- Choosing between LLMs and parameters during chat session. +- Tool calling and agent configurations options. +- Organizational understanding and ability to locate and suggest experts from your team. ## Other Notable Benefits of Onyx -* User Authentication with document level access management. -* Best in class Hybrid Search across all sources (BM-25 + prefix aware embedding models). -* Admin Dashboard to configure connectors, document-sets, access, etc. -* Custom deep learning models + learn from user feedback. -* Easy deployment and ability to host Onyx anywhere of your choosing. +- User Authentication with document level access management. +- Best in class Hybrid Search across all sources (BM-25 + prefix aware embedding models). +- Admin Dashboard to configure connectors, document-sets, access, etc. +- Custom deep learning models + learn from user feedback. +- Easy deployment and ability to host Onyx anywhere of your choosing. ## 🔌 Connectors + Efficiently pulls the latest changes from: - * Slack - * GitHub - * Google Drive - * Confluence - * Jira - * Zendesk - * Gmail - * Notion - * Gong - * Slab - * Linear - * Productboard - * Guru - * Bookstack - * Document360 - * Sharepoint - * Hubspot - * Local Files - * Websites - * And more ... + +- Slack +- GitHub +- Google Drive +- Confluence +- Jira +- Zendesk +- Gmail +- Notion +- Gong +- Slab +- Linear +- Productboard +- Guru +- Bookstack +- Document360 +- Sharepoint +- Hubspot +- Local Files +- Websites +- And more ... ## 📚 Editions There are two editions of Onyx: - * Onyx Community Edition (CE) is available freely under the MIT Expat license. This version has ALL the core features discussed above. This is the version of Onyx you will get if you follow the Deployment guide above. - * Onyx Enterprise Edition (EE) includes extra features that are primarily useful for larger organizations. Specifically, this includes: - * Single Sign-On (SSO), with support for both SAML and OIDC - * Role-based access control - * Document permission inheritance from connected sources - * Usage analytics and query history accessible to admins - * Whitelabeling - * API key authentication - * Encryption of secrets - * Any many more! Checkout [our website](https://www.onyx.app/) for the latest. +- Onyx Community Edition (CE) is available freely under the MIT Expat license. This version has ALL the core features discussed above. This is the version of Onyx you will get if you follow the Deployment guide above. +- Onyx Enterprise Edition (EE) includes extra features that are primarily useful for larger organizations. Specifically, this includes: + - Single Sign-On (SSO), with support for both SAML and OIDC + - Role-based access control + - Document permission inheritance from connected sources + - Usage analytics and query history accessible to admins + - Whitelabeling + - API key authentication + - Encryption of secrets + - Any many more! Checkout [our website](https://www.onyx.app/) for the latest. -To try the Onyx Enterprise Edition: +To try the Onyx Enterprise Edition: - 1. Checkout our [Cloud product](https://cloud.onyx.app/signup). - 2. For self-hosting, contact us at [founders@onyx.app](mailto:founders@onyx.app) or book a call with us on our [Cal](https://cal.com/team/danswer/founders). +1. Checkout our [Cloud product](https://cloud.onyx.app/signup). +2. For self-hosting, contact us at [founders@onyx.app](mailto:founders@onyx.app) or book a call with us on our [Cal](https://cal.com/team/danswer/founders). ## 💡 Contributing + Looking to contribute? Please check out the [Contribution Guide](CONTRIBUTING.md) for more details. ## ⭐Star History diff --git a/backend/Dockerfile b/backend/Dockerfile index d77b4e8737e..c24d358e3f2 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,11 +1,11 @@ FROM python:3.11.7-slim-bookworm -LABEL com.danswer.maintainer="founders@danswer.ai" -LABEL com.danswer.description="This image is the web/frontend container of Danswer which \ -contains code for both the Community and Enterprise editions of Danswer. If you do not \ +LABEL com.danswer.maintainer="founders@onyx.app" +LABEL com.danswer.description="This image is the web/frontend container of Onyx which \ +contains code for both the Community and Enterprise editions of Onyx. If you do not \ have a contract or agreement with DanswerAI, you are not permitted to use the Enterprise \ Edition features outside of personal development or testing purposes. Please reach out to \ -founders@danswer.ai for more information. Please visit https://github.com/danswer-ai/danswer" +founders@onyx.app for more information. Please visit https://github.com/onyx-dot-app/onyx" # Default DANSWER_VERSION, typically overriden during builds by GitHub Actions. ARG DANSWER_VERSION=0.8-dev @@ -56,7 +56,7 @@ RUN pip install --no-cache-dir --upgrade \ # Cleanup for CVEs and size reduction # https://github.com/tornadoweb/tornado/issues/3107 # xserver-common and xvfb included by playwright installation but not needed after -# perl-base is part of the base Python Debian image but not needed for Danswer functionality +# perl-base is part of the base Python Debian image but not needed for Onyx functionality # perl-base could only be removed with --allow-remove-essential RUN apt-get update && \ apt-get remove -y --allow-remove-essential \ @@ -92,7 +92,7 @@ COPY ./ee /app/ee COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Set up application files -COPY ./danswer /app/danswer +COPY ./onyx /app/onyx COPY ./shared_configs /app/shared_configs COPY ./alembic /app/alembic COPY ./alembic_tenants /app/alembic_tenants diff --git a/backend/Dockerfile.model_server b/backend/Dockerfile.model_server index c7b6d2006d0..8c97d842fd4 100644 --- a/backend/Dockerfile.model_server +++ b/backend/Dockerfile.model_server @@ -1,10 +1,10 @@ FROM python:3.11.7-slim-bookworm -LABEL com.danswer.maintainer="founders@danswer.ai" -LABEL com.danswer.description="This image is for the Danswer model server which runs all of the \ -AI models for Danswer. This container and all the code is MIT Licensed and free for all to use. \ -You can find it at https://hub.docker.com/r/danswer/danswer-model-server. For more details, \ -visit https://github.com/danswer-ai/danswer." +LABEL com.danswer.maintainer="founders@onyx.app" +LABEL com.danswer.description="This image is for the Onyx model server which runs all of the \ +AI models for Onyx. This container and all the code is MIT Licensed and free for all to use. \ +You can find it at https://hub.docker.com/r/onyx/onyx-model-server. For more details, \ +visit https://github.com/onyx-dot-app/onyx." # Default DANSWER_VERSION, typically overriden during builds by GitHub Actions. ARG DANSWER_VERSION=0.8-dev @@ -20,11 +20,11 @@ RUN pip install --no-cache-dir --upgrade \ --timeout 30 \ -r /tmp/requirements.txt -RUN apt-get remove -y --allow-remove-essential perl-base && \ +RUN apt-get remove -y --allow-remove-essential perl-base && \ apt-get autoremove -y # Pre-downloading models for setups with limited egress -# Download tokenizers, distilbert for the Danswer model +# Download tokenizers, distilbert for the Onyx model # Download model weights # Run Nomic to pull in the custom architecture and have it cached locally RUN python -c "from transformers import AutoTokenizer; \ @@ -38,18 +38,18 @@ from sentence_transformers import SentenceTransformer; \ SentenceTransformer(model_name_or_path='nomic-ai/nomic-embed-text-v1', trust_remote_code=True);" # In case the user has volumes mounted to /root/.cache/huggingface that they've downloaded while -# running Danswer, don't overwrite it with the built in cache folder +# running Onyx, don't overwrite it with the built in cache folder RUN mv /root/.cache/huggingface /root/.cache/temp_huggingface WORKDIR /app # Utils used by model server -COPY ./danswer/utils/logger.py /app/danswer/utils/logger.py +COPY ./onyx/utils/logger.py /app/onyx/utils/logger.py # Place to fetch version information -COPY ./danswer/__init__.py /app/danswer/__init__.py +COPY ./onyx/__init__.py /app/onyx/__init__.py -# Shared between Danswer Backend and Model Server +# Shared between Onyx Backend and Model Server COPY ./shared_configs /app/shared_configs # Model Server main code diff --git a/backend/alembic/README.md b/backend/alembic/README.md index 3337cb4f236..d0db9276661 100644 --- a/backend/alembic/README.md +++ b/backend/alembic/README.md @@ -1,19 +1,22 @@ - + # Alembic DB Migrations + These files are for creating/updating the tables in the Relational DB (Postgres). -Danswer migrations use a generic single-database configuration with an async dbapi. +Onyx migrations use a generic single-database configuration with an async dbapi. + +## To generate new migrations: -## To generate new migrations: -run from danswer/backend: +run from onyx/backend: `alembic revision --autogenerate -m ` More info can be found here: https://alembic.sqlalchemy.org/en/latest/autogenerate.html ## Running migrations + To run all un-applied migrations: `alembic upgrade head` To undo migrations: -`alembic downgrade -X` +`alembic downgrade -X` where X is the number of migrations you want to undo from the current state diff --git a/backend/alembic/env.py b/backend/alembic/env.py index 6f9ecdbfced..0953512c9d4 100644 --- a/backend/alembic/env.py +++ b/backend/alembic/env.py @@ -11,10 +11,10 @@ from sqlalchemy.sql.schema import SchemaItem from shared_configs.configs import MULTI_TENANT -from danswer.db.engine import build_connection_string -from danswer.db.models import Base +from onyx.db.engine import build_connection_string +from onyx.db.models import Base from celery.backends.database.session import ResultModelBase # type: ignore -from danswer.db.engine import get_all_tenant_ids +from onyx.db.engine import get_all_tenant_ids from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA # Alembic Config object diff --git a/backend/alembic/versions/0a98909f2757_enable_encrypted_fields.py b/backend/alembic/versions/0a98909f2757_enable_encrypted_fields.py index 29993d1e263..4a4b016b3e8 100644 --- a/backend/alembic/versions/0a98909f2757_enable_encrypted_fields.py +++ b/backend/alembic/versions/0a98909f2757_enable_encrypted_fields.py @@ -11,7 +11,7 @@ from sqlalchemy.dialects import postgresql import json -from danswer.utils.encryption import encrypt_string_to_bytes +from onyx.utils.encryption import encrypt_string_to_bytes # revision identifiers, used by Alembic. revision = "0a98909f2757" diff --git a/backend/alembic/versions/15326fcec57e_introduce_danswer_apis.py b/backend/alembic/versions/15326fcec57e_introduce_onyx_apis.py similarity index 91% rename from backend/alembic/versions/15326fcec57e_introduce_danswer_apis.py rename to backend/alembic/versions/15326fcec57e_introduce_onyx_apis.py index aecb60c21ad..82d14e51e90 100644 --- a/backend/alembic/versions/15326fcec57e_introduce_danswer_apis.py +++ b/backend/alembic/versions/15326fcec57e_introduce_onyx_apis.py @@ -1,4 +1,4 @@ -"""Introduce Danswer APIs +"""Introduce Onyx APIs Revision ID: 15326fcec57e Revises: 77d07dffae64 @@ -8,7 +8,7 @@ from alembic import op import sqlalchemy as sa -from danswer.configs.constants import DocumentSource +from onyx.configs.constants import DocumentSource # revision identifiers, used by Alembic. revision = "15326fcec57e" diff --git a/backend/alembic/versions/1f60f60c3401_embedding_model_search_settings.py b/backend/alembic/versions/1f60f60c3401_embedding_model_search_settings.py index f5b21c81d8e..5a4ddd3085e 100644 --- a/backend/alembic/versions/1f60f60c3401_embedding_model_search_settings.py +++ b/backend/alembic/versions/1f60f60c3401_embedding_model_search_settings.py @@ -10,7 +10,7 @@ import sqlalchemy as sa from sqlalchemy.dialects import postgresql -from danswer.configs.chat_configs import NUM_POSTPROCESSED_RESULTS +from onyx.configs.chat_configs import NUM_POSTPROCESSED_RESULTS # revision identifiers, used by Alembic. revision = "1f60f60c3401" diff --git a/backend/alembic/versions/46625e4745d4_remove_native_enum.py b/backend/alembic/versions/46625e4745d4_remove_native_enum.py index 53c0ffdd0e1..f2cb0590aa5 100644 --- a/backend/alembic/versions/46625e4745d4_remove_native_enum.py +++ b/backend/alembic/versions/46625e4745d4_remove_native_enum.py @@ -17,7 +17,7 @@ def upgrade() -> None: # At this point, we directly changed some previous migrations, - # https://github.com/danswer-ai/danswer/pull/637 + # https://github.com/onyx-dot-app/onyx/pull/637 # Due to using Postgres native Enums, it caused some complications for first time users. # To remove those complications, all Enums are only handled application side moving forward. # This migration exists to ensure that existing users don't run into upgrade issues. diff --git a/backend/alembic/versions/4ee1287bd26a_add_multiple_slack_bot_support.py b/backend/alembic/versions/4ee1287bd26a_add_multiple_slack_bot_support.py index e29f388beb2..7b2432e6e32 100644 --- a/backend/alembic/versions/4ee1287bd26a_add_multiple_slack_bot_support.py +++ b/backend/alembic/versions/4ee1287bd26a_add_multiple_slack_bot_support.py @@ -10,8 +10,8 @@ from alembic import op import sqlalchemy as sa from sqlalchemy.orm import Session -from danswer.key_value_store.factory import get_kv_store -from danswer.db.models import SlackBot +from onyx.key_value_store.factory import get_kv_store +from onyx.db.models import SlackBot from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. diff --git a/backend/alembic/versions/54a74a0417fc_danswerbot_onyxbot.py b/backend/alembic/versions/54a74a0417fc_danswerbot_onyxbot.py new file mode 100644 index 00000000000..3f22074d295 --- /dev/null +++ b/backend/alembic/versions/54a74a0417fc_danswerbot_onyxbot.py @@ -0,0 +1,23 @@ +"""danswerbot -> onyxbot + +Revision ID: 54a74a0417fc +Revises: 94dc3d0236f8 +Create Date: 2024-12-11 18:05:05.490737 + +""" +from alembic import op + + +# revision identifiers, used by Alembic. +revision = "54a74a0417fc" +down_revision = "94dc3d0236f8" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.alter_column("chat_session", "danswerbot_flow", new_column_name="onyxbot_flow") + + +def downgrade() -> None: + op.alter_column("chat_session", "onyxbot_flow", new_column_name="danswerbot_flow") diff --git a/backend/alembic/versions/570282d33c49_track_danswerbot_explicitly.py b/backend/alembic/versions/570282d33c49_track_onyxbot_explicitly.py similarity index 95% rename from backend/alembic/versions/570282d33c49_track_danswerbot_explicitly.py rename to backend/alembic/versions/570282d33c49_track_onyxbot_explicitly.py index f8c0b647240..3f04ed344c9 100644 --- a/backend/alembic/versions/570282d33c49_track_danswerbot_explicitly.py +++ b/backend/alembic/versions/570282d33c49_track_onyxbot_explicitly.py @@ -1,4 +1,4 @@ -"""Track Danswerbot Explicitly +"""Track Onyxbot Explicitly Revision ID: 570282d33c49 Revises: 7547d982db8f diff --git a/backend/alembic/versions/703313b75876_add_tokenratelimit_tables.py b/backend/alembic/versions/703313b75876_add_tokenratelimit_tables.py index 9e1fdf3cb9e..ed4331d28a7 100644 --- a/backend/alembic/versions/703313b75876_add_tokenratelimit_tables.py +++ b/backend/alembic/versions/703313b75876_add_tokenratelimit_tables.py @@ -9,7 +9,7 @@ from typing import cast from alembic import op import sqlalchemy as sa -from danswer.key_value_store.factory import get_kv_store +from onyx.key_value_store.factory import get_kv_store # revision identifiers, used by Alembic. revision = "703313b75876" diff --git a/backend/alembic/versions/776b3bbe9092_remove_remaining_enums.py b/backend/alembic/versions/776b3bbe9092_remove_remaining_enums.py index 09c0f7209d4..8e67d230a1e 100644 --- a/backend/alembic/versions/776b3bbe9092_remove_remaining_enums.py +++ b/backend/alembic/versions/776b3bbe9092_remove_remaining_enums.py @@ -8,9 +8,9 @@ from alembic import op import sqlalchemy as sa -from danswer.db.models import IndexModelStatus -from danswer.context.search.enums import RecencyBiasSetting -from danswer.context.search.enums import SearchType +from onyx.db.models import IndexModelStatus +from onyx.context.search.enums import RecencyBiasSetting +from onyx.context.search.enums import SearchType # revision identifiers, used by Alembic. revision = "776b3bbe9092" diff --git a/backend/alembic/versions/77d07dffae64_forcibly_remove_more_enum_types_from_.py b/backend/alembic/versions/77d07dffae64_forcibly_remove_more_enum_types_from_.py index c953feb3133..6e34d26ce0b 100644 --- a/backend/alembic/versions/77d07dffae64_forcibly_remove_more_enum_types_from_.py +++ b/backend/alembic/versions/77d07dffae64_forcibly_remove_more_enum_types_from_.py @@ -18,7 +18,7 @@ def upgrade() -> None: # In a PR: - # https://github.com/danswer-ai/danswer/pull/397/files#diff-f05fb341f6373790b91852579631b64ca7645797a190837156a282b67e5b19c2 + # https://github.com/onyx-dot-app/onyx/pull/397/files#diff-f05fb341f6373790b91852579631b64ca7645797a190837156a282b67e5b19c2 # we directly changed some previous migrations. This caused some users to have native enums # while others wouldn't. This has caused some issues when adding new fields to these enums. # This migration manually changes the enum types to ensure that nobody uses native enums. diff --git a/backend/alembic/versions/91fd3b470d1a_remove_documentsource_from_tag.py b/backend/alembic/versions/91fd3b470d1a_remove_documentsource_from_tag.py index dc8749b9a75..559c8bf10c3 100644 --- a/backend/alembic/versions/91fd3b470d1a_remove_documentsource_from_tag.py +++ b/backend/alembic/versions/91fd3b470d1a_remove_documentsource_from_tag.py @@ -7,7 +7,7 @@ """ from alembic import op import sqlalchemy as sa -from danswer.configs.constants import DocumentSource +from onyx.configs.constants import DocumentSource # revision identifiers, used by Alembic. revision = "91fd3b470d1a" diff --git a/backend/alembic/versions/949b4a92a401_remove_rt.py b/backend/alembic/versions/949b4a92a401_remove_rt.py index 5d4f63ff87e..34757f6aade 100644 --- a/backend/alembic/versions/949b4a92a401_remove_rt.py +++ b/backend/alembic/versions/949b4a92a401_remove_rt.py @@ -10,7 +10,7 @@ from sqlalchemy import text # Import your models and constants -from danswer.db.models import ( +from onyx.db.models import ( Connector, ConnectorCredentialPair, Credential, diff --git a/backend/alembic/versions/b156fa702355_chat_reworked.py b/backend/alembic/versions/b156fa702355_chat_reworked.py index a6d75fb508b..2753a126563 100644 --- a/backend/alembic/versions/b156fa702355_chat_reworked.py +++ b/backend/alembic/versions/b156fa702355_chat_reworked.py @@ -10,7 +10,7 @@ import sqlalchemy as sa from sqlalchemy.dialects import postgresql from sqlalchemy.dialects.postgresql import ENUM -from danswer.configs.constants import DocumentSource +from onyx.configs.constants import DocumentSource # revision identifiers, used by Alembic. revision = "b156fa702355" diff --git a/backend/alembic/versions/dba7f71618f5_danswer_custom_tool_flow.py b/backend/alembic/versions/dba7f71618f5_onyx_custom_tool_flow.py similarity index 95% rename from backend/alembic/versions/dba7f71618f5_danswer_custom_tool_flow.py rename to backend/alembic/versions/dba7f71618f5_onyx_custom_tool_flow.py index 7512038cdd3..55436137d2b 100644 --- a/backend/alembic/versions/dba7f71618f5_danswer_custom_tool_flow.py +++ b/backend/alembic/versions/dba7f71618f5_onyx_custom_tool_flow.py @@ -1,4 +1,4 @@ -"""Danswer Custom Tool Flow +"""Onyx Custom Tool Flow Revision ID: dba7f71618f5 Revises: d5645c915d0e diff --git a/backend/alembic/versions/dbaa756c2ccf_embedding_models.py b/backend/alembic/versions/dbaa756c2ccf_embedding_models.py index 6274b3e1334..7309fe27c03 100644 --- a/backend/alembic/versions/dbaa756c2ccf_embedding_models.py +++ b/backend/alembic/versions/dbaa756c2ccf_embedding_models.py @@ -9,12 +9,12 @@ import sqlalchemy as sa from sqlalchemy import table, column, String, Integer, Boolean -from danswer.db.search_settings import ( +from onyx.db.search_settings import ( get_new_default_embedding_model, get_old_default_embedding_model, user_has_overridden_embedding_model, ) -from danswer.db.models import IndexModelStatus +from onyx.db.models import IndexModelStatus # revision identifiers, used by Alembic. revision = "dbaa756c2ccf" diff --git a/backend/alembic/versions/e50154680a5c_no_source_enum.py b/backend/alembic/versions/e50154680a5c_no_source_enum.py index 8a7ccc751bf..f8b6a882ea7 100644 --- a/backend/alembic/versions/e50154680a5c_no_source_enum.py +++ b/backend/alembic/versions/e50154680a5c_no_source_enum.py @@ -8,7 +8,7 @@ from alembic import op import sqlalchemy as sa -from danswer.configs.constants import DocumentSource +from onyx.configs.constants import DocumentSource # revision identifiers, used by Alembic. revision = "e50154680a5c" diff --git a/backend/alembic_tenants/README.md b/backend/alembic_tenants/README.md index f075b958305..4b6f870745a 100644 --- a/backend/alembic_tenants/README.md +++ b/backend/alembic_tenants/README.md @@ -1,3 +1,3 @@ These files are for public table migrations when operating with multi tenancy. -If you are not a Danswer developer, you can ignore this directory entirely. \ No newline at end of file +If you are not a Onyx developer, you can ignore this directory entirely. diff --git a/backend/alembic_tenants/env.py b/backend/alembic_tenants/env.py index 506dbda0313..c04a9863fa3 100644 --- a/backend/alembic_tenants/env.py +++ b/backend/alembic_tenants/env.py @@ -8,8 +8,8 @@ from sqlalchemy.schema import SchemaItem from alembic import context -from danswer.db.engine import build_connection_string -from danswer.db.models import PublicBase +from onyx.db.engine import build_connection_string +from onyx.db.models import PublicBase # this is the Alembic Config object, which provides # access to the values within the .ini file in use. diff --git a/backend/danswer/background/celery/tasks/beat_schedule.py b/backend/danswer/background/celery/tasks/beat_schedule.py deleted file mode 100644 index 6d65bb01654..00000000000 --- a/backend/danswer/background/celery/tasks/beat_schedule.py +++ /dev/null @@ -1,61 +0,0 @@ -from datetime import timedelta -from typing import Any - -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryTask - - -tasks_to_schedule = [ - { - "name": "check-for-vespa-sync", - "task": DanswerCeleryTask.CHECK_FOR_VESPA_SYNC_TASK, - "schedule": timedelta(seconds=20), - "options": {"priority": DanswerCeleryPriority.HIGH}, - }, - { - "name": "check-for-connector-deletion", - "task": DanswerCeleryTask.CHECK_FOR_CONNECTOR_DELETION, - "schedule": timedelta(seconds=20), - "options": {"priority": DanswerCeleryPriority.HIGH}, - }, - { - "name": "check-for-indexing", - "task": DanswerCeleryTask.CHECK_FOR_INDEXING, - "schedule": timedelta(seconds=15), - "options": {"priority": DanswerCeleryPriority.HIGH}, - }, - { - "name": "check-for-prune", - "task": DanswerCeleryTask.CHECK_FOR_PRUNING, - "schedule": timedelta(seconds=15), - "options": {"priority": DanswerCeleryPriority.HIGH}, - }, - { - "name": "kombu-message-cleanup", - "task": DanswerCeleryTask.KOMBU_MESSAGE_CLEANUP_TASK, - "schedule": timedelta(seconds=3600), - "options": {"priority": DanswerCeleryPriority.LOWEST}, - }, - { - "name": "monitor-vespa-sync", - "task": DanswerCeleryTask.MONITOR_VESPA_SYNC, - "schedule": timedelta(seconds=5), - "options": {"priority": DanswerCeleryPriority.HIGH}, - }, - { - "name": "check-for-doc-permissions-sync", - "task": DanswerCeleryTask.CHECK_FOR_DOC_PERMISSIONS_SYNC, - "schedule": timedelta(seconds=30), - "options": {"priority": DanswerCeleryPriority.HIGH}, - }, - { - "name": "check-for-external-group-sync", - "task": DanswerCeleryTask.CHECK_FOR_EXTERNAL_GROUP_SYNC, - "schedule": timedelta(seconds=20), - "options": {"priority": DanswerCeleryPriority.HIGH}, - }, -] - - -def get_tasks_to_schedule() -> list[dict[str, Any]]: - return tasks_to_schedule diff --git a/backend/danswer/background/celery/versioned_apps/primary.py b/backend/danswer/background/celery/versioned_apps/primary.py deleted file mode 100644 index f07a63b2e1a..00000000000 --- a/backend/danswer/background/celery/versioned_apps/primary.py +++ /dev/null @@ -1,10 +0,0 @@ -"""Factory stub for running celery worker / celery beat.""" -from celery import Celery - -from danswer.utils.variable_functionality import fetch_versioned_implementation -from danswer.utils.variable_functionality import set_is_ee_based_on_env_variable - -set_is_ee_based_on_env_variable() -app: Celery = fetch_versioned_implementation( - "danswer.background.celery.apps.primary", "celery_app" -) diff --git a/backend/danswer/danswerbot/slack/icons.py b/backend/danswer/danswerbot/slack/icons.py deleted file mode 100644 index 895fcfdc897..00000000000 --- a/backend/danswer/danswerbot/slack/icons.py +++ /dev/null @@ -1,58 +0,0 @@ -from danswer.configs.constants import DocumentSource - - -def source_to_github_img_link(source: DocumentSource) -> str | None: - # TODO: store these images somewhere better - if source == DocumentSource.WEB.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/backend/slackbot_images/Web.png" - if source == DocumentSource.FILE.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/backend/slackbot_images/File.png" - if source == DocumentSource.GOOGLE_SITES.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/GoogleSites.png" - if source == DocumentSource.SLACK.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Slack.png" - if source == DocumentSource.GMAIL.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Gmail.png" - if source == DocumentSource.GOOGLE_DRIVE.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/GoogleDrive.png" - if source == DocumentSource.GITHUB.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Github.png" - if source == DocumentSource.GITLAB.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Gitlab.png" - if source == DocumentSource.CONFLUENCE.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/backend/slackbot_images/Confluence.png" - if source == DocumentSource.JIRA.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/backend/slackbot_images/Jira.png" - if source == DocumentSource.NOTION.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Notion.png" - if source == DocumentSource.ZENDESK.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/backend/slackbot_images/Zendesk.png" - if source == DocumentSource.GONG.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Gong.png" - if source == DocumentSource.LINEAR.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Linear.png" - if source == DocumentSource.PRODUCTBOARD.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Productboard.webp" - if source == DocumentSource.SLAB.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/SlabLogo.png" - if source == DocumentSource.ZULIP.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Zulip.png" - if source == DocumentSource.GURU.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/backend/slackbot_images/Guru.png" - if source == DocumentSource.HUBSPOT.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/HubSpot.png" - if source == DocumentSource.DOCUMENT360.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Document360.png" - if source == DocumentSource.BOOKSTACK.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Bookstack.png" - if source == DocumentSource.LOOPIO.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Loopio.png" - if source == DocumentSource.SHAREPOINT.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/web/public/Sharepoint.png" - if source == DocumentSource.REQUESTTRACKER.value: - # just use file icon for now - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/backend/slackbot_images/File.png" - if source == DocumentSource.INGESTION_API.value: - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/backend/slackbot_images/File.png" - - return "https://raw.githubusercontent.com/danswer-ai/danswer/main/backend/slackbot_images/File.png" diff --git a/backend/danswer/seeding/initial_docs_cohere.json b/backend/danswer/seeding/initial_docs_cohere.json deleted file mode 100644 index cb8331b6e43..00000000000 --- a/backend/danswer/seeding/initial_docs_cohere.json +++ /dev/null @@ -1,44 +0,0 @@ -[ - { - "url": "https://docs.danswer.dev/more/use_cases/overview", - "title": "Use Cases Overview", - "content": "How to leverage Danswer in your organization\n\nDanswer Overview\nDanswer is the AI Assistant connected to your organization's docs, apps, and people. Danswer makes Generative AI more versatile for work by enabling new types of questions like \"What is the most common feature request we've heard from customers this month\". Whereas other AI systems have no context of your team and are generally unhelpful with work related questions, Danswer makes it possible to ask these questions in natural language and get back answers in seconds.\n\nDanswer can connect to +30 different tools and the use cases are not limited to the ones in the following pages. The highlighted use cases are for inspiration and come from feedback gathered from our users and customers.\n\n\nCommon Getting Started Questions:\n\nWhy are these docs connected in my Danswer deployment?\nAnswer: This is just an example of how connectors work in Danswer. You can connect up your own team's knowledge and you will be able to ask questions unique to your organization. Danswer will keep all of the knowledge up to date and in sync with your connected applications.\n\nIs my data being sent anywhere when I connect it up to Danswer?\nAnswer: No! Danswer is built with data security as our highest priority. We open sourced it so our users can know exactly what is going on with their data. By default all of the document processing happens within Danswer. The only time it is sent outward is for the GenAI call to generate answers.\n\nWhere is the feature for auto sync-ing document level access permissions from all connected sources?\nAnswer: This falls under the Enterprise Edition set of Danswer features built on top of the MIT/community edition. If you are on Danswer Cloud, you have access to them by default. If you're running it yourself, reach out to the Danswer team to receive access.", - "chunk_ind": 0 - }, - { - "url": "https://docs.danswer.dev/more/use_cases/enterprise_search", - "title": "Enterprise Search", - "content": "Value of Enterprise Search with Danswer\n\nWhat is Enterprise Search and why is it Important?\nAn Enterprise Search system gives team members a single place to access all of the disparate knowledge of an organization. Critical information is saved across a host of channels like call transcripts with prospects, engineering design docs, IT runbooks, customer support email exchanges, project management tickets, and more. As fast moving teams scale up, information gets spread out and more disorganized.\n\nSince it quickly becomes infeasible to check across every source, decisions get made on incomplete information, employee satisfaction decreases, and the most valuable members of your team are tied up with constant distractions as junior teammates are unable to unblock themselves. Danswer solves this problem by letting anyone on the team access all of the knowledge across your organization in a permissioned and secure way. Users can ask questions in natural language and get back answers and documents across all of the connected sources instantly.\n\nWhat's the real cost?\nA typical knowledge worker spends over 2 hours a week on search, but more than that, the cost of incomplete or incorrect information can be extremely high. Customer support/success that isn't able to find the reference to similar cases could cause hours or even days of delay leading to lower customer satisfaction or in the worst case - churn. An account exec not realizing that a prospect had previously mentioned a specific need could lead to lost deals. An engineer not realizing a similar feature had previously been built could result in weeks of wasted development time and tech debt with duplicate implementation. With a lack of knowledge, your whole organization is navigating in the dark - inefficient and mistake prone.", - "chunk_ind": 0 - }, - { - "url": "https://docs.danswer.dev/more/use_cases/enterprise_search", - "title": "Enterprise Search", - "content": "More than Search\nWhen analyzing the entire corpus of knowledge within your company is as easy as asking a question in a search bar, your entire team can stay informed and up to date. Danswer also makes it trivial to identify where knowledge is well documented and where it is lacking. Team members who are centers of knowledge can begin to effectively document their expertise since it is no longer being thrown into a black hole. All of this allows the organization to achieve higher efficiency and drive business outcomes.\n\nWith Generative AI, the entire user experience has evolved as well. For example, instead of just finding similar cases for your customer support team to reference, Danswer breaks down the issue and explains it so that even the most junior members can understand it. This in turn lets them give the most holistic and technically accurate response possible to your customers. On the other end, even the super stars of your sales team will not be able to review 10 hours of transcripts before hopping on that critical call, but Danswer can easily parse through it in mere seconds and give crucial context to help your team close.", - "chunk_ind": 0 - }, - { - "url": "https://docs.danswer.dev/more/use_cases/ai_platform", - "title": "AI Platform", - "content": "Build AI Agents powered by the knowledge and workflows specific to your organization.\n\nBeyond Answers\nAgents enabled by generative AI and reasoning capable models are helping teams to automate their work. Danswer is helping teams make it happen. Danswer provides out of the box user chat sessions, attaching custom tools, handling LLM reasoning, code execution, data analysis, referencing internal knowledge, and much more.\n\nDanswer as a platform is not a no-code agent builder. We are made by developers for developers and this gives your team the full flexibility and power to create agents not constrained by blocks and simple logic paths.\n\nFlexibility and Extensibility\nDanswer is open source and completely whitebox. This not only gives transparency to what happens within the system but also means that your team can directly modify the source code to suit your unique needs.", - "chunk_ind": 0 - }, - { - "url": "https://docs.danswer.dev/more/use_cases/customer_support", - "title": "Customer Support", - "content": "Help your customer support team instantly answer any question across your entire product.\n\nAI Enabled Support\nCustomer support agents have one of the highest breadth jobs. They field requests that cover the entire surface area of the product and need to help your users find success on extremely short timelines. Because they're not the same people who designed or built the system, they often lack the depth of understanding needed - resulting in delays and escalations to other teams. Modern teams are leveraging AI to help their CS team optimize the speed and quality of these critical customer-facing interactions.\n\nThe Importance of Context\nThere are two critical components of AI copilots for customer support. The first is that the AI system needs to be connected with as much information as possible (not just support tools like Zendesk or Intercom) and that the knowledge needs to be as fresh as possible. Sometimes a fix might even be in places rarely checked by CS such as pull requests in a code repository. The second critical component is the ability of the AI system to break down difficult concepts and convoluted processes into more digestible descriptions and for your team members to be able to chat back and forth with the system to build a better understanding.\n\nDanswer takes care of both of these. The system connects up to over 30+ different applications and the knowledge is pulled in constantly so that the information access is always up to date.", - "chunk_ind": 0 - }, - { - "url": "https://docs.danswer.dev/more/use_cases/sales", - "title": "Sales", - "content": "Keep your team up to date on every conversation and update so they can close.\n\nRecall Every Detail\nBeing able to instantly revisit every detail of any call without reading transcripts is helping Sales teams provide more tailored pitches, build stronger relationships, and close more deals. Instead of searching and reading through hours of transcripts in preparation for a call, your team can now ask Danswer \"What specific features was ACME interested in seeing for the demo\". Since your team doesn't have time to read every transcript prior to a call, Danswer provides a more thorough summary because it can instantly parse hundreds of pages and distill out the relevant information. Even for fast lookups it becomes much more convenient - for example to brush up on connection building topics by asking \"What rapport building topic did we chat about in the last call with ACME\".\n\nKnow Every Product Update\nIt is impossible for Sales teams to keep up with every product update. Because of this, when a prospect has a question that the Sales team does not know, they have no choice but to rely on the Product and Engineering orgs to get an authoritative answer. Not only is this distracting to the other teams, it also slows down the time to respond to the prospect (and as we know, time is the biggest killer of deals). With Danswer, it is even possible to get answers live on call because of how fast accessing information becomes. A question like \"Have we shipped the Microsoft AD integration yet?\" can now be answered in seconds meaning that prospects can get answers while on the call instead of asynchronously and sales cycles are reduced as a result.", - "chunk_ind": 0 - }, - { - "url": "https://docs.danswer.dev/more/use_cases/operations", - "title": "Operations", - "content": "Double the productivity of your Ops teams like IT, HR, etc.\n\nAutomatically Resolve Tickets\nModern teams are leveraging AI to auto-resolve up to 50% of tickets. Whether it is an employee asking about benefits details or how to set up the VPN for remote work, Danswer can help your team help themselves. This frees up your team to do the real impactful work of landing star candidates or improving your internal processes.\n\nAI Aided Onboarding\nOne of the periods where your team needs the most help is when they're just ramping up. Instead of feeling lost in dozens of new tools, Danswer gives them a single place where they can ask about anything in natural language. Whether it's how to set up their work environment or what their onboarding goals are, Danswer can walk them through every step with the help of Generative AI. This lets your team feel more empowered and gives time back to the more seasoned members of your team to focus on moving the needle.", - "chunk_ind": 0 - } -] diff --git a/backend/ee/LICENSE b/backend/ee/LICENSE index 1f2d7c15faa..034eb0995f0 100644 --- a/backend/ee/LICENSE +++ b/backend/ee/LICENSE @@ -1,20 +1,20 @@ The DanswerAI Enterprise license (the “Enterprise License”) Copyright (c) 2023-present DanswerAI, Inc. -With regard to the Danswer Software: +With regard to the Onyx Software: This software and associated documentation files (the "Software") may only be used in production, if you (and any entity that you represent) have agreed to, and are in compliance with, the DanswerAI Subscription Terms of Service, available -at https://danswer.ai/terms (the “Enterprise Terms”), or other +at https://onyx.app/terms (the “Enterprise Terms”), or other agreement governing the use of the Software, as agreed by you and DanswerAI, -and otherwise have a valid Danswer Enterprise license for the +and otherwise have a valid Onyx Enterprise license for the correct number of user seats. Subject to the foregoing sentence, you are free to modify this Software and publish patches to the Software. You agree that DanswerAI and/or its licensors (as applicable) retain all right, title and interest in and to all such modifications and/or patches, and all such modifications and/or patches may only be used, copied, modified, displayed, distributed, or otherwise -exploited with a valid Danswer Enterprise license for the correct +exploited with a valid Onyx Enterprise license for the correct number of user seats. Notwithstanding the foregoing, you may copy and modify the Software for development and testing purposes, without requiring a subscription. You agree that DanswerAI and/or its licensors (as applicable) retain @@ -31,6 +31,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -For all third party components incorporated into the Danswer Software, those +For all third party components incorporated into the Onyx Software, those components are licensed under the original license provided by the owner of the applicable component. diff --git a/backend/danswer/access/__init__.py b/backend/ee/onyx/__init__.py similarity index 100% rename from backend/danswer/access/__init__.py rename to backend/ee/onyx/__init__.py diff --git a/backend/ee/danswer/access/access.py b/backend/ee/onyx/access/access.py similarity index 83% rename from backend/ee/danswer/access/access.py rename to backend/ee/onyx/access/access.py index 094298677a5..684b575ac43 100644 --- a/backend/ee/danswer/access/access.py +++ b/backend/ee/onyx/access/access.py @@ -1,17 +1,17 @@ from sqlalchemy.orm import Session -from danswer.access.access import ( +from ee.onyx.db.external_perm import fetch_external_groups_for_user +from ee.onyx.db.user_group import fetch_user_groups_for_documents +from ee.onyx.db.user_group import fetch_user_groups_for_user +from onyx.access.access import ( _get_access_for_documents as get_access_for_documents_without_groups, ) -from danswer.access.access import _get_acl_for_user as get_acl_for_user_without_groups -from danswer.access.models import DocumentAccess -from danswer.access.utils import prefix_external_group -from danswer.access.utils import prefix_user_group -from danswer.db.document import get_documents_by_ids -from danswer.db.models import User -from ee.danswer.db.external_perm import fetch_external_groups_for_user -from ee.danswer.db.user_group import fetch_user_groups_for_documents -from ee.danswer.db.user_group import fetch_user_groups_for_user +from onyx.access.access import _get_acl_for_user as get_acl_for_user_without_groups +from onyx.access.models import DocumentAccess +from onyx.access.utils import prefix_external_group +from onyx.access.utils import prefix_user_group +from onyx.db.document import get_documents_by_ids +from onyx.db.models import User def _get_access_for_document( @@ -69,7 +69,7 @@ def _get_access_for_documents( ) # If the document is determined to be "public" externally (through a SYNC connector) - # then it's given the same access level as if it were marked public within Danswer + # then it's given the same access level as if it were marked public within Onyx is_public_anywhere = document.is_public or non_ee_access.is_public # To avoid collisions of group namings between connectors, they need to be prefixed @@ -89,7 +89,7 @@ def _get_acl_for_user(user: User | None, db_session: Session) -> set[str]: user should have access to a document if at least one entry in the document's ACL matches one entry in the returned set. - NOTE: is imported in danswer.access.access by `fetch_versioned_implementation` + NOTE: is imported in onyx.access.access by `fetch_versioned_implementation` DO NOT REMOVE.""" db_user_groups = fetch_user_groups_for_user(db_session, user.id) if user else [] prefixed_user_groups = [ diff --git a/backend/danswer/auth/__init__.py b/backend/ee/onyx/auth/__init__.py similarity index 100% rename from backend/danswer/auth/__init__.py rename to backend/ee/onyx/auth/__init__.py diff --git a/backend/ee/danswer/auth/users.py b/backend/ee/onyx/auth/users.py similarity index 85% rename from backend/ee/danswer/auth/users.py rename to backend/ee/onyx/auth/users.py index 3d44acc5ec2..033c884752e 100644 --- a/backend/ee/danswer/auth/users.py +++ b/backend/ee/onyx/auth/users.py @@ -12,17 +12,17 @@ from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession -from danswer.auth.users import current_admin_user -from danswer.configs.app_configs import AUTH_TYPE -from danswer.configs.constants import AuthType -from danswer.db.models import User -from danswer.utils.logger import setup_logger -from ee.danswer.configs.app_configs import JWT_PUBLIC_KEY_URL -from ee.danswer.configs.app_configs import SUPER_CLOUD_API_KEY -from ee.danswer.configs.app_configs import SUPER_USERS -from ee.danswer.db.saml import get_saml_account -from ee.danswer.server.seeding import get_seed_config -from ee.danswer.utils.secrets import extract_hashed_cookie +from ee.onyx.configs.app_configs import JWT_PUBLIC_KEY_URL +from ee.onyx.configs.app_configs import SUPER_CLOUD_API_KEY +from ee.onyx.configs.app_configs import SUPER_USERS +from ee.onyx.db.saml import get_saml_account +from ee.onyx.server.seeding import get_seed_config +from ee.onyx.utils.secrets import extract_hashed_cookie +from onyx.auth.users import current_admin_user +from onyx.configs.app_configs import AUTH_TYPE +from onyx.configs.constants import AuthType +from onyx.db.models import User +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/background/celery/apps/primary.py b/backend/ee/onyx/background/celery/apps/primary.py similarity index 74% rename from backend/ee/danswer/background/celery/apps/primary.py rename to backend/ee/onyx/background/celery/apps/primary.py index 21644228484..79361efad4a 100644 --- a/backend/ee/danswer/background/celery/apps/primary.py +++ b/backend/ee/onyx/background/celery/apps/primary.py @@ -1,13 +1,13 @@ -from danswer.background.celery.apps.primary import celery_app -from danswer.background.task_utils import build_celery_task_wrapper -from danswer.configs.app_configs import JOB_TIMEOUT -from danswer.db.chat import delete_chat_sessions_older_than -from danswer.db.engine import get_session_with_tenant -from danswer.server.settings.store import load_settings -from danswer.utils.logger import setup_logger -from ee.danswer.background.celery_utils import should_perform_chat_ttl_check -from ee.danswer.background.task_name_builders import name_chat_ttl_task -from ee.danswer.server.reporting.usage_export_generation import create_new_usage_report +from ee.onyx.background.celery_utils import should_perform_chat_ttl_check +from ee.onyx.background.task_name_builders import name_chat_ttl_task +from ee.onyx.server.reporting.usage_export_generation import create_new_usage_report +from onyx.background.celery.apps.primary import celery_app +from onyx.background.task_utils import build_celery_task_wrapper +from onyx.configs.app_configs import JOB_TIMEOUT +from onyx.db.chat import delete_chat_sessions_older_than +from onyx.db.engine import get_session_with_tenant +from onyx.server.settings.store import load_settings +from onyx.utils.logger import setup_logger from shared_configs.configs import MULTI_TENANT from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR diff --git a/backend/ee/danswer/background/celery/tasks/beat_schedule.py b/backend/ee/onyx/background/celery/tasks/beat_schedule.py similarity index 66% rename from backend/ee/danswer/background/celery/tasks/beat_schedule.py rename to backend/ee/onyx/background/celery/tasks/beat_schedule.py index 4444d73544f..670b2ebbfbb 100644 --- a/backend/ee/danswer/background/celery/tasks/beat_schedule.py +++ b/backend/ee/onyx/background/celery/tasks/beat_schedule.py @@ -1,20 +1,20 @@ from datetime import timedelta from typing import Any -from danswer.background.celery.tasks.beat_schedule import ( +from onyx.background.celery.tasks.beat_schedule import ( tasks_to_schedule as base_tasks_to_schedule, ) -from danswer.configs.constants import DanswerCeleryTask +from onyx.configs.constants import OnyxCeleryTask ee_tasks_to_schedule = [ { "name": "autogenerate_usage_report", - "task": DanswerCeleryTask.AUTOGENERATE_USAGE_REPORT_TASK, + "task": OnyxCeleryTask.AUTOGENERATE_USAGE_REPORT_TASK, "schedule": timedelta(days=30), # TODO: change this to config flag }, { "name": "check-ttl-management", - "task": DanswerCeleryTask.CHECK_TTL_MANAGEMENT_TASK, + "task": OnyxCeleryTask.CHECK_TTL_MANAGEMENT_TASK, "schedule": timedelta(hours=1), }, ] diff --git a/backend/ee/danswer/background/celery/tasks/vespa/tasks.py b/backend/ee/onyx/background/celery/tasks/vespa/tasks.py similarity index 82% rename from backend/ee/danswer/background/celery/tasks/vespa/tasks.py rename to backend/ee/onyx/background/celery/tasks/vespa/tasks.py index 84d67f0a3ac..4d4e94c1b63 100644 --- a/backend/ee/danswer/background/celery/tasks/vespa/tasks.py +++ b/backend/ee/onyx/background/celery/tasks/vespa/tasks.py @@ -3,12 +3,12 @@ from redis import Redis from sqlalchemy.orm import Session -from danswer.background.celery.apps.app_base import task_logger -from danswer.redis.redis_usergroup import RedisUserGroup -from danswer.utils.logger import setup_logger -from ee.danswer.db.user_group import delete_user_group -from ee.danswer.db.user_group import fetch_user_group -from ee.danswer.db.user_group import mark_user_group_as_synced +from ee.onyx.db.user_group import delete_user_group +from ee.onyx.db.user_group import fetch_user_group +from ee.onyx.db.user_group import mark_user_group_as_synced +from onyx.background.celery.apps.app_base import task_logger +from onyx.redis.redis_usergroup import RedisUserGroup +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/background/celery_utils.py b/backend/ee/onyx/background/celery_utils.py similarity index 73% rename from backend/ee/danswer/background/celery_utils.py rename to backend/ee/onyx/background/celery_utils.py index f6fff26cf41..9254c49a901 100644 --- a/backend/ee/danswer/background/celery_utils.py +++ b/backend/ee/onyx/background/celery_utils.py @@ -1,9 +1,9 @@ from sqlalchemy.orm import Session -from danswer.db.tasks import check_task_is_live_and_not_timed_out -from danswer.db.tasks import get_latest_task -from danswer.utils.logger import setup_logger -from ee.danswer.background.task_name_builders import name_chat_ttl_task +from ee.onyx.background.task_name_builders import name_chat_ttl_task +from onyx.db.tasks import check_task_is_live_and_not_timed_out +from onyx.db.tasks import get_latest_task +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/background/task_name_builders.py b/backend/ee/onyx/background/task_name_builders.py similarity index 100% rename from backend/ee/danswer/background/task_name_builders.py rename to backend/ee/onyx/background/task_name_builders.py diff --git a/backend/ee/danswer/chat/process_message.py b/backend/ee/onyx/chat/process_message.py similarity index 59% rename from backend/ee/danswer/chat/process_message.py rename to backend/ee/onyx/chat/process_message.py index e28ef97e2ce..546d3bf318e 100644 --- a/backend/ee/danswer/chat/process_message.py +++ b/backend/ee/onyx/chat/process_message.py @@ -1,13 +1,13 @@ -from danswer.chat.models import AllCitations -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import DanswerContexts -from danswer.chat.models import LLMRelevanceFilterResponse -from danswer.chat.models import QADocsResponse -from danswer.chat.models import StreamingError -from danswer.chat.process_message import ChatPacketStream -from danswer.server.query_and_chat.models import ChatMessageDetail -from danswer.utils.timing import log_function_time -from ee.danswer.server.query_and_chat.models import OneShotQAResponse +from ee.onyx.server.query_and_chat.models import OneShotQAResponse +from onyx.chat.models import AllCitations +from onyx.chat.models import LLMRelevanceFilterResponse +from onyx.chat.models import OnyxAnswerPiece +from onyx.chat.models import OnyxContexts +from onyx.chat.models import QADocsResponse +from onyx.chat.models import StreamingError +from onyx.chat.process_message import ChatPacketStream +from onyx.server.query_and_chat.models import ChatMessageDetail +from onyx.utils.timing import log_function_time @log_function_time() @@ -18,7 +18,7 @@ def gather_stream_for_answer_api( answer = "" for packet in packets: - if isinstance(packet, DanswerAnswerPiece) and packet.answer_piece: + if isinstance(packet, OnyxAnswerPiece) and packet.answer_piece: answer += packet.answer_piece elif isinstance(packet, QADocsResponse): response.docs = packet @@ -32,7 +32,7 @@ def gather_stream_for_answer_api( response.llm_selected_doc_indices = packet.llm_selected_doc_indices elif isinstance(packet, AllCitations): response.citations = packet.citations - elif isinstance(packet, DanswerContexts): + elif isinstance(packet, OnyxContexts): response.contexts = packet if answer: diff --git a/backend/danswer/chat/__init__.py b/backend/ee/onyx/configs/__init__.py similarity index 100% rename from backend/danswer/chat/__init__.py rename to backend/ee/onyx/configs/__init__.py diff --git a/backend/ee/danswer/configs/app_configs.py b/backend/ee/onyx/configs/app_configs.py similarity index 90% rename from backend/ee/danswer/configs/app_configs.py rename to backend/ee/onyx/configs/app_configs.py index a4753a002d5..a23ab4cc96c 100644 --- a/backend/ee/danswer/configs/app_configs.py +++ b/backend/ee/onyx/configs/app_configs.py @@ -5,7 +5,7 @@ OPENID_CONFIG_URL = os.environ.get("OPENID_CONFIG_URL", "") # Applicable for SAML Auth -SAML_CONF_DIR = os.environ.get("SAML_CONF_DIR") or "/app/ee/danswer/configs/saml_config" +SAML_CONF_DIR = os.environ.get("SAML_CONF_DIR") or "/app/ee/onyx/configs/saml_config" ##### @@ -34,7 +34,7 @@ # Super Users -SUPER_USERS = json.loads(os.environ.get("SUPER_USERS", '["pablo@danswer.ai"]')) +SUPER_USERS = json.loads(os.environ.get("SUPER_USERS", "[]")) SUPER_CLOUD_API_KEY = os.environ.get("SUPER_CLOUD_API_KEY", "api_key") OAUTH_SLACK_CLIENT_ID = os.environ.get("OAUTH_SLACK_CLIENT_ID", "") diff --git a/backend/ee/danswer/configs/saml_config/template.settings.json b/backend/ee/onyx/configs/saml_config/template.settings.json similarity index 89% rename from backend/ee/danswer/configs/saml_config/template.settings.json rename to backend/ee/onyx/configs/saml_config/template.settings.json index e3c828944af..26d363af298 100644 --- a/backend/ee/danswer/configs/saml_config/template.settings.json +++ b/backend/ee/onyx/configs/saml_config/template.settings.json @@ -4,7 +4,7 @@ "idp": { "entityId": "", "singleSignOnService": { - "url": " https://trial-1234567.okta.com/home/trial-1234567_danswer/somevalues/somevalues", + "url": " https://trial-1234567.okta.com/home/trial-1234567_onyx/somevalues/somevalues", "binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" }, "x509cert": "" diff --git a/backend/danswer/configs/__init__.py b/backend/ee/onyx/db/__init__.py similarity index 100% rename from backend/danswer/configs/__init__.py rename to backend/ee/onyx/db/__init__.py diff --git a/backend/ee/danswer/db/analytics.py b/backend/ee/onyx/db/analytics.py similarity index 94% rename from backend/ee/danswer/db/analytics.py rename to backend/ee/onyx/db/analytics.py index 8d27af06899..b19524f7e96 100644 --- a/backend/ee/danswer/db/analytics.py +++ b/backend/ee/onyx/db/analytics.py @@ -10,10 +10,10 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.configs.constants import MessageType -from danswer.db.models import ChatMessage -from danswer.db.models import ChatMessageFeedback -from danswer.db.models import ChatSession +from onyx.configs.constants import MessageType +from onyx.db.models import ChatMessage +from onyx.db.models import ChatMessageFeedback +from onyx.db.models import ChatSession def fetch_query_analytics( @@ -83,18 +83,18 @@ def fetch_per_user_query_analytics( return db_session.execute(stmt).all() # type: ignore -def fetch_danswerbot_analytics( +def fetch_onyxbot_analytics( start: datetime.datetime, end: datetime.datetime, db_session: Session, ) -> Sequence[tuple[int, int, datetime.date]]: """Gets the: Date of each set of aggregated statistics - Number of DanswerBot Queries (Chat Sessions) + Number of OnyxBot Queries (Chat Sessions) Number of instances of Negative feedback OR Needing additional help (only counting the last feedback) """ - # Get every chat session in the time range which is a Danswerbot flow + # Get every chat session in the time range which is a Onyxbot flow # along with the first Assistant message which is the response to the user question. # Generally there should not be more than one AI message per chat session of this type subquery_first_ai_response = ( @@ -106,7 +106,7 @@ def fetch_danswerbot_analytics( .where( ChatSession.time_created >= start, ChatSession.time_created <= end, - ChatSession.danswerbot_flow.is_(True), + ChatSession.onyxbot_flow.is_(True), ) .where( ChatMessage.message_type == MessageType.ASSISTANT, @@ -130,7 +130,7 @@ def fetch_danswerbot_analytics( db_session.query( func.count(ChatSession.id).label("total_sessions"), # Need to explicitly specify this as False to handle the NULL case so the cases without - # feedback aren't counted against Danswerbot + # feedback aren't counted against Onyxbot func.sum( case( ( @@ -150,7 +150,7 @@ def fetch_danswerbot_analytics( ChatSession.id == subquery_first_ai_response.c.chat_session_id, ) # Combine the chat sessions with latest feedback to get the latest feedback for the first AI - # message of the chat session where the chat session is Danswerbot type and within the time + # message of the chat session where the chat session is Onyxbot type and within the time # range specified. Left/outer join used here to ensure that if no feedback, a null is used # for the feedback id .outerjoin( diff --git a/backend/ee/danswer/db/connector.py b/backend/ee/onyx/db/connector.py similarity index 71% rename from backend/ee/danswer/db/connector.py rename to backend/ee/onyx/db/connector.py index 44505f51510..aa6194ecd20 100644 --- a/backend/ee/danswer/db/connector.py +++ b/backend/ee/onyx/db/connector.py @@ -1,9 +1,9 @@ from sqlalchemy import distinct from sqlalchemy.orm import Session -from danswer.configs.constants import DocumentSource -from danswer.db.models import Connector -from danswer.utils.logger import setup_logger +from onyx.configs.constants import DocumentSource +from onyx.db.models import Connector +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/db/connector_credential_pair.py b/backend/ee/onyx/db/connector_credential_pair.py similarity index 81% rename from backend/ee/danswer/db/connector_credential_pair.py rename to backend/ee/onyx/db/connector_credential_pair.py index fea6caba61b..0ba1a6f2b6b 100644 --- a/backend/ee/danswer/db/connector_credential_pair.py +++ b/backend/ee/onyx/db/connector_credential_pair.py @@ -1,13 +1,13 @@ from sqlalchemy import delete from sqlalchemy.orm import Session -from danswer.configs.constants import DocumentSource -from danswer.db.connector_credential_pair import get_connector_credential_pair -from danswer.db.enums import AccessType -from danswer.db.models import Connector -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import UserGroup__ConnectorCredentialPair -from danswer.utils.logger import setup_logger +from onyx.configs.constants import DocumentSource +from onyx.db.connector_credential_pair import get_connector_credential_pair +from onyx.db.enums import AccessType +from onyx.db.models import Connector +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import UserGroup__ConnectorCredentialPair +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/db/document.py b/backend/ee/onyx/db/document.py similarity index 94% rename from backend/ee/danswer/db/document.py rename to backend/ee/onyx/db/document.py index ec1d5741314..2ec5a3623c1 100644 --- a/backend/ee/danswer/db/document.py +++ b/backend/ee/onyx/db/document.py @@ -4,10 +4,10 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.access.models import ExternalAccess -from danswer.access.utils import prefix_group_w_source -from danswer.configs.constants import DocumentSource -from danswer.db.models import Document as DbDocument +from onyx.access.models import ExternalAccess +from onyx.access.utils import prefix_group_w_source +from onyx.configs.constants import DocumentSource +from onyx.db.models import Document as DbDocument def upsert_document_external_perms__no_commit( diff --git a/backend/ee/danswer/db/document_set.py b/backend/ee/onyx/db/document_set.py similarity index 91% rename from backend/ee/danswer/db/document_set.py rename to backend/ee/onyx/db/document_set.py index bcbd06874da..e564a8e0166 100644 --- a/backend/ee/danswer/db/document_set.py +++ b/backend/ee/onyx/db/document_set.py @@ -2,13 +2,13 @@ from sqlalchemy.orm import Session -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import DocumentSet -from danswer.db.models import DocumentSet__ConnectorCredentialPair -from danswer.db.models import DocumentSet__User -from danswer.db.models import DocumentSet__UserGroup -from danswer.db.models import User__UserGroup -from danswer.db.models import UserGroup +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import DocumentSet +from onyx.db.models import DocumentSet__ConnectorCredentialPair +from onyx.db.models import DocumentSet__User +from onyx.db.models import DocumentSet__UserGroup +from onyx.db.models import User__UserGroup +from onyx.db.models import UserGroup def make_doc_set_private( diff --git a/backend/ee/danswer/db/external_perm.py b/backend/ee/onyx/db/external_perm.py similarity index 91% rename from backend/ee/danswer/db/external_perm.py rename to backend/ee/onyx/db/external_perm.py index 7121130e3eb..97039f36d13 100644 --- a/backend/ee/danswer/db/external_perm.py +++ b/backend/ee/onyx/db/external_perm.py @@ -6,11 +6,11 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.access.utils import prefix_group_w_source -from danswer.configs.constants import DocumentSource -from danswer.db.models import User__ExternalUserGroupId -from danswer.db.users import batch_add_ext_perm_user_if_not_exists -from danswer.utils.logger import setup_logger +from onyx.access.utils import prefix_group_w_source +from onyx.configs.constants import DocumentSource +from onyx.db.models import User__ExternalUserGroupId +from onyx.db.users import batch_add_ext_perm_user_if_not_exists +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/db/persona.py b/backend/ee/onyx/db/persona.py similarity index 89% rename from backend/ee/danswer/db/persona.py rename to backend/ee/onyx/db/persona.py index a7e257278c9..910877fd0fa 100644 --- a/backend/ee/danswer/db/persona.py +++ b/backend/ee/onyx/db/persona.py @@ -2,8 +2,8 @@ from sqlalchemy.orm import Session -from danswer.db.models import Persona__User -from danswer.db.models import Persona__UserGroup +from onyx.db.models import Persona__User +from onyx.db.models import Persona__UserGroup def make_persona_private( diff --git a/backend/ee/danswer/db/query_history.py b/backend/ee/onyx/db/query_history.py similarity index 95% rename from backend/ee/danswer/db/query_history.py rename to backend/ee/onyx/db/query_history.py index 8fb77f0a2dd..c2b3612a508 100644 --- a/backend/ee/danswer/db/query_history.py +++ b/backend/ee/onyx/db/query_history.py @@ -10,8 +10,8 @@ from sqlalchemy.orm import Session from sqlalchemy.sql.expression import UnaryExpression -from danswer.db.models import ChatMessage -from danswer.db.models import ChatSession +from onyx.db.models import ChatMessage +from onyx.db.models import ChatSession SortByOptions = Literal["time_sent"] diff --git a/backend/ee/danswer/db/saml.py b/backend/ee/onyx/db/saml.py similarity index 94% rename from backend/ee/danswer/db/saml.py rename to backend/ee/onyx/db/saml.py index a7f0f7e1661..3b9afa1e227 100644 --- a/backend/ee/danswer/db/saml.py +++ b/backend/ee/onyx/db/saml.py @@ -9,8 +9,8 @@ from sqlalchemy.orm import selectinload from sqlalchemy.orm import Session -from danswer.configs.app_configs import SESSION_EXPIRE_TIME_SECONDS -from danswer.db.models import SamlAccount +from onyx.configs.app_configs import SESSION_EXPIRE_TIME_SECONDS +from onyx.db.models import SamlAccount def upsert_saml_account( diff --git a/backend/ee/danswer/db/standard_answer.py b/backend/ee/onyx/db/standard_answer.py similarity index 98% rename from backend/ee/danswer/db/standard_answer.py rename to backend/ee/onyx/db/standard_answer.py index 0fa074e36a7..2c235d55148 100644 --- a/backend/ee/danswer/db/standard_answer.py +++ b/backend/ee/onyx/db/standard_answer.py @@ -5,9 +5,9 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.db.models import StandardAnswer -from danswer.db.models import StandardAnswerCategory -from danswer.utils.logger import setup_logger +from onyx.db.models import StandardAnswer +from onyx.db.models import StandardAnswerCategory +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/db/token_limit.py b/backend/ee/onyx/db/token_limit.py similarity index 90% rename from backend/ee/danswer/db/token_limit.py rename to backend/ee/onyx/db/token_limit.py index 46f5e2d5e73..47d78e1fd26 100644 --- a/backend/ee/danswer/db/token_limit.py +++ b/backend/ee/onyx/db/token_limit.py @@ -7,14 +7,14 @@ from sqlalchemy.orm import aliased from sqlalchemy.orm import Session -from danswer.configs.constants import TokenRateLimitScope -from danswer.db.models import TokenRateLimit -from danswer.db.models import TokenRateLimit__UserGroup -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.db.models import UserGroup -from danswer.db.models import UserRole -from danswer.server.token_rate_limits.models import TokenRateLimitArgs +from onyx.configs.constants import TokenRateLimitScope +from onyx.db.models import TokenRateLimit +from onyx.db.models import TokenRateLimit__UserGroup +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.db.models import UserGroup +from onyx.db.models import UserRole +from onyx.server.token_rate_limits.models import TokenRateLimitArgs def _add_user_filters( diff --git a/backend/ee/danswer/db/usage_export.py b/backend/ee/onyx/db/usage_export.py similarity index 85% rename from backend/ee/danswer/db/usage_export.py rename to backend/ee/onyx/db/usage_export.py index 0958c624e33..affd61e0ac6 100644 --- a/backend/ee/danswer/db/usage_export.py +++ b/backend/ee/onyx/db/usage_export.py @@ -7,13 +7,13 @@ from fastapi_users_db_sqlalchemy import UUID_ID from sqlalchemy.orm import Session -from danswer.configs.constants import MessageType -from danswer.db.models import UsageReport -from danswer.file_store.file_store import get_default_file_store -from ee.danswer.db.query_history import fetch_chat_sessions_eagerly_by_time -from ee.danswer.server.reporting.usage_export_models import ChatMessageSkeleton -from ee.danswer.server.reporting.usage_export_models import FlowType -from ee.danswer.server.reporting.usage_export_models import UsageReportMetadata +from ee.onyx.db.query_history import fetch_chat_sessions_eagerly_by_time +from ee.onyx.server.reporting.usage_export_models import ChatMessageSkeleton +from ee.onyx.server.reporting.usage_export_models import FlowType +from ee.onyx.server.reporting.usage_export_models import UsageReportMetadata +from onyx.configs.constants import MessageType +from onyx.db.models import UsageReport +from onyx.file_store.file_store import get_default_file_store # Gets skeletons of all message @@ -33,7 +33,7 @@ def get_empty_chat_messages_entries__paginated( message_skeletons: list[ChatMessageSkeleton] = [] for chat_session in chat_sessions: - flow_type = FlowType.SLACK if chat_session.danswerbot_flow else FlowType.CHAT + flow_type = FlowType.SLACK if chat_session.onyxbot_flow else FlowType.CHAT for message in chat_session.messages: # Only count user messages diff --git a/backend/ee/danswer/db/user_group.py b/backend/ee/onyx/db/user_group.py similarity index 95% rename from backend/ee/danswer/db/user_group.py rename to backend/ee/onyx/db/user_group.py index 187f7c7b901..3463d717c38 100644 --- a/backend/ee/danswer/db/user_group.py +++ b/backend/ee/onyx/db/user_group.py @@ -10,27 +10,27 @@ from sqlalchemy import update from sqlalchemy.orm import Session -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import Credential__UserGroup -from danswer.db.models import Document -from danswer.db.models import DocumentByConnectorCredentialPair -from danswer.db.models import DocumentSet__UserGroup -from danswer.db.models import LLMProvider__UserGroup -from danswer.db.models import Persona__UserGroup -from danswer.db.models import TokenRateLimit__UserGroup -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.db.models import UserGroup -from danswer.db.models import UserGroup__ConnectorCredentialPair -from danswer.db.models import UserRole -from danswer.db.users import fetch_user_by_id -from danswer.utils.logger import setup_logger -from ee.danswer.server.user_group.models import SetCuratorRequest -from ee.danswer.server.user_group.models import UserGroupCreate -from ee.danswer.server.user_group.models import UserGroupUpdate +from ee.onyx.server.user_group.models import SetCuratorRequest +from ee.onyx.server.user_group.models import UserGroupCreate +from ee.onyx.server.user_group.models import UserGroupUpdate +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import Credential__UserGroup +from onyx.db.models import Document +from onyx.db.models import DocumentByConnectorCredentialPair +from onyx.db.models import DocumentSet__UserGroup +from onyx.db.models import LLMProvider__UserGroup +from onyx.db.models import Persona__UserGroup +from onyx.db.models import TokenRateLimit__UserGroup +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.db.models import UserGroup +from onyx.db.models import UserGroup__ConnectorCredentialPair +from onyx.db.models import UserRole +from onyx.db.users import fetch_user_by_id +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/__init__.py b/backend/ee/onyx/external_permissions/__init__.py similarity index 100% rename from backend/danswer/connectors/__init__.py rename to backend/ee/onyx/external_permissions/__init__.py diff --git a/backend/danswer/connectors/asana/__init__.py b/backend/ee/onyx/external_permissions/confluence/__init__.py similarity index 100% rename from backend/danswer/connectors/asana/__init__.py rename to backend/ee/onyx/external_permissions/confluence/__init__.py diff --git a/backend/ee/danswer/external_permissions/confluence/doc_sync.py b/backend/ee/onyx/external_permissions/confluence/doc_sync.py similarity index 95% rename from backend/ee/danswer/external_permissions/confluence/doc_sync.py rename to backend/ee/onyx/external_permissions/confluence/doc_sync.py index 94f02409375..3e2a44480d1 100644 --- a/backend/ee/danswer/external_permissions/confluence/doc_sync.py +++ b/backend/ee/onyx/external_permissions/confluence/doc_sync.py @@ -4,14 +4,14 @@ """ from typing import Any -from danswer.access.models import DocExternalAccess -from danswer.access.models import ExternalAccess -from danswer.connectors.confluence.connector import ConfluenceConnector -from danswer.connectors.confluence.onyx_confluence import OnyxConfluence -from danswer.connectors.confluence.utils import get_user_email_from_username__server -from danswer.connectors.models import SlimDocument -from danswer.db.models import ConnectorCredentialPair -from danswer.utils.logger import setup_logger +from onyx.access.models import DocExternalAccess +from onyx.access.models import ExternalAccess +from onyx.connectors.confluence.connector import ConfluenceConnector +from onyx.connectors.confluence.onyx_confluence import OnyxConfluence +from onyx.connectors.confluence.utils import get_user_email_from_username__server +from onyx.connectors.models import SlimDocument +from onyx.db.models import ConnectorCredentialPair +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/external_permissions/confluence/group_sync.py b/backend/ee/onyx/external_permissions/confluence/group_sync.py similarity index 79% rename from backend/ee/danswer/external_permissions/confluence/group_sync.py rename to backend/ee/onyx/external_permissions/confluence/group_sync.py index 8f3f3e43fc6..e81c84eb29c 100644 --- a/backend/ee/danswer/external_permissions/confluence/group_sync.py +++ b/backend/ee/onyx/external_permissions/confluence/group_sync.py @@ -1,9 +1,9 @@ -from danswer.connectors.confluence.onyx_confluence import build_confluence_client -from danswer.connectors.confluence.onyx_confluence import OnyxConfluence -from danswer.connectors.confluence.utils import get_user_email_from_username__server -from danswer.db.models import ConnectorCredentialPair -from danswer.utils.logger import setup_logger -from ee.danswer.db.external_perm import ExternalUserGroup +from ee.onyx.db.external_perm import ExternalUserGroup +from onyx.connectors.confluence.onyx_confluence import build_confluence_client +from onyx.connectors.confluence.onyx_confluence import OnyxConfluence +from onyx.connectors.confluence.utils import get_user_email_from_username__server +from onyx.db.models import ConnectorCredentialPair +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -52,13 +52,13 @@ def confluence_group_sync( group_member_email_map = _build_group_member_email_map( confluence_client=confluence_client, ) - danswer_groups: list[ExternalUserGroup] = [] + onyx_groups: list[ExternalUserGroup] = [] for group_id, group_member_emails in group_member_email_map.items(): - danswer_groups.append( + onyx_groups.append( ExternalUserGroup( id=group_id, user_emails=list(group_member_emails), ) ) - return danswer_groups + return onyx_groups diff --git a/backend/ee/danswer/external_permissions/gmail/doc_sync.py b/backend/ee/onyx/external_permissions/gmail/doc_sync.py similarity index 85% rename from backend/ee/danswer/external_permissions/gmail/doc_sync.py rename to backend/ee/onyx/external_permissions/gmail/doc_sync.py index 6b72e7ba116..5860f401815 100644 --- a/backend/ee/danswer/external_permissions/gmail/doc_sync.py +++ b/backend/ee/onyx/external_permissions/gmail/doc_sync.py @@ -1,12 +1,12 @@ from datetime import datetime from datetime import timezone -from danswer.access.models import DocExternalAccess -from danswer.access.models import ExternalAccess -from danswer.connectors.gmail.connector import GmailConnector -from danswer.connectors.interfaces import GenerateSlimDocumentOutput -from danswer.db.models import ConnectorCredentialPair -from danswer.utils.logger import setup_logger +from onyx.access.models import DocExternalAccess +from onyx.access.models import ExternalAccess +from onyx.connectors.gmail.connector import GmailConnector +from onyx.connectors.interfaces import GenerateSlimDocumentOutput +from onyx.db.models import ConnectorCredentialPair +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/axero/__init__.py b/backend/ee/onyx/external_permissions/google_drive/__init__.py similarity index 100% rename from backend/danswer/connectors/axero/__init__.py rename to backend/ee/onyx/external_permissions/google_drive/__init__.py diff --git a/backend/ee/danswer/external_permissions/google_drive/doc_sync.py b/backend/ee/onyx/external_permissions/google_drive/doc_sync.py similarity index 90% rename from backend/ee/danswer/external_permissions/google_drive/doc_sync.py rename to backend/ee/onyx/external_permissions/google_drive/doc_sync.py index 10792b0ae7f..381975219ed 100644 --- a/backend/ee/danswer/external_permissions/google_drive/doc_sync.py +++ b/backend/ee/onyx/external_permissions/google_drive/doc_sync.py @@ -2,15 +2,15 @@ from datetime import timezone from typing import Any -from danswer.access.models import DocExternalAccess -from danswer.access.models import ExternalAccess -from danswer.connectors.google_drive.connector import GoogleDriveConnector -from danswer.connectors.google_utils.google_utils import execute_paginated_retrieval -from danswer.connectors.google_utils.resources import get_drive_service -from danswer.connectors.interfaces import GenerateSlimDocumentOutput -from danswer.connectors.models import SlimDocument -from danswer.db.models import ConnectorCredentialPair -from danswer.utils.logger import setup_logger +from onyx.access.models import DocExternalAccess +from onyx.access.models import ExternalAccess +from onyx.connectors.google_drive.connector import GoogleDriveConnector +from onyx.connectors.google_utils.google_utils import execute_paginated_retrieval +from onyx.connectors.google_utils.resources import get_drive_service +from onyx.connectors.interfaces import GenerateSlimDocumentOutput +from onyx.connectors.models import SlimDocument +from onyx.db.models import ConnectorCredentialPair +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/external_permissions/google_drive/group_sync.py b/backend/ee/onyx/external_permissions/google_drive/group_sync.py similarity index 71% rename from backend/ee/danswer/external_permissions/google_drive/group_sync.py rename to backend/ee/onyx/external_permissions/google_drive/group_sync.py index 0f421f371b9..4fc15da00d4 100644 --- a/backend/ee/danswer/external_permissions/google_drive/group_sync.py +++ b/backend/ee/onyx/external_permissions/google_drive/group_sync.py @@ -1,9 +1,9 @@ -from danswer.connectors.google_drive.connector import GoogleDriveConnector -from danswer.connectors.google_utils.google_utils import execute_paginated_retrieval -from danswer.connectors.google_utils.resources import get_admin_service -from danswer.db.models import ConnectorCredentialPair -from danswer.utils.logger import setup_logger -from ee.danswer.db.external_perm import ExternalUserGroup +from ee.onyx.db.external_perm import ExternalUserGroup +from onyx.connectors.google_drive.connector import GoogleDriveConnector +from onyx.connectors.google_utils.google_utils import execute_paginated_retrieval +from onyx.connectors.google_utils.resources import get_admin_service +from onyx.db.models import ConnectorCredentialPair +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -19,7 +19,7 @@ def gdrive_group_sync( google_drive_connector.creds, google_drive_connector.primary_admin_email ) - danswer_groups: list[ExternalUserGroup] = [] + onyx_groups: list[ExternalUserGroup] = [] for group in execute_paginated_retrieval( admin_service.groups().list, list_key="groups", @@ -42,11 +42,11 @@ def gdrive_group_sync( if not group_member_emails: continue - danswer_groups.append( + onyx_groups.append( ExternalUserGroup( id=group_email, user_emails=list(group_member_emails), ) ) - return danswer_groups + return onyx_groups diff --git a/backend/ee/danswer/external_permissions/slack/doc_sync.py b/backend/ee/onyx/external_permissions/slack/doc_sync.py similarity index 91% rename from backend/ee/danswer/external_permissions/slack/doc_sync.py rename to backend/ee/onyx/external_permissions/slack/doc_sync.py index 24c565fc4e5..ff1e237e337 100644 --- a/backend/ee/danswer/external_permissions/slack/doc_sync.py +++ b/backend/ee/onyx/external_permissions/slack/doc_sync.py @@ -1,13 +1,13 @@ from slack_sdk import WebClient -from danswer.access.models import DocExternalAccess -from danswer.access.models import ExternalAccess -from danswer.connectors.slack.connector import get_channels -from danswer.connectors.slack.connector import make_paginated_slack_api_call_w_retries -from danswer.connectors.slack.connector import SlackPollConnector -from danswer.db.models import ConnectorCredentialPair -from danswer.utils.logger import setup_logger -from ee.danswer.external_permissions.slack.utils import fetch_user_id_to_email_map +from ee.onyx.external_permissions.slack.utils import fetch_user_id_to_email_map +from onyx.access.models import DocExternalAccess +from onyx.access.models import ExternalAccess +from onyx.connectors.slack.connector import get_channels +from onyx.connectors.slack.connector import make_paginated_slack_api_call_w_retries +from onyx.connectors.slack.connector import SlackPollConnector +from onyx.db.models import ConnectorCredentialPair +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/external_permissions/slack/group_sync.py b/backend/ee/onyx/external_permissions/slack/group_sync.py similarity index 84% rename from backend/ee/danswer/external_permissions/slack/group_sync.py rename to backend/ee/onyx/external_permissions/slack/group_sync.py index 780f619e464..da73b5bad42 100644 --- a/backend/ee/danswer/external_permissions/slack/group_sync.py +++ b/backend/ee/onyx/external_permissions/slack/group_sync.py @@ -6,11 +6,11 @@ """ from slack_sdk import WebClient -from danswer.connectors.slack.connector import make_paginated_slack_api_call_w_retries -from danswer.db.models import ConnectorCredentialPair -from danswer.utils.logger import setup_logger -from ee.danswer.db.external_perm import ExternalUserGroup -from ee.danswer.external_permissions.slack.utils import fetch_user_id_to_email_map +from ee.onyx.db.external_perm import ExternalUserGroup +from ee.onyx.external_permissions.slack.utils import fetch_user_id_to_email_map +from onyx.connectors.slack.connector import make_paginated_slack_api_call_w_retries +from onyx.db.models import ConnectorCredentialPair +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -58,7 +58,7 @@ def slack_group_sync( ) user_id_to_email_map = fetch_user_id_to_email_map(slack_client) - danswer_groups: list[ExternalUserGroup] = [] + onyx_groups: list[ExternalUserGroup] = [] for group_name in _get_slack_group_ids(slack_client): group_member_emails = _get_slack_group_members_email( slack_client=slack_client, @@ -67,7 +67,7 @@ def slack_group_sync( ) if not group_member_emails: continue - danswer_groups.append( + onyx_groups.append( ExternalUserGroup(id=group_name, user_emails=group_member_emails) ) - return danswer_groups + return onyx_groups diff --git a/backend/ee/danswer/external_permissions/slack/utils.py b/backend/ee/onyx/external_permissions/slack/utils.py similarity index 85% rename from backend/ee/danswer/external_permissions/slack/utils.py rename to backend/ee/onyx/external_permissions/slack/utils.py index a6a049aee03..85ef2846790 100644 --- a/backend/ee/danswer/external_permissions/slack/utils.py +++ b/backend/ee/onyx/external_permissions/slack/utils.py @@ -1,6 +1,6 @@ from slack_sdk import WebClient -from danswer.connectors.slack.connector import make_paginated_slack_api_call_w_retries +from onyx.connectors.slack.connector import make_paginated_slack_api_call_w_retries def fetch_user_id_to_email_map( diff --git a/backend/ee/danswer/external_permissions/sync_params.py b/backend/ee/onyx/external_permissions/sync_params.py similarity index 69% rename from backend/ee/danswer/external_permissions/sync_params.py rename to backend/ee/onyx/external_permissions/sync_params.py index 3dc4e46b9a1..7b45720f71b 100644 --- a/backend/ee/danswer/external_permissions/sync_params.py +++ b/backend/ee/onyx/external_permissions/sync_params.py @@ -1,17 +1,17 @@ from collections.abc import Callable -from danswer.access.models import DocExternalAccess -from danswer.configs.constants import DocumentSource -from danswer.db.models import ConnectorCredentialPair -from ee.danswer.configs.app_configs import CONFLUENCE_PERMISSION_DOC_SYNC_FREQUENCY -from ee.danswer.configs.app_configs import CONFLUENCE_PERMISSION_GROUP_SYNC_FREQUENCY -from ee.danswer.db.external_perm import ExternalUserGroup -from ee.danswer.external_permissions.confluence.doc_sync import confluence_doc_sync -from ee.danswer.external_permissions.confluence.group_sync import confluence_group_sync -from ee.danswer.external_permissions.gmail.doc_sync import gmail_doc_sync -from ee.danswer.external_permissions.google_drive.doc_sync import gdrive_doc_sync -from ee.danswer.external_permissions.google_drive.group_sync import gdrive_group_sync -from ee.danswer.external_permissions.slack.doc_sync import slack_doc_sync +from ee.onyx.configs.app_configs import CONFLUENCE_PERMISSION_DOC_SYNC_FREQUENCY +from ee.onyx.configs.app_configs import CONFLUENCE_PERMISSION_GROUP_SYNC_FREQUENCY +from ee.onyx.db.external_perm import ExternalUserGroup +from ee.onyx.external_permissions.confluence.doc_sync import confluence_doc_sync +from ee.onyx.external_permissions.confluence.group_sync import confluence_group_sync +from ee.onyx.external_permissions.gmail.doc_sync import gmail_doc_sync +from ee.onyx.external_permissions.google_drive.doc_sync import gdrive_doc_sync +from ee.onyx.external_permissions.google_drive.group_sync import gdrive_group_sync +from ee.onyx.external_permissions.slack.doc_sync import slack_doc_sync +from onyx.access.models import DocExternalAccess +from onyx.configs.constants import DocumentSource +from onyx.db.models import ConnectorCredentialPair # Defining the input/output types for the sync functions DocSyncFuncType = Callable[ diff --git a/backend/ee/danswer/main.py b/backend/ee/onyx/main.py similarity index 65% rename from backend/ee/danswer/main.py rename to backend/ee/onyx/main.py index c1e5977706d..71cae3b7781 100644 --- a/backend/ee/danswer/main.py +++ b/backend/ee/onyx/main.py @@ -2,47 +2,47 @@ from httpx_oauth.clients.google import GoogleOAuth2 from httpx_oauth.clients.openid import OpenID -from danswer.auth.users import auth_backend -from danswer.auth.users import create_danswer_oauth_router -from danswer.auth.users import fastapi_users -from danswer.configs.app_configs import AUTH_TYPE -from danswer.configs.app_configs import OAUTH_CLIENT_ID -from danswer.configs.app_configs import OAUTH_CLIENT_SECRET -from danswer.configs.app_configs import USER_AUTH_SECRET -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.configs.constants import AuthType -from danswer.main import get_application as get_application_base -from danswer.main import include_router_with_global_prefix_prepended -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import global_version -from ee.danswer.configs.app_configs import OPENID_CONFIG_URL -from ee.danswer.server.analytics.api import router as analytics_router -from ee.danswer.server.auth_check import check_ee_router_auth -from ee.danswer.server.enterprise_settings.api import ( +from ee.onyx.configs.app_configs import OPENID_CONFIG_URL +from ee.onyx.server.analytics.api import router as analytics_router +from ee.onyx.server.auth_check import check_ee_router_auth +from ee.onyx.server.enterprise_settings.api import ( admin_router as enterprise_settings_admin_router, ) -from ee.danswer.server.enterprise_settings.api import ( +from ee.onyx.server.enterprise_settings.api import ( basic_router as enterprise_settings_router, ) -from ee.danswer.server.manage.standard_answer import router as standard_answer_router -from ee.danswer.server.middleware.tenant_tracking import add_tenant_id_middleware -from ee.danswer.server.oauth import router as oauth_router -from ee.danswer.server.query_and_chat.chat_backend import ( +from ee.onyx.server.manage.standard_answer import router as standard_answer_router +from ee.onyx.server.middleware.tenant_tracking import add_tenant_id_middleware +from ee.onyx.server.oauth import router as oauth_router +from ee.onyx.server.query_and_chat.chat_backend import ( router as chat_router, ) -from ee.danswer.server.query_and_chat.query_backend import ( +from ee.onyx.server.query_and_chat.query_backend import ( basic_router as query_router, ) -from ee.danswer.server.query_history.api import router as query_history_router -from ee.danswer.server.reporting.usage_export_api import router as usage_export_router -from ee.danswer.server.saml import router as saml_router -from ee.danswer.server.seeding import seed_db -from ee.danswer.server.tenants.api import router as tenants_router -from ee.danswer.server.token_rate_limits.api import ( +from ee.onyx.server.query_history.api import router as query_history_router +from ee.onyx.server.reporting.usage_export_api import router as usage_export_router +from ee.onyx.server.saml import router as saml_router +from ee.onyx.server.seeding import seed_db +from ee.onyx.server.tenants.api import router as tenants_router +from ee.onyx.server.token_rate_limits.api import ( router as token_rate_limit_settings_router, ) -from ee.danswer.server.user_group.api import router as user_group_router -from ee.danswer.utils.encryption import test_encryption +from ee.onyx.server.user_group.api import router as user_group_router +from ee.onyx.utils.encryption import test_encryption +from onyx.auth.users import auth_backend +from onyx.auth.users import create_onyx_oauth_router +from onyx.auth.users import fastapi_users +from onyx.configs.app_configs import AUTH_TYPE +from onyx.configs.app_configs import OAUTH_CLIENT_ID +from onyx.configs.app_configs import OAUTH_CLIENT_SECRET +from onyx.configs.app_configs import USER_AUTH_SECRET +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.configs.constants import AuthType +from onyx.main import get_application as get_application_base +from onyx.main import include_router_with_global_prefix_prepended +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import global_version from shared_configs.configs import MULTI_TENANT logger = setup_logger() @@ -64,7 +64,7 @@ def get_application() -> FastAPI: oauth_client = GoogleOAuth2(OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET) include_router_with_global_prefix_prepended( application, - create_danswer_oauth_router( + create_onyx_oauth_router( oauth_client, auth_backend, USER_AUTH_SECRET, @@ -88,7 +88,7 @@ def get_application() -> FastAPI: if AUTH_TYPE == AuthType.OIDC: include_router_with_global_prefix_prepended( application, - create_danswer_oauth_router( + create_onyx_oauth_router( OpenID(OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, OPENID_CONFIG_URL), auth_backend, USER_AUTH_SECRET, @@ -140,7 +140,7 @@ def get_application() -> FastAPI: # Ensure all routes have auth enabled or are explicitly marked as public check_ee_router_auth(application) - # seed the Danswer environment with LLMs, Assistants, etc. based on an optional + # seed the Onyx environment with LLMs, Assistants, etc. based on an optional # environment variable. Used to automate deployment for multiple environments. seed_db() diff --git a/backend/danswer/connectors/blob/__init__.py b/backend/ee/onyx/onyxbot/slack/handlers/__init__.py similarity index 100% rename from backend/danswer/connectors/blob/__init__.py rename to backend/ee/onyx/onyxbot/slack/handlers/__init__.py diff --git a/backend/ee/danswer/danswerbot/slack/handlers/handle_standard_answers.py b/backend/ee/onyx/onyxbot/slack/handlers/handle_standard_answers.py similarity index 83% rename from backend/ee/danswer/danswerbot/slack/handlers/handle_standard_answers.py rename to backend/ee/onyx/onyxbot/slack/handlers/handle_standard_answers.py index 6c29f9f38a8..478713377d5 100644 --- a/backend/ee/danswer/danswerbot/slack/handlers/handle_standard_answers.py +++ b/backend/ee/onyx/onyxbot/slack/handlers/handle_standard_answers.py @@ -5,27 +5,27 @@ from slack_sdk.models.blocks import SectionBlock from sqlalchemy.orm import Session -from danswer.configs.constants import MessageType -from danswer.configs.danswerbot_configs import DANSWER_REACT_EMOJI -from danswer.danswerbot.slack.blocks import get_restate_blocks -from danswer.danswerbot.slack.constants import GENERATE_ANSWER_BUTTON_ACTION_ID -from danswer.danswerbot.slack.handlers.utils import send_team_member_message -from danswer.danswerbot.slack.models import SlackMessageInfo -from danswer.danswerbot.slack.utils import respond_in_thread -from danswer.danswerbot.slack.utils import update_emote_react -from danswer.db.chat import create_chat_session -from danswer.db.chat import create_new_chat_message -from danswer.db.chat import get_chat_messages_by_sessions -from danswer.db.chat import get_chat_sessions_by_slack_thread_id -from danswer.db.chat import get_or_create_root_message -from danswer.db.models import Prompt -from danswer.db.models import SlackChannelConfig -from danswer.db.models import StandardAnswer as StandardAnswerModel -from danswer.utils.logger import DanswerLoggingAdapter -from danswer.utils.logger import setup_logger -from ee.danswer.db.standard_answer import fetch_standard_answer_categories_by_names -from ee.danswer.db.standard_answer import find_matching_standard_answers -from ee.danswer.server.manage.models import StandardAnswer as PydanticStandardAnswer +from ee.onyx.db.standard_answer import fetch_standard_answer_categories_by_names +from ee.onyx.db.standard_answer import find_matching_standard_answers +from ee.onyx.server.manage.models import StandardAnswer as PydanticStandardAnswer +from onyx.configs.constants import MessageType +from onyx.configs.onyxbot_configs import DANSWER_REACT_EMOJI +from onyx.db.chat import create_chat_session +from onyx.db.chat import create_new_chat_message +from onyx.db.chat import get_chat_messages_by_sessions +from onyx.db.chat import get_chat_sessions_by_slack_thread_id +from onyx.db.chat import get_or_create_root_message +from onyx.db.models import Prompt +from onyx.db.models import SlackChannelConfig +from onyx.db.models import StandardAnswer as StandardAnswerModel +from onyx.onyxbot.slack.blocks import get_restate_blocks +from onyx.onyxbot.slack.constants import GENERATE_ANSWER_BUTTON_ACTION_ID +from onyx.onyxbot.slack.handlers.utils import send_team_member_message +from onyx.onyxbot.slack.models import SlackMessageInfo +from onyx.onyxbot.slack.utils import respond_in_thread +from onyx.onyxbot.slack.utils import update_emote_react +from onyx.utils.logger import OnyxLoggingAdapter +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -82,7 +82,7 @@ def _handle_standard_answers( receiver_ids: list[str] | None, slack_channel_config: SlackChannelConfig | None, prompt: Prompt | None, - logger: DanswerLoggingAdapter, + logger: OnyxLoggingAdapter, client: WebClient, db_session: Session, ) -> bool: @@ -153,7 +153,7 @@ def _handle_standard_answers( persona_id=slack_channel_config.persona.id if slack_channel_config.persona else 0, - danswerbot_flow=True, + onyxbot_flow=True, slack_thread_id=slack_thread_id, ) @@ -218,7 +218,7 @@ def _handle_standard_answers( client=client, channel=message_info.channel_to_respond, receiver_ids=receiver_ids, - text="Hello! Danswer has some results for you!", + text="Hello! Onyx has some results for you!", blocks=all_blocks, thread_ts=message_info.msg_to_respond, unfurl=False, diff --git a/backend/ee/danswer/seeding/load_docs.py b/backend/ee/onyx/seeding/load_docs.py similarity index 91% rename from backend/ee/danswer/seeding/load_docs.py rename to backend/ee/onyx/seeding/load_docs.py index 31047423c0d..ff4e19a3967 100644 --- a/backend/ee/danswer/seeding/load_docs.py +++ b/backend/ee/onyx/seeding/load_docs.py @@ -5,13 +5,13 @@ from cohere import Client -from ee.danswer.configs.app_configs import COHERE_DEFAULT_API_KEY +from ee.onyx.configs.app_configs import COHERE_DEFAULT_API_KEY Embedding = List[float] def load_processed_docs(cohere_enabled: bool) -> list[dict]: - base_path = os.path.join(os.getcwd(), "danswer", "seeding") + base_path = os.path.join(os.getcwd(), "onyx", "seeding") if cohere_enabled and COHERE_DEFAULT_API_KEY: initial_docs_path = os.path.join(base_path, "initial_docs_cohere.json") diff --git a/backend/danswer/connectors/bookstack/__init__.py b/backend/ee/onyx/server/__init__.py similarity index 100% rename from backend/danswer/connectors/bookstack/__init__.py rename to backend/ee/onyx/server/__init__.py diff --git a/backend/ee/danswer/server/analytics/api.py b/backend/ee/onyx/server/analytics/api.py similarity index 86% rename from backend/ee/danswer/server/analytics/api.py rename to backend/ee/onyx/server/analytics/api.py index 2963dc2134c..374bcb10dba 100644 --- a/backend/ee/danswer/server/analytics/api.py +++ b/backend/ee/onyx/server/analytics/api.py @@ -6,14 +6,14 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.db.engine import get_session -from danswer.db.models import User -from ee.danswer.db.analytics import fetch_danswerbot_analytics -from ee.danswer.db.analytics import fetch_per_user_query_analytics -from ee.danswer.db.analytics import fetch_persona_message_analytics -from ee.danswer.db.analytics import fetch_persona_unique_users -from ee.danswer.db.analytics import fetch_query_analytics +from ee.onyx.db.analytics import fetch_onyxbot_analytics +from ee.onyx.db.analytics import fetch_per_user_query_analytics +from ee.onyx.db.analytics import fetch_persona_message_analytics +from ee.onyx.db.analytics import fetch_persona_unique_users +from ee.onyx.db.analytics import fetch_query_analytics +from onyx.auth.users import current_admin_user +from onyx.db.engine import get_session +from onyx.db.models import User router = APIRouter(prefix="/analytics") @@ -87,20 +87,20 @@ def get_user_analytics( ] -class DanswerbotAnalyticsResponse(BaseModel): +class OnyxbotAnalyticsResponse(BaseModel): total_queries: int auto_resolved: int date: datetime.date -@router.get("/admin/danswerbot") -def get_danswerbot_analytics( +@router.get("/admin/onyxbot") +def get_onyxbot_analytics( start: datetime.datetime | None = None, end: datetime.datetime | None = None, _: User | None = Depends(current_admin_user), db_session: Session = Depends(get_session), -) -> list[DanswerbotAnalyticsResponse]: - daily_danswerbot_info = fetch_danswerbot_analytics( +) -> list[OnyxbotAnalyticsResponse]: + daily_onyxbot_info = fetch_onyxbot_analytics( start=start or ( datetime.datetime.utcnow() - datetime.timedelta(days=_DEFAULT_LOOKBACK_DAYS) @@ -110,13 +110,13 @@ def get_danswerbot_analytics( ) resolution_results = [ - DanswerbotAnalyticsResponse( + OnyxbotAnalyticsResponse( total_queries=total_queries, # If it hits negatives, something has gone wrong... auto_resolved=max(0, total_queries - total_negatives), date=date, ) - for total_queries, total_negatives, date in daily_danswerbot_info + for total_queries, total_negatives, date in daily_onyxbot_info ] return resolution_results diff --git a/backend/ee/danswer/server/auth_check.py b/backend/ee/onyx/server/auth_check.py similarity index 88% rename from backend/ee/danswer/server/auth_check.py rename to backend/ee/onyx/server/auth_check.py index 49353abf84c..bd3504d22aa 100644 --- a/backend/ee/danswer/server/auth_check.py +++ b/backend/ee/onyx/server/auth_check.py @@ -1,7 +1,7 @@ from fastapi import FastAPI -from danswer.server.auth_check import check_router_auth -from danswer.server.auth_check import PUBLIC_ENDPOINT_SPECS +from onyx.server.auth_check import check_router_auth +from onyx.server.auth_check import PUBLIC_ENDPOINT_SPECS EE_PUBLIC_ENDPOINT_SPECS = PUBLIC_ENDPOINT_SPECS + [ diff --git a/backend/ee/danswer/server/enterprise_settings/api.py b/backend/ee/onyx/server/enterprise_settings/api.py similarity index 83% rename from backend/ee/danswer/server/enterprise_settings/api.py rename to backend/ee/onyx/server/enterprise_settings/api.py index 272d8bf9369..dbc89acd2af 100644 --- a/backend/ee/danswer/server/enterprise_settings/api.py +++ b/backend/ee/onyx/server/enterprise_settings/api.py @@ -13,23 +13,23 @@ from pydantic import Field from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_user_with_expired_token -from danswer.auth.users import get_user_manager -from danswer.auth.users import UserManager -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.file_store.file_store import get_default_file_store -from danswer.utils.logger import setup_logger -from ee.danswer.server.enterprise_settings.models import AnalyticsScriptUpload -from ee.danswer.server.enterprise_settings.models import EnterpriseSettings -from ee.danswer.server.enterprise_settings.store import _LOGO_FILENAME -from ee.danswer.server.enterprise_settings.store import _LOGOTYPE_FILENAME -from ee.danswer.server.enterprise_settings.store import load_analytics_script -from ee.danswer.server.enterprise_settings.store import load_settings -from ee.danswer.server.enterprise_settings.store import store_analytics_script -from ee.danswer.server.enterprise_settings.store import store_settings -from ee.danswer.server.enterprise_settings.store import upload_logo +from ee.onyx.server.enterprise_settings.models import AnalyticsScriptUpload +from ee.onyx.server.enterprise_settings.models import EnterpriseSettings +from ee.onyx.server.enterprise_settings.store import _LOGO_FILENAME +from ee.onyx.server.enterprise_settings.store import _LOGOTYPE_FILENAME +from ee.onyx.server.enterprise_settings.store import load_analytics_script +from ee.onyx.server.enterprise_settings.store import load_settings +from ee.onyx.server.enterprise_settings.store import store_analytics_script +from ee.onyx.server.enterprise_settings.store import store_settings +from ee.onyx.server.enterprise_settings.store import upload_logo +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_user_with_expired_token +from onyx.auth.users import get_user_manager +from onyx.auth.users import UserManager +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.file_store.file_store import get_default_file_store +from onyx.utils.logger import setup_logger admin_router = APIRouter(prefix="/admin/enterprise-settings") basic_router = APIRouter(prefix="/enterprise-settings") diff --git a/backend/ee/danswer/server/enterprise_settings/models.py b/backend/ee/onyx/server/enterprise_settings/models.py similarity index 99% rename from backend/ee/danswer/server/enterprise_settings/models.py rename to backend/ee/onyx/server/enterprise_settings/models.py index df8f022a402..12e30f418bb 100644 --- a/backend/ee/danswer/server/enterprise_settings/models.py +++ b/backend/ee/onyx/server/enterprise_settings/models.py @@ -24,7 +24,7 @@ def model_validate(cls, *args: Any, **kwargs: Any) -> "NavigationItem": class EnterpriseSettings(BaseModel): - """General settings that only apply to the Enterprise Edition of Danswer + """General settings that only apply to the Enterprise Edition of Onyx NOTE: don't put anything sensitive in here, as this is accessible without auth.""" diff --git a/backend/ee/danswer/server/enterprise_settings/store.py b/backend/ee/onyx/server/enterprise_settings/store.py similarity index 85% rename from backend/ee/danswer/server/enterprise_settings/store.py rename to backend/ee/onyx/server/enterprise_settings/store.py index 74706e0f769..65a4dd5bfa6 100644 --- a/backend/ee/danswer/server/enterprise_settings/store.py +++ b/backend/ee/onyx/server/enterprise_settings/store.py @@ -8,15 +8,15 @@ from fastapi import UploadFile from sqlalchemy.orm import Session -from danswer.configs.constants import FileOrigin -from danswer.configs.constants import KV_CUSTOM_ANALYTICS_SCRIPT_KEY -from danswer.configs.constants import KV_ENTERPRISE_SETTINGS_KEY -from danswer.file_store.file_store import get_default_file_store -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.utils.logger import setup_logger -from ee.danswer.server.enterprise_settings.models import AnalyticsScriptUpload -from ee.danswer.server.enterprise_settings.models import EnterpriseSettings +from ee.onyx.server.enterprise_settings.models import AnalyticsScriptUpload +from ee.onyx.server.enterprise_settings.models import EnterpriseSettings +from onyx.configs.constants import FileOrigin +from onyx.configs.constants import KV_CUSTOM_ANALYTICS_SCRIPT_KEY +from onyx.configs.constants import KV_ENTERPRISE_SETTINGS_KEY +from onyx.file_store.file_store import get_default_file_store +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/server/manage/models.py b/backend/ee/onyx/server/manage/models.py similarity index 94% rename from backend/ee/danswer/server/manage/models.py rename to backend/ee/onyx/server/manage/models.py index ae2c401a2fa..75e94d3aa65 100644 --- a/backend/ee/danswer/server/manage/models.py +++ b/backend/ee/onyx/server/manage/models.py @@ -5,8 +5,8 @@ from pydantic import field_validator from pydantic import model_validator -from danswer.db.models import StandardAnswer as StandardAnswerModel -from danswer.db.models import StandardAnswerCategory as StandardAnswerCategoryModel +from onyx.db.models import StandardAnswer as StandardAnswerModel +from onyx.db.models import StandardAnswerCategory as StandardAnswerCategoryModel class StandardAnswerCategoryCreationRequest(BaseModel): diff --git a/backend/ee/danswer/server/manage/standard_answer.py b/backend/ee/onyx/server/manage/standard_answer.py similarity index 82% rename from backend/ee/danswer/server/manage/standard_answer.py rename to backend/ee/onyx/server/manage/standard_answer.py index e832fa19078..5ac1a8fb716 100644 --- a/backend/ee/danswer/server/manage/standard_answer.py +++ b/backend/ee/onyx/server/manage/standard_answer.py @@ -3,22 +3,22 @@ from fastapi import HTTPException from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.db.engine import get_session -from danswer.db.models import User -from ee.danswer.db.standard_answer import fetch_standard_answer -from ee.danswer.db.standard_answer import fetch_standard_answer_categories -from ee.danswer.db.standard_answer import fetch_standard_answer_category -from ee.danswer.db.standard_answer import fetch_standard_answers -from ee.danswer.db.standard_answer import insert_standard_answer -from ee.danswer.db.standard_answer import insert_standard_answer_category -from ee.danswer.db.standard_answer import remove_standard_answer -from ee.danswer.db.standard_answer import update_standard_answer -from ee.danswer.db.standard_answer import update_standard_answer_category -from ee.danswer.server.manage.models import StandardAnswer -from ee.danswer.server.manage.models import StandardAnswerCategory -from ee.danswer.server.manage.models import StandardAnswerCategoryCreationRequest -from ee.danswer.server.manage.models import StandardAnswerCreationRequest +from ee.onyx.db.standard_answer import fetch_standard_answer +from ee.onyx.db.standard_answer import fetch_standard_answer_categories +from ee.onyx.db.standard_answer import fetch_standard_answer_category +from ee.onyx.db.standard_answer import fetch_standard_answers +from ee.onyx.db.standard_answer import insert_standard_answer +from ee.onyx.db.standard_answer import insert_standard_answer_category +from ee.onyx.db.standard_answer import remove_standard_answer +from ee.onyx.db.standard_answer import update_standard_answer +from ee.onyx.db.standard_answer import update_standard_answer_category +from ee.onyx.server.manage.models import StandardAnswer +from ee.onyx.server.manage.models import StandardAnswerCategory +from ee.onyx.server.manage.models import StandardAnswerCategoryCreationRequest +from ee.onyx.server.manage.models import StandardAnswerCreationRequest +from onyx.auth.users import current_admin_user +from onyx.db.engine import get_session +from onyx.db.models import User router = APIRouter(prefix="/manage") diff --git a/backend/ee/danswer/server/middleware/tenant_tracking.py b/backend/ee/onyx/server/middleware/tenant_tracking.py similarity index 93% rename from backend/ee/danswer/server/middleware/tenant_tracking.py rename to backend/ee/onyx/server/middleware/tenant_tracking.py index 92cc37f10bf..8729c12418f 100644 --- a/backend/ee/danswer/server/middleware/tenant_tracking.py +++ b/backend/ee/onyx/server/middleware/tenant_tracking.py @@ -8,9 +8,9 @@ from fastapi import Request from fastapi import Response -from danswer.auth.api_key import extract_tenant_from_api_key_header -from danswer.configs.app_configs import USER_AUTH_SECRET -from danswer.db.engine import is_valid_schema_name +from onyx.auth.api_key import extract_tenant_from_api_key_header +from onyx.configs.app_configs import USER_AUTH_SECRET +from onyx.db.engine import is_valid_schema_name from shared_configs.configs import MULTI_TENANT from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR diff --git a/backend/ee/danswer/server/oauth.py b/backend/ee/onyx/server/oauth.py similarity index 95% rename from backend/ee/danswer/server/oauth.py rename to backend/ee/onyx/server/oauth.py index 8a39f1ec58e..47d2f6f1868 100644 --- a/backend/ee/danswer/server/oauth.py +++ b/backend/ee/onyx/server/oauth.py @@ -10,18 +10,18 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.configs.constants import DocumentSource -from danswer.db.credentials import create_credential -from danswer.db.engine import get_current_tenant_id -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.redis.redis_pool import get_redis_client -from danswer.server.documents.models import CredentialBase -from danswer.utils.logger import setup_logger -from ee.danswer.configs.app_configs import OAUTH_SLACK_CLIENT_ID -from ee.danswer.configs.app_configs import OAUTH_SLACK_CLIENT_SECRET +from ee.onyx.configs.app_configs import OAUTH_SLACK_CLIENT_ID +from ee.onyx.configs.app_configs import OAUTH_SLACK_CLIENT_SECRET +from onyx.auth.users import current_user +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.configs.constants import DocumentSource +from onyx.db.credentials import create_credential +from onyx.db.engine import get_current_tenant_id +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.redis.redis_pool import get_redis_client +from onyx.server.documents.models import CredentialBase +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -44,7 +44,7 @@ class OAuthSession(BaseModel): TOKEN_URL = "https://slack.com/api/oauth.v2.access" - # SCOPE is per https://docs.danswer.dev/connectors/slack + # SCOPE is per https://docs.onyx.app/connectors/slack BOT_SCOPE = ( "channels:history," "channels:read," diff --git a/backend/danswer/connectors/clickup/__init__.py b/backend/ee/onyx/server/query_and_chat/__init__.py similarity index 100% rename from backend/danswer/connectors/clickup/__init__.py rename to backend/ee/onyx/server/query_and_chat/__init__.py diff --git a/backend/ee/danswer/server/query_and_chat/chat_backend.py b/backend/ee/onyx/server/query_and_chat/chat_backend.py similarity index 82% rename from backend/ee/danswer/server/query_and_chat/chat_backend.py rename to backend/ee/onyx/server/query_and_chat/chat_backend.py index 0122077fca5..0a29ed00344 100644 --- a/backend/ee/danswer/server/query_and_chat/chat_backend.py +++ b/backend/ee/onyx/server/query_and_chat/chat_backend.py @@ -5,41 +5,41 @@ from fastapi import HTTPException from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.chat.chat_utils import combine_message_thread -from danswer.chat.chat_utils import create_chat_chain -from danswer.chat.models import AllCitations -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import FinalUsedContextDocsResponse -from danswer.chat.models import LlmDoc -from danswer.chat.models import LLMRelevanceFilterResponse -from danswer.chat.models import QADocsResponse -from danswer.chat.models import StreamingError -from danswer.chat.process_message import ChatPacketStream -from danswer.chat.process_message import stream_chat_message_objects -from danswer.configs.chat_configs import CHAT_TARGET_CHUNK_PERCENTAGE -from danswer.configs.constants import MessageType -from danswer.context.search.models import OptionalSearchSetting -from danswer.context.search.models import RetrievalDetails -from danswer.context.search.models import SavedSearchDoc -from danswer.db.chat import create_chat_session -from danswer.db.chat import create_new_chat_message -from danswer.db.chat import get_or_create_root_message -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.llm.factory import get_llms_for_persona -from danswer.llm.utils import get_max_input_tokens -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.secondary_llm_flows.query_expansion import thread_based_query_rephrase -from danswer.server.query_and_chat.models import ChatMessageDetail -from danswer.server.query_and_chat.models import CreateChatMessageRequest -from danswer.utils.logger import setup_logger -from ee.danswer.server.query_and_chat.models import BasicCreateChatMessageRequest -from ee.danswer.server.query_and_chat.models import ( +from ee.onyx.server.query_and_chat.models import BasicCreateChatMessageRequest +from ee.onyx.server.query_and_chat.models import ( BasicCreateChatMessageWithHistoryRequest, ) -from ee.danswer.server.query_and_chat.models import ChatBasicResponse -from ee.danswer.server.query_and_chat.models import SimpleDoc +from ee.onyx.server.query_and_chat.models import ChatBasicResponse +from ee.onyx.server.query_and_chat.models import SimpleDoc +from onyx.auth.users import current_user +from onyx.chat.chat_utils import combine_message_thread +from onyx.chat.chat_utils import create_chat_chain +from onyx.chat.models import AllCitations +from onyx.chat.models import FinalUsedContextDocsResponse +from onyx.chat.models import LlmDoc +from onyx.chat.models import LLMRelevanceFilterResponse +from onyx.chat.models import OnyxAnswerPiece +from onyx.chat.models import QADocsResponse +from onyx.chat.models import StreamingError +from onyx.chat.process_message import ChatPacketStream +from onyx.chat.process_message import stream_chat_message_objects +from onyx.configs.chat_configs import CHAT_TARGET_CHUNK_PERCENTAGE +from onyx.configs.constants import MessageType +from onyx.context.search.models import OptionalSearchSetting +from onyx.context.search.models import RetrievalDetails +from onyx.context.search.models import SavedSearchDoc +from onyx.db.chat import create_chat_session +from onyx.db.chat import create_new_chat_message +from onyx.db.chat import get_or_create_root_message +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.llm.factory import get_llms_for_persona +from onyx.llm.utils import get_max_input_tokens +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.secondary_llm_flows.query_expansion import thread_based_query_rephrase +from onyx.server.query_and_chat.models import ChatMessageDetail +from onyx.server.query_and_chat.models import CreateChatMessageRequest +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -90,7 +90,7 @@ def _convert_packet_stream_to_response( answer = "" for packet in packets: - if isinstance(packet, DanswerAnswerPiece) and packet.answer_piece: + if isinstance(packet, OnyxAnswerPiece) and packet.answer_piece: answer += packet.answer_piece elif isinstance(packet, QADocsResponse): response.top_documents = packet.top_documents diff --git a/backend/ee/danswer/server/query_and_chat/models.py b/backend/ee/onyx/server/query_and_chat/models.py similarity index 87% rename from backend/ee/danswer/server/query_and_chat/models.py rename to backend/ee/onyx/server/query_and_chat/models.py index 101b2848cdb..4726236e01f 100644 --- a/backend/ee/danswer/server/query_and_chat/models.py +++ b/backend/ee/onyx/server/query_and_chat/models.py @@ -4,19 +4,19 @@ from pydantic import Field from pydantic import model_validator -from danswer.chat.models import CitationInfo -from danswer.chat.models import DanswerContexts -from danswer.chat.models import PersonaOverrideConfig -from danswer.chat.models import QADocsResponse -from danswer.chat.models import ThreadMessage -from danswer.configs.constants import DocumentSource -from danswer.context.search.enums import LLMEvaluationType -from danswer.context.search.enums import SearchType -from danswer.context.search.models import ChunkContext -from danswer.context.search.models import RerankingDetails -from danswer.context.search.models import RetrievalDetails -from danswer.context.search.models import SavedSearchDoc -from ee.danswer.server.manage.models import StandardAnswer +from ee.onyx.server.manage.models import StandardAnswer +from onyx.chat.models import CitationInfo +from onyx.chat.models import OnyxContexts +from onyx.chat.models import PersonaOverrideConfig +from onyx.chat.models import QADocsResponse +from onyx.chat.models import ThreadMessage +from onyx.configs.constants import DocumentSource +from onyx.context.search.enums import LLMEvaluationType +from onyx.context.search.enums import SearchType +from onyx.context.search.models import ChunkContext +from onyx.context.search.models import RerankingDetails +from onyx.context.search.models import RetrievalDetails +from onyx.context.search.models import SavedSearchDoc class StandardAnswerRequest(BaseModel): @@ -145,4 +145,4 @@ class OneShotQAResponse(BaseModel): llm_selected_doc_indices: list[int] | None = None error_msg: str | None = None chat_message_id: int | None = None - contexts: DanswerContexts | None = None + contexts: OnyxContexts | None = None diff --git a/backend/ee/danswer/server/query_and_chat/query_backend.py b/backend/ee/onyx/server/query_and_chat/query_backend.py similarity index 81% rename from backend/ee/danswer/server/query_and_chat/query_backend.py rename to backend/ee/onyx/server/query_and_chat/query_backend.py index 16e4b4ebc2e..b8e7abd3e4a 100644 --- a/backend/ee/danswer/server/query_and_chat/query_backend.py +++ b/backend/ee/onyx/server/query_and_chat/query_backend.py @@ -8,40 +8,40 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.chat.chat_utils import combine_message_thread -from danswer.chat.chat_utils import prepare_chat_message_request -from danswer.chat.models import PersonaOverrideConfig -from danswer.chat.process_message import ChatPacketStream -from danswer.chat.process_message import stream_chat_message_objects -from danswer.configs.danswerbot_configs import MAX_THREAD_CONTEXT_PERCENTAGE -from danswer.context.search.models import SavedSearchDocWithContent -from danswer.context.search.models import SearchRequest -from danswer.context.search.pipeline import SearchPipeline -from danswer.context.search.utils import dedupe_documents -from danswer.context.search.utils import drop_llm_indices -from danswer.context.search.utils import relevant_sections_to_indices -from danswer.db.chat import get_prompt_by_id -from danswer.db.engine import get_session -from danswer.db.models import Persona -from danswer.db.models import User -from danswer.db.persona import get_persona_by_id -from danswer.llm.factory import get_default_llms -from danswer.llm.factory import get_llms_for_persona -from danswer.llm.factory import get_main_llm_from_tuple -from danswer.llm.utils import get_max_input_tokens -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.server.utils import get_json_line -from danswer.utils.logger import setup_logger -from ee.danswer.chat.process_message import gather_stream_for_answer_api -from ee.danswer.danswerbot.slack.handlers.handle_standard_answers import ( +from ee.onyx.chat.process_message import gather_stream_for_answer_api +from ee.onyx.onyxbot.slack.handlers.handle_standard_answers import ( oneoff_standard_answers, ) -from ee.danswer.server.query_and_chat.models import DocumentSearchRequest -from ee.danswer.server.query_and_chat.models import OneShotQARequest -from ee.danswer.server.query_and_chat.models import OneShotQAResponse -from ee.danswer.server.query_and_chat.models import StandardAnswerRequest -from ee.danswer.server.query_and_chat.models import StandardAnswerResponse +from ee.onyx.server.query_and_chat.models import DocumentSearchRequest +from ee.onyx.server.query_and_chat.models import OneShotQARequest +from ee.onyx.server.query_and_chat.models import OneShotQAResponse +from ee.onyx.server.query_and_chat.models import StandardAnswerRequest +from ee.onyx.server.query_and_chat.models import StandardAnswerResponse +from onyx.auth.users import current_user +from onyx.chat.chat_utils import combine_message_thread +from onyx.chat.chat_utils import prepare_chat_message_request +from onyx.chat.models import PersonaOverrideConfig +from onyx.chat.process_message import ChatPacketStream +from onyx.chat.process_message import stream_chat_message_objects +from onyx.configs.onyxbot_configs import MAX_THREAD_CONTEXT_PERCENTAGE +from onyx.context.search.models import SavedSearchDocWithContent +from onyx.context.search.models import SearchRequest +from onyx.context.search.pipeline import SearchPipeline +from onyx.context.search.utils import dedupe_documents +from onyx.context.search.utils import drop_llm_indices +from onyx.context.search.utils import relevant_sections_to_indices +from onyx.db.chat import get_prompt_by_id +from onyx.db.engine import get_session +from onyx.db.models import Persona +from onyx.db.models import User +from onyx.db.persona import get_persona_by_id +from onyx.llm.factory import get_default_llms +from onyx.llm.factory import get_llms_for_persona +from onyx.llm.factory import get_main_llm_from_tuple +from onyx.llm.utils import get_max_input_tokens +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.server.utils import get_json_line +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/server/query_and_chat/token_limit.py b/backend/ee/onyx/server/query_and_chat/token_limit.py similarity index 87% rename from backend/ee/danswer/server/query_and_chat/token_limit.py rename to backend/ee/onyx/server/query_and_chat/token_limit.py index 5c11a0a8e69..e529239b6e1 100644 --- a/backend/ee/danswer/server/query_and_chat/token_limit.py +++ b/backend/ee/onyx/server/query_and_chat/token_limit.py @@ -12,20 +12,20 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.db.api_key import is_api_key_email_address -from danswer.db.engine import get_session_with_tenant -from danswer.db.models import ChatMessage -from danswer.db.models import ChatSession -from danswer.db.models import TokenRateLimit -from danswer.db.models import TokenRateLimit__UserGroup -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.db.models import UserGroup -from danswer.db.token_limit import fetch_all_user_token_rate_limits -from danswer.server.query_and_chat.token_limit import _get_cutoff_time -from danswer.server.query_and_chat.token_limit import _is_rate_limited -from danswer.server.query_and_chat.token_limit import _user_is_rate_limited_by_global -from danswer.utils.threadpool_concurrency import run_functions_tuples_in_parallel +from onyx.db.api_key import is_api_key_email_address +from onyx.db.engine import get_session_with_tenant +from onyx.db.models import ChatMessage +from onyx.db.models import ChatSession +from onyx.db.models import TokenRateLimit +from onyx.db.models import TokenRateLimit__UserGroup +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.db.models import UserGroup +from onyx.db.token_limit import fetch_all_user_token_rate_limits +from onyx.server.query_and_chat.token_limit import _get_cutoff_time +from onyx.server.query_and_chat.token_limit import _is_rate_limited +from onyx.server.query_and_chat.token_limit import _user_is_rate_limited_by_global +from onyx.utils.threadpool_concurrency import run_functions_tuples_in_parallel def _check_token_rate_limits(user: User | None, tenant_id: str | None) -> None: diff --git a/backend/ee/danswer/server/query_history/api.py b/backend/ee/onyx/server/query_history/api.py similarity index 93% rename from backend/ee/danswer/server/query_history/api.py rename to backend/ee/onyx/server/query_history/api.py index 0a15013dd65..c1ad267a825 100644 --- a/backend/ee/danswer/server/query_history/api.py +++ b/backend/ee/onyx/server/query_history/api.py @@ -13,21 +13,21 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import get_display_email -from danswer.chat.chat_utils import create_chat_chain -from danswer.configs.constants import MessageType -from danswer.configs.constants import QAFeedbackType -from danswer.configs.constants import SessionType -from danswer.db.chat import get_chat_session_by_id -from danswer.db.chat import get_chat_sessions_by_user -from danswer.db.engine import get_session -from danswer.db.models import ChatMessage -from danswer.db.models import ChatSession -from danswer.db.models import User -from danswer.server.query_and_chat.models import ChatSessionDetails -from danswer.server.query_and_chat.models import ChatSessionsResponse -from ee.danswer.db.query_history import fetch_chat_sessions_eagerly_by_time +from ee.onyx.db.query_history import fetch_chat_sessions_eagerly_by_time +from onyx.auth.users import current_admin_user +from onyx.auth.users import get_display_email +from onyx.chat.chat_utils import create_chat_chain +from onyx.configs.constants import MessageType +from onyx.configs.constants import QAFeedbackType +from onyx.configs.constants import SessionType +from onyx.db.chat import get_chat_session_by_id +from onyx.db.chat import get_chat_sessions_by_user +from onyx.db.engine import get_session +from onyx.db.models import ChatMessage +from onyx.db.models import ChatSession +from onyx.db.models import User +from onyx.server.query_and_chat.models import ChatSessionDetails +from onyx.server.query_and_chat.models import ChatSessionsResponse router = APIRouter() @@ -179,7 +179,7 @@ def to_json(self) -> dict[str, str | None]: def determine_flow_type(chat_session: ChatSession) -> SessionType: - return SessionType.SLACK if chat_session.danswerbot_flow else SessionType.CHAT + return SessionType.SLACK if chat_session.onyxbot_flow else SessionType.CHAT def fetch_and_process_chat_session_history_minimal( @@ -454,7 +454,5 @@ def get_query_history_as_csv( return StreamingResponse( iter([stream.getvalue()]), media_type="text/csv", - headers={ - "Content-Disposition": "attachment;filename=danswer_query_history.csv" - }, + headers={"Content-Disposition": "attachment;filename=onyx_query_history.csv"}, ) diff --git a/backend/ee/danswer/server/reporting/usage_export_api.py b/backend/ee/onyx/server/reporting/usage_export_api.py similarity index 82% rename from backend/ee/danswer/server/reporting/usage_export_api.py rename to backend/ee/onyx/server/reporting/usage_export_api.py index 409702c3fbf..029cc8ba92c 100644 --- a/backend/ee/danswer/server/reporting/usage_export_api.py +++ b/backend/ee/onyx/server/reporting/usage_export_api.py @@ -9,14 +9,14 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.file_store.constants import STANDARD_CHUNK_SIZE -from ee.danswer.db.usage_export import get_all_usage_reports -from ee.danswer.db.usage_export import get_usage_report_data -from ee.danswer.db.usage_export import UsageReportMetadata -from ee.danswer.server.reporting.usage_export_generation import create_new_usage_report +from ee.onyx.db.usage_export import get_all_usage_reports +from ee.onyx.db.usage_export import get_usage_report_data +from ee.onyx.db.usage_export import UsageReportMetadata +from ee.onyx.server.reporting.usage_export_generation import create_new_usage_report +from onyx.auth.users import current_admin_user +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.file_store.constants import STANDARD_CHUNK_SIZE router = APIRouter() diff --git a/backend/ee/danswer/server/reporting/usage_export_generation.py b/backend/ee/onyx/server/reporting/usage_export_generation.py similarity index 89% rename from backend/ee/danswer/server/reporting/usage_export_generation.py rename to backend/ee/onyx/server/reporting/usage_export_generation.py index 2274b00dd70..9a9bc3fc594 100644 --- a/backend/ee/danswer/server/reporting/usage_export_generation.py +++ b/backend/ee/onyx/server/reporting/usage_export_generation.py @@ -9,16 +9,16 @@ from fastapi_users_db_sqlalchemy import UUID_ID from sqlalchemy.orm import Session -from danswer.auth.schemas import UserStatus -from danswer.configs.constants import FileOrigin -from danswer.db.users import list_users -from danswer.file_store.constants import MAX_IN_MEMORY_SIZE -from danswer.file_store.file_store import FileStore -from danswer.file_store.file_store import get_default_file_store -from ee.danswer.db.usage_export import get_all_empty_chat_message_entries -from ee.danswer.db.usage_export import write_usage_report -from ee.danswer.server.reporting.usage_export_models import UsageReportMetadata -from ee.danswer.server.reporting.usage_export_models import UserSkeleton +from ee.onyx.db.usage_export import get_all_empty_chat_message_entries +from ee.onyx.db.usage_export import write_usage_report +from ee.onyx.server.reporting.usage_export_models import UsageReportMetadata +from ee.onyx.server.reporting.usage_export_models import UserSkeleton +from onyx.auth.schemas import UserStatus +from onyx.configs.constants import FileOrigin +from onyx.db.users import list_users +from onyx.file_store.constants import MAX_IN_MEMORY_SIZE +from onyx.file_store.file_store import FileStore +from onyx.file_store.file_store import get_default_file_store def generate_chat_messages_report( diff --git a/backend/ee/danswer/server/reporting/usage_export_models.py b/backend/ee/onyx/server/reporting/usage_export_models.py similarity index 93% rename from backend/ee/danswer/server/reporting/usage_export_models.py rename to backend/ee/onyx/server/reporting/usage_export_models.py index efaee7378fa..c9cdf17f4a9 100644 --- a/backend/ee/danswer/server/reporting/usage_export_models.py +++ b/backend/ee/onyx/server/reporting/usage_export_models.py @@ -4,7 +4,7 @@ from pydantic import BaseModel -from danswer.auth.schemas import UserStatus +from onyx.auth.schemas import UserStatus class FlowType(str, Enum): diff --git a/backend/ee/danswer/server/saml.py b/backend/ee/onyx/server/saml.py similarity index 87% rename from backend/ee/danswer/server/saml.py rename to backend/ee/onyx/server/saml.py index 20c786af144..2a57634e524 100644 --- a/backend/ee/danswer/server/saml.py +++ b/backend/ee/onyx/server/saml.py @@ -15,22 +15,22 @@ from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Session -from danswer.auth.schemas import UserCreate -from danswer.auth.schemas import UserRole -from danswer.auth.users import get_user_manager -from danswer.configs.app_configs import SESSION_EXPIRE_TIME_SECONDS -from danswer.db.auth import get_user_count -from danswer.db.auth import get_user_db -from danswer.db.engine import get_async_session -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.utils.logger import setup_logger -from ee.danswer.configs.app_configs import SAML_CONF_DIR -from ee.danswer.db.saml import expire_saml_account -from ee.danswer.db.saml import get_saml_account -from ee.danswer.db.saml import upsert_saml_account -from ee.danswer.utils.secrets import encrypt_string -from ee.danswer.utils.secrets import extract_hashed_cookie +from ee.onyx.configs.app_configs import SAML_CONF_DIR +from ee.onyx.db.saml import expire_saml_account +from ee.onyx.db.saml import get_saml_account +from ee.onyx.db.saml import upsert_saml_account +from ee.onyx.utils.secrets import encrypt_string +from ee.onyx.utils.secrets import extract_hashed_cookie +from onyx.auth.schemas import UserCreate +from onyx.auth.schemas import UserRole +from onyx.auth.users import get_user_manager +from onyx.configs.app_configs import SESSION_EXPIRE_TIME_SECONDS +from onyx.db.auth import get_user_count +from onyx.db.auth import get_user_db +from onyx.db.engine import get_async_session +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -156,7 +156,7 @@ async def saml_login_callback( upsert_saml_account(user_id=user.id, cookie=saved_cookie, db_session=db_session) - # Redirect to main Danswer search page + # Redirect to main Onyx search page response = Response(status_code=status.HTTP_204_NO_CONTENT) response.set_cookie( diff --git a/backend/ee/danswer/server/seeding.py b/backend/ee/onyx/server/seeding.py similarity index 88% rename from backend/ee/danswer/server/seeding.py rename to backend/ee/onyx/server/seeding.py index f1081fe5f37..1481920890d 100644 --- a/backend/ee/danswer/server/seeding.py +++ b/backend/ee/onyx/server/seeding.py @@ -7,28 +7,28 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.context.search.enums import RecencyBiasSetting -from danswer.db.engine import get_session_context_manager -from danswer.db.llm import update_default_provider -from danswer.db.llm import upsert_llm_provider -from danswer.db.models import Tool -from danswer.db.persona import upsert_persona -from danswer.server.features.persona.models import CreatePersonaRequest -from danswer.server.manage.llm.models import LLMProviderUpsertRequest -from danswer.server.settings.models import Settings -from danswer.server.settings.store import store_settings as store_base_settings -from danswer.utils.logger import setup_logger -from ee.danswer.db.standard_answer import ( +from ee.onyx.db.standard_answer import ( create_initial_default_standard_answer_category, ) -from ee.danswer.server.enterprise_settings.models import AnalyticsScriptUpload -from ee.danswer.server.enterprise_settings.models import EnterpriseSettings -from ee.danswer.server.enterprise_settings.models import NavigationItem -from ee.danswer.server.enterprise_settings.store import store_analytics_script -from ee.danswer.server.enterprise_settings.store import ( +from ee.onyx.server.enterprise_settings.models import AnalyticsScriptUpload +from ee.onyx.server.enterprise_settings.models import EnterpriseSettings +from ee.onyx.server.enterprise_settings.models import NavigationItem +from ee.onyx.server.enterprise_settings.store import store_analytics_script +from ee.onyx.server.enterprise_settings.store import ( store_settings as store_ee_settings, ) -from ee.danswer.server.enterprise_settings.store import upload_logo +from ee.onyx.server.enterprise_settings.store import upload_logo +from onyx.context.search.enums import RecencyBiasSetting +from onyx.db.engine import get_session_context_manager +from onyx.db.llm import update_default_provider +from onyx.db.llm import upsert_llm_provider +from onyx.db.models import Tool +from onyx.db.persona import upsert_persona +from onyx.server.features.persona.models import CreatePersonaRequest +from onyx.server.manage.llm.models import LLMProviderUpsertRequest +from onyx.server.settings.models import Settings +from onyx.server.settings.store import store_settings as store_base_settings +from onyx.utils.logger import setup_logger class CustomToolSeed(BaseModel): diff --git a/backend/danswer/connectors/confluence/__init__.py b/backend/ee/onyx/server/tenants/__init__.py similarity index 100% rename from backend/danswer/connectors/confluence/__init__.py rename to backend/ee/onyx/server/tenants/__init__.py diff --git a/backend/ee/danswer/server/tenants/access.py b/backend/ee/onyx/server/tenants/access.py similarity index 88% rename from backend/ee/danswer/server/tenants/access.py rename to backend/ee/onyx/server/tenants/access.py index 255e6c0ea94..91163049eae 100644 --- a/backend/ee/danswer/server/tenants/access.py +++ b/backend/ee/onyx/server/tenants/access.py @@ -5,10 +5,10 @@ from fastapi import HTTPException from fastapi import Request -from danswer.configs.app_configs import DATA_PLANE_SECRET -from danswer.configs.app_configs import EXPECTED_API_KEY -from danswer.configs.app_configs import JWT_ALGORITHM -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import DATA_PLANE_SECRET +from onyx.configs.app_configs import EXPECTED_API_KEY +from onyx.configs.app_configs import JWT_ALGORITHM +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/server/tenants/api.py b/backend/ee/onyx/server/tenants/api.py similarity index 75% rename from backend/ee/danswer/server/tenants/api.py rename to backend/ee/onyx/server/tenants/api.py index 8c1331c15a6..99cc39d7e8c 100644 --- a/backend/ee/danswer/server/tenants/api.py +++ b/backend/ee/onyx/server/tenants/api.py @@ -4,26 +4,26 @@ from fastapi import HTTPException from fastapi import Response -from danswer.auth.users import auth_backend -from danswer.auth.users import current_admin_user -from danswer.auth.users import get_jwt_strategy -from danswer.auth.users import User -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.db.engine import get_session_with_tenant -from danswer.db.notification import create_notification -from danswer.db.users import get_user_by_email -from danswer.server.settings.store import load_settings -from danswer.server.settings.store import store_settings -from danswer.utils.logger import setup_logger -from ee.danswer.auth.users import current_cloud_superuser -from ee.danswer.configs.app_configs import STRIPE_SECRET_KEY -from ee.danswer.server.tenants.access import control_plane_dep -from ee.danswer.server.tenants.billing import fetch_billing_information -from ee.danswer.server.tenants.billing import fetch_tenant_stripe_information -from ee.danswer.server.tenants.models import BillingInformation -from ee.danswer.server.tenants.models import ImpersonateRequest -from ee.danswer.server.tenants.models import ProductGatingRequest -from ee.danswer.server.tenants.user_mapping import get_tenant_id_for_email +from ee.onyx.auth.users import current_cloud_superuser +from ee.onyx.configs.app_configs import STRIPE_SECRET_KEY +from ee.onyx.server.tenants.access import control_plane_dep +from ee.onyx.server.tenants.billing import fetch_billing_information +from ee.onyx.server.tenants.billing import fetch_tenant_stripe_information +from ee.onyx.server.tenants.models import BillingInformation +from ee.onyx.server.tenants.models import ImpersonateRequest +from ee.onyx.server.tenants.models import ProductGatingRequest +from ee.onyx.server.tenants.user_mapping import get_tenant_id_for_email +from onyx.auth.users import auth_backend +from onyx.auth.users import current_admin_user +from onyx.auth.users import get_jwt_strategy +from onyx.auth.users import User +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.db.engine import get_session_with_tenant +from onyx.db.notification import create_notification +from onyx.db.users import get_user_by_email +from onyx.server.settings.store import load_settings +from onyx.server.settings.store import store_settings +from onyx.utils.logger import setup_logger from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR stripe.api_key = STRIPE_SECRET_KEY diff --git a/backend/ee/danswer/server/tenants/billing.py b/backend/ee/onyx/server/tenants/billing.py similarity index 86% rename from backend/ee/danswer/server/tenants/billing.py rename to backend/ee/onyx/server/tenants/billing.py index 681ac835e5f..ec4ada922f3 100644 --- a/backend/ee/danswer/server/tenants/billing.py +++ b/backend/ee/onyx/server/tenants/billing.py @@ -3,11 +3,11 @@ import requests import stripe -from danswer.configs.app_configs import CONTROL_PLANE_API_BASE_URL -from danswer.utils.logger import setup_logger -from ee.danswer.configs.app_configs import STRIPE_PRICE_ID -from ee.danswer.configs.app_configs import STRIPE_SECRET_KEY -from ee.danswer.server.tenants.access import generate_data_plane_token +from ee.onyx.configs.app_configs import STRIPE_PRICE_ID +from ee.onyx.configs.app_configs import STRIPE_SECRET_KEY +from ee.onyx.server.tenants.access import generate_data_plane_token +from onyx.configs.app_configs import CONTROL_PLANE_API_BASE_URL +from onyx.utils.logger import setup_logger stripe.api_key = STRIPE_SECRET_KEY diff --git a/backend/ee/danswer/server/tenants/models.py b/backend/ee/onyx/server/tenants/models.py similarity index 86% rename from backend/ee/danswer/server/tenants/models.py rename to backend/ee/onyx/server/tenants/models.py index c372418f6a4..5e2069996ac 100644 --- a/backend/ee/danswer/server/tenants/models.py +++ b/backend/ee/onyx/server/tenants/models.py @@ -1,7 +1,7 @@ from pydantic import BaseModel -from danswer.configs.constants import NotificationType -from danswer.server.settings.models import GatingType +from onyx.configs.constants import NotificationType +from onyx.server.settings.models import GatingType class CheckoutSessionCreationRequest(BaseModel): diff --git a/backend/ee/danswer/server/tenants/provisioning.py b/backend/ee/onyx/server/tenants/provisioning.py similarity index 83% rename from backend/ee/danswer/server/tenants/provisioning.py rename to backend/ee/onyx/server/tenants/provisioning.py index 1cc07210e56..65c49e58da4 100644 --- a/backend/ee/danswer/server/tenants/provisioning.py +++ b/backend/ee/onyx/server/tenants/provisioning.py @@ -7,34 +7,34 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.auth.users import exceptions -from danswer.configs.app_configs import CONTROL_PLANE_API_BASE_URL -from danswer.db.engine import get_session_with_tenant -from danswer.db.engine import get_sqlalchemy_engine -from danswer.db.llm import update_default_provider -from danswer.db.llm import upsert_cloud_embedding_provider -from danswer.db.llm import upsert_llm_provider -from danswer.db.models import IndexModelStatus -from danswer.db.models import SearchSettings -from danswer.db.models import UserTenantMapping -from danswer.llm.llm_provider_options import ANTHROPIC_MODEL_NAMES -from danswer.llm.llm_provider_options import ANTHROPIC_PROVIDER_NAME -from danswer.llm.llm_provider_options import OPEN_AI_MODEL_NAMES -from danswer.llm.llm_provider_options import OPENAI_PROVIDER_NAME -from danswer.server.manage.embedding.models import CloudEmbeddingProviderCreationRequest -from danswer.server.manage.llm.models import LLMProviderUpsertRequest -from danswer.setup import setup_danswer -from ee.danswer.configs.app_configs import ANTHROPIC_DEFAULT_API_KEY -from ee.danswer.configs.app_configs import COHERE_DEFAULT_API_KEY -from ee.danswer.configs.app_configs import OPENAI_DEFAULT_API_KEY -from ee.danswer.server.tenants.access import generate_data_plane_token -from ee.danswer.server.tenants.models import TenantCreationPayload -from ee.danswer.server.tenants.schema_management import create_schema_if_not_exists -from ee.danswer.server.tenants.schema_management import drop_schema -from ee.danswer.server.tenants.schema_management import run_alembic_migrations -from ee.danswer.server.tenants.user_mapping import add_users_to_tenant -from ee.danswer.server.tenants.user_mapping import get_tenant_id_for_email -from ee.danswer.server.tenants.user_mapping import user_owns_a_tenant +from ee.onyx.configs.app_configs import ANTHROPIC_DEFAULT_API_KEY +from ee.onyx.configs.app_configs import COHERE_DEFAULT_API_KEY +from ee.onyx.configs.app_configs import OPENAI_DEFAULT_API_KEY +from ee.onyx.server.tenants.access import generate_data_plane_token +from ee.onyx.server.tenants.models import TenantCreationPayload +from ee.onyx.server.tenants.schema_management import create_schema_if_not_exists +from ee.onyx.server.tenants.schema_management import drop_schema +from ee.onyx.server.tenants.schema_management import run_alembic_migrations +from ee.onyx.server.tenants.user_mapping import add_users_to_tenant +from ee.onyx.server.tenants.user_mapping import get_tenant_id_for_email +from ee.onyx.server.tenants.user_mapping import user_owns_a_tenant +from onyx.auth.users import exceptions +from onyx.configs.app_configs import CONTROL_PLANE_API_BASE_URL +from onyx.db.engine import get_session_with_tenant +from onyx.db.engine import get_sqlalchemy_engine +from onyx.db.llm import update_default_provider +from onyx.db.llm import upsert_cloud_embedding_provider +from onyx.db.llm import upsert_llm_provider +from onyx.db.models import IndexModelStatus +from onyx.db.models import SearchSettings +from onyx.db.models import UserTenantMapping +from onyx.llm.llm_provider_options import ANTHROPIC_MODEL_NAMES +from onyx.llm.llm_provider_options import ANTHROPIC_PROVIDER_NAME +from onyx.llm.llm_provider_options import OPEN_AI_MODEL_NAMES +from onyx.llm.llm_provider_options import OPENAI_PROVIDER_NAME +from onyx.server.manage.embedding.models import CloudEmbeddingProviderCreationRequest +from onyx.server.manage.llm.models import LLMProviderUpsertRequest +from onyx.setup import setup_onyx from shared_configs.configs import MULTI_TENANT from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA from shared_configs.configs import TENANT_ID_PREFIX @@ -118,7 +118,7 @@ async def provision_tenant(tenant_id: str, email: str) -> None: current_search_settings is not None and current_search_settings.provider_type == EmbeddingProvider.COHERE ) - setup_danswer(db_session, tenant_id, cohere_enabled=cohere_enabled) + setup_onyx(db_session, tenant_id, cohere_enabled=cohere_enabled) add_users_to_tenant([email], tenant_id) diff --git a/backend/ee/danswer/server/tenants/schema_management.py b/backend/ee/onyx/server/tenants/schema_management.py similarity index 95% rename from backend/ee/danswer/server/tenants/schema_management.py rename to backend/ee/onyx/server/tenants/schema_management.py index 9be4e79f984..80712556ea2 100644 --- a/backend/ee/danswer/server/tenants/schema_management.py +++ b/backend/ee/onyx/server/tenants/schema_management.py @@ -8,8 +8,8 @@ from alembic import command from alembic.config import Config -from danswer.db.engine import build_connection_string -from danswer.db.engine import get_sqlalchemy_engine +from onyx.db.engine import build_connection_string +from onyx.db.engine import get_sqlalchemy_engine logger = logging.getLogger(__name__) diff --git a/backend/ee/danswer/server/tenants/user_mapping.py b/backend/ee/onyx/server/tenants/user_mapping.py similarity index 93% rename from backend/ee/danswer/server/tenants/user_mapping.py rename to backend/ee/onyx/server/tenants/user_mapping.py index cf0e5ec5f21..6814975e0bb 100644 --- a/backend/ee/danswer/server/tenants/user_mapping.py +++ b/backend/ee/onyx/server/tenants/user_mapping.py @@ -4,9 +4,9 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.db.engine import get_session_with_tenant -from danswer.db.engine import get_sqlalchemy_engine -from danswer.db.models import UserTenantMapping +from onyx.db.engine import get_session_with_tenant +from onyx.db.engine import get_sqlalchemy_engine +from onyx.db.models import UserTenantMapping from shared_configs.configs import MULTI_TENANT from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA diff --git a/backend/ee/danswer/server/token_rate_limits/api.py b/backend/ee/onyx/server/token_rate_limits/api.py similarity index 78% rename from backend/ee/danswer/server/token_rate_limits/api.py rename to backend/ee/onyx/server/token_rate_limits/api.py index 5006b34cf11..fe382a50f09 100644 --- a/backend/ee/danswer/server/token_rate_limits/api.py +++ b/backend/ee/onyx/server/token_rate_limits/api.py @@ -4,18 +4,18 @@ from fastapi import Depends from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_curator_or_admin_user -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.token_limit import fetch_all_user_token_rate_limits -from danswer.db.token_limit import insert_user_token_rate_limit -from danswer.server.query_and_chat.token_limit import any_rate_limit_exists -from danswer.server.token_rate_limits.models import TokenRateLimitArgs -from danswer.server.token_rate_limits.models import TokenRateLimitDisplay -from ee.danswer.db.token_limit import fetch_all_user_group_token_rate_limits_by_group -from ee.danswer.db.token_limit import fetch_user_group_token_rate_limits -from ee.danswer.db.token_limit import insert_user_group_token_rate_limit +from ee.onyx.db.token_limit import fetch_all_user_group_token_rate_limits_by_group +from ee.onyx.db.token_limit import fetch_user_group_token_rate_limits +from ee.onyx.db.token_limit import insert_user_group_token_rate_limit +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_curator_or_admin_user +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.token_limit import fetch_all_user_token_rate_limits +from onyx.db.token_limit import insert_user_token_rate_limit +from onyx.server.query_and_chat.token_limit import any_rate_limit_exists +from onyx.server.token_rate_limits.models import TokenRateLimitArgs +from onyx.server.token_rate_limits.models import TokenRateLimitDisplay router = APIRouter(prefix="/admin/token-rate-limits") diff --git a/backend/ee/danswer/server/user_group/api.py b/backend/ee/onyx/server/user_group/api.py similarity index 76% rename from backend/ee/danswer/server/user_group/api.py rename to backend/ee/onyx/server/user_group/api.py index 355e59fff1d..73431e1f65f 100644 --- a/backend/ee/danswer/server/user_group/api.py +++ b/backend/ee/onyx/server/user_group/api.py @@ -4,22 +4,22 @@ from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_curator_or_admin_user -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.models import UserRole -from danswer.utils.logger import setup_logger -from ee.danswer.db.user_group import fetch_user_groups -from ee.danswer.db.user_group import fetch_user_groups_for_user -from ee.danswer.db.user_group import insert_user_group -from ee.danswer.db.user_group import prepare_user_group_for_deletion -from ee.danswer.db.user_group import update_user_curator_relationship -from ee.danswer.db.user_group import update_user_group -from ee.danswer.server.user_group.models import SetCuratorRequest -from ee.danswer.server.user_group.models import UserGroup -from ee.danswer.server.user_group.models import UserGroupCreate -from ee.danswer.server.user_group.models import UserGroupUpdate +from ee.onyx.db.user_group import fetch_user_groups +from ee.onyx.db.user_group import fetch_user_groups_for_user +from ee.onyx.db.user_group import insert_user_group +from ee.onyx.db.user_group import prepare_user_group_for_deletion +from ee.onyx.db.user_group import update_user_curator_relationship +from ee.onyx.db.user_group import update_user_group +from ee.onyx.server.user_group.models import SetCuratorRequest +from ee.onyx.server.user_group.models import UserGroup +from ee.onyx.server.user_group.models import UserGroupCreate +from ee.onyx.server.user_group.models import UserGroupUpdate +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_curator_or_admin_user +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.models import UserRole +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/server/user_group/models.py b/backend/ee/onyx/server/user_group/models.py similarity index 84% rename from backend/ee/danswer/server/user_group/models.py rename to backend/ee/onyx/server/user_group/models.py index 077a217e932..804ac8eb13c 100644 --- a/backend/ee/danswer/server/user_group/models.py +++ b/backend/ee/onyx/server/user_group/models.py @@ -2,14 +2,14 @@ from pydantic import BaseModel -from danswer.db.models import UserGroup as UserGroupModel -from danswer.server.documents.models import ConnectorCredentialPairDescriptor -from danswer.server.documents.models import ConnectorSnapshot -from danswer.server.documents.models import CredentialSnapshot -from danswer.server.features.document_set.models import DocumentSet -from danswer.server.features.persona.models import PersonaSnapshot -from danswer.server.manage.models import UserInfo -from danswer.server.manage.models import UserPreferences +from onyx.db.models import UserGroup as UserGroupModel +from onyx.server.documents.models import ConnectorCredentialPairDescriptor +from onyx.server.documents.models import ConnectorSnapshot +from onyx.server.documents.models import CredentialSnapshot +from onyx.server.features.document_set.models import DocumentSet +from onyx.server.features.persona.models import PersonaSnapshot +from onyx.server.manage.models import UserInfo +from onyx.server.manage.models import UserPreferences class UserGroup(BaseModel): diff --git a/backend/danswer/connectors/cross_connector_utils/__init__.py b/backend/ee/onyx/utils/__init__.py similarity index 100% rename from backend/danswer/connectors/cross_connector_utils/__init__.py rename to backend/ee/onyx/utils/__init__.py diff --git a/backend/ee/danswer/utils/encryption.py b/backend/ee/onyx/utils/encryption.py similarity index 88% rename from backend/ee/danswer/utils/encryption.py rename to backend/ee/onyx/utils/encryption.py index 4e2329985ce..85be05df31b 100644 --- a/backend/ee/danswer/utils/encryption.py +++ b/backend/ee/onyx/utils/encryption.py @@ -7,9 +7,9 @@ from cryptography.hazmat.primitives.ciphers import Cipher from cryptography.hazmat.primitives.ciphers import modes -from danswer.configs.app_configs import ENCRYPTION_KEY_SECRET -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_versioned_implementation +from onyx.configs.app_configs import ENCRYPTION_KEY_SECRET +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_versioned_implementation logger = setup_logger() @@ -65,20 +65,20 @@ def _decrypt_bytes(input_bytes: bytes) -> str: def encrypt_string_to_bytes(input_str: str) -> bytes: versioned_encryption_fn = fetch_versioned_implementation( - "danswer.utils.encryption", "_encrypt_string" + "onyx.utils.encryption", "_encrypt_string" ) return versioned_encryption_fn(input_str) def decrypt_bytes_to_string(input_bytes: bytes) -> str: versioned_decryption_fn = fetch_versioned_implementation( - "danswer.utils.encryption", "_decrypt_bytes" + "onyx.utils.encryption", "_decrypt_bytes" ) return versioned_decryption_fn(input_bytes) def test_encryption() -> None: - test_string = "Danswer is the BEST!" + test_string = "Onyx is the BEST!" encrypted_bytes = encrypt_string_to_bytes(test_string) decrypted_string = decrypt_bytes_to_string(encrypted_bytes) if test_string != decrypted_string: diff --git a/backend/ee/danswer/utils/secrets.py b/backend/ee/onyx/utils/secrets.py similarity index 86% rename from backend/ee/danswer/utils/secrets.py rename to backend/ee/onyx/utils/secrets.py index d59d3b77ac8..3fb9e6c8adc 100644 --- a/backend/ee/danswer/utils/secrets.py +++ b/backend/ee/onyx/utils/secrets.py @@ -2,7 +2,7 @@ from fastapi import Request -from danswer.configs.constants import SESSION_KEY +from onyx.configs.constants import SESSION_KEY def encrypt_string(s: str) -> str: diff --git a/backend/model_server/custom_models.py b/backend/model_server/custom_models.py index fde3c8d0dc9..db8ba5d0ccc 100644 --- a/backend/model_server/custom_models.py +++ b/backend/model_server/custom_models.py @@ -6,11 +6,11 @@ from transformers import BatchEncoding # type: ignore from transformers import PreTrainedTokenizer # type: ignore -from danswer.utils.logger import setup_logger from model_server.constants import MODEL_WARM_UP_STRING -from model_server.danswer_torch_model import ConnectorClassifier -from model_server.danswer_torch_model import HybridClassifier +from model_server.onyx_torch_model import ConnectorClassifier +from model_server.onyx_torch_model import HybridClassifier from model_server.utils import simple_log_function_time +from onyx.utils.logger import setup_logger from shared_configs.configs import CONNECTOR_CLASSIFIER_MODEL_REPO from shared_configs.configs import CONNECTOR_CLASSIFIER_MODEL_TAG from shared_configs.configs import INDEXING_ONLY @@ -170,7 +170,7 @@ def warm_up_connector_classifier_model() -> None: input_ids, attention_mask = tokenize_connector_classification_query( ["GitHub"], - "danswer classifier query google doc", + "onyx classifier query google doc", connector_classifier_tokenizer, connector_classifier.connector_end_token_id, ) diff --git a/backend/model_server/encoders.py b/backend/model_server/encoders.py index ef04c0a7f05..94686f44027 100644 --- a/backend/model_server/encoders.py +++ b/backend/model_server/encoders.py @@ -20,7 +20,6 @@ from vertexai.language_models import TextEmbeddingInput # type: ignore from vertexai.language_models import TextEmbeddingModel # type: ignore -from danswer.utils.logger import setup_logger from model_server.constants import DEFAULT_COHERE_MODEL from model_server.constants import DEFAULT_OPENAI_MODEL from model_server.constants import DEFAULT_VERTEX_MODEL @@ -28,6 +27,7 @@ from model_server.constants import EmbeddingModelTextType from model_server.constants import EmbeddingProvider from model_server.utils import simple_log_function_time +from onyx.utils.logger import setup_logger from shared_configs.configs import API_BASED_EMBEDDING_TIMEOUT from shared_configs.configs import INDEXING_ONLY from shared_configs.configs import OPENAI_EMBEDDING_TIMEOUT @@ -114,7 +114,7 @@ async def _embed_cohere( final_embeddings: list[Embedding] = [] for text_batch in batch_list(texts, _COHERE_MAX_INPUT_LEN): - # Does not use the same tokenizer as the Danswer API server but it's approximately the same + # Does not use the same tokenizer as the Onyx API server but it's approximately the same # empirically it's only off by a very few tokens so it's not a big deal response = await client.embed( texts=text_batch, diff --git a/backend/model_server/main.py b/backend/model_server/main.py index ce9cc724a98..2864af324d3 100644 --- a/backend/model_server/main.py +++ b/backend/model_server/main.py @@ -12,12 +12,12 @@ from sentry_sdk.integrations.starlette import StarletteIntegration from transformers import logging as transformer_logging # type:ignore -from danswer import __version__ -from danswer.utils.logger import setup_logger from model_server.custom_models import router as custom_models_router from model_server.custom_models import warm_up_intent_model from model_server.encoders import router as encoders_router from model_server.management_endpoints import router as management_router +from onyx import __version__ +from onyx.utils.logger import setup_logger from shared_configs.configs import INDEXING_ONLY from shared_configs.configs import MIN_THREADS_ML_MODELS from shared_configs.configs import MODEL_SERVER_ALLOWED_HOST @@ -83,7 +83,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator: def get_model_app() -> FastAPI: application = FastAPI( - title="Danswer Model Server", version=__version__, lifespan=lifespan + title="Onyx Model Server", version=__version__, lifespan=lifespan ) if SENTRY_DSN: sentry_sdk.init( @@ -107,7 +107,7 @@ def get_model_app() -> FastAPI: if __name__ == "__main__": logger.notice( - f"Starting Danswer Model Server on http://{MODEL_SERVER_ALLOWED_HOST}:{str(MODEL_SERVER_PORT)}/" + f"Starting Onyx Model Server on http://{MODEL_SERVER_ALLOWED_HOST}:{str(MODEL_SERVER_PORT)}/" ) logger.notice(f"Model Server Version: {__version__}") uvicorn.run(app, host=MODEL_SERVER_ALLOWED_HOST, port=MODEL_SERVER_PORT) diff --git a/backend/model_server/danswer_torch_model.py b/backend/model_server/onyx_torch_model.py similarity index 100% rename from backend/model_server/danswer_torch_model.py rename to backend/model_server/onyx_torch_model.py diff --git a/backend/model_server/utils.py b/backend/model_server/utils.py index 86192b031f6..3580da6846b 100644 --- a/backend/model_server/utils.py +++ b/backend/model_server/utils.py @@ -8,7 +8,7 @@ from typing import cast from typing import TypeVar -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/__init__.py b/backend/onyx/__init__.py similarity index 100% rename from backend/danswer/__init__.py rename to backend/onyx/__init__.py diff --git a/backend/danswer/connectors/danswer_jira/__init__.py b/backend/onyx/access/__init__.py similarity index 100% rename from backend/danswer/connectors/danswer_jira/__init__.py rename to backend/onyx/access/__init__.py diff --git a/backend/danswer/access/access.py b/backend/onyx/access/access.py similarity index 85% rename from backend/danswer/access/access.py rename to backend/onyx/access/access.py index 7c879099594..ec1fd99d33f 100644 --- a/backend/danswer/access/access.py +++ b/backend/onyx/access/access.py @@ -1,12 +1,12 @@ from sqlalchemy.orm import Session -from danswer.access.models import DocumentAccess -from danswer.access.utils import prefix_user_email -from danswer.configs.constants import PUBLIC_DOC_PAT -from danswer.db.document import get_access_info_for_document -from danswer.db.document import get_access_info_for_documents -from danswer.db.models import User -from danswer.utils.variable_functionality import fetch_versioned_implementation +from onyx.access.models import DocumentAccess +from onyx.access.utils import prefix_user_email +from onyx.configs.constants import PUBLIC_DOC_PAT +from onyx.db.document import get_access_info_for_document +from onyx.db.document import get_access_info_for_documents +from onyx.db.models import User +from onyx.utils.variable_functionality import fetch_versioned_implementation def _get_access_for_document( @@ -32,7 +32,7 @@ def get_access_for_document( db_session: Session, ) -> DocumentAccess: versioned_get_access_for_document_fn = fetch_versioned_implementation( - "danswer.access.access", "_get_access_for_document" + "onyx.access.access", "_get_access_for_document" ) return versioned_get_access_for_document_fn(document_id, db_session) # type: ignore @@ -83,7 +83,7 @@ def get_access_for_documents( ) -> dict[str, DocumentAccess]: """Fetches all access information for the given documents.""" versioned_get_access_for_documents_fn = fetch_versioned_implementation( - "danswer.access.access", "_get_access_for_documents" + "onyx.access.access", "_get_access_for_documents" ) return versioned_get_access_for_documents_fn( document_ids, db_session @@ -103,6 +103,6 @@ def _get_acl_for_user(user: User | None, db_session: Session) -> set[str]: def get_acl_for_user(user: User | None, db_session: Session | None = None) -> set[str]: versioned_acl_for_user_fn = fetch_versioned_implementation( - "danswer.access.access", "_get_acl_for_user" + "onyx.access.access", "_get_acl_for_user" ) return versioned_acl_for_user_fn(user, db_session) # type: ignore diff --git a/backend/danswer/access/models.py b/backend/onyx/access/models.py similarity index 91% rename from backend/danswer/access/models.py rename to backend/onyx/access/models.py index 11cf57638f2..e2364fcf7a7 100644 --- a/backend/danswer/access/models.py +++ b/backend/onyx/access/models.py @@ -1,9 +1,9 @@ from dataclasses import dataclass -from danswer.access.utils import prefix_external_group -from danswer.access.utils import prefix_user_email -from danswer.access.utils import prefix_user_group -from danswer.configs.constants import PUBLIC_DOC_PAT +from onyx.access.utils import prefix_external_group +from onyx.access.utils import prefix_user_email +from onyx.access.utils import prefix_user_group +from onyx.configs.constants import PUBLIC_DOC_PAT @dataclass(frozen=True) @@ -12,7 +12,7 @@ class ExternalAccess: external_user_emails: set[str] # Names or external IDs of groups with access to the doc external_user_group_ids: set[str] - # Whether the document is public in the external system or Danswer + # Whether the document is public in the external system or Onyx is_public: bool @@ -58,7 +58,7 @@ def from_dict(cls, data: dict) -> "DocExternalAccess": @dataclass(frozen=True) class DocumentAccess(ExternalAccess): - # User emails for Danswer users, None indicates admin + # User emails for Onyx users, None indicates admin user_emails: set[str | None] # Names of user groups associated with this document user_groups: set[str] diff --git a/backend/danswer/access/utils.py b/backend/onyx/access/utils.py similarity index 81% rename from backend/danswer/access/utils.py rename to backend/onyx/access/utils.py index 82abf9785f8..3ff9c42bc71 100644 --- a/backend/danswer/access/utils.py +++ b/backend/onyx/access/utils.py @@ -1,9 +1,9 @@ -from danswer.configs.constants import DocumentSource +from onyx.configs.constants import DocumentSource def prefix_user_email(user_email: str) -> str: """Prefixes a user email to eliminate collision with group names. - This applies to both a Danswer user and an External user, this is to make the query time + This applies to both a Onyx user and an External user, this is to make the query time more efficient""" return f"user_email:{user_email}" @@ -15,7 +15,7 @@ def prefix_user_group(user_group_name: str) -> str: def prefix_external_group(ext_group_name: str) -> str: - """Prefixes an external group name to eliminate collision with user emails / Danswer groups.""" + """Prefixes an external group name to eliminate collision with user emails / Onyx groups.""" return f"external_group:{ext_group_name}" diff --git a/backend/danswer/connectors/discourse/__init__.py b/backend/onyx/auth/__init__.py similarity index 100% rename from backend/danswer/connectors/discourse/__init__.py rename to backend/onyx/auth/__init__.py diff --git a/backend/danswer/auth/api_key.py b/backend/onyx/auth/api_key.py similarity index 95% rename from backend/danswer/auth/api_key.py rename to backend/onyx/auth/api_key.py index 4931a9037ca..ebb974f8b9c 100644 --- a/backend/danswer/auth/api_key.py +++ b/backend/onyx/auth/api_key.py @@ -8,8 +8,8 @@ from passlib.hash import sha256_crypt from pydantic import BaseModel -from danswer.auth.schemas import UserRole -from danswer.configs.app_configs import API_KEY_HASH_ROUNDS +from onyx.auth.schemas import UserRole +from onyx.configs.app_configs import API_KEY_HASH_ROUNDS _API_KEY_HEADER_NAME = "Authorization" @@ -17,7 +17,7 @@ # to non-standard, experimental, or custom headers in HTTP or other protocols. It # indicates that the header is not part of the official standards defined by # organizations like the Internet Engineering Task Force (IETF). -_API_KEY_HEADER_ALTERNATIVE_NAME = "X-Danswer-Authorization" +_API_KEY_HEADER_ALTERNATIVE_NAME = "X-Onyx-Authorization" _BEARER_PREFIX = "Bearer " _API_KEY_PREFIX = "on_" _DEPRECATED_API_KEY_PREFIX = "dn_" diff --git a/backend/danswer/auth/invited_users.py b/backend/onyx/auth/invited_users.py similarity index 62% rename from backend/danswer/auth/invited_users.py rename to backend/onyx/auth/invited_users.py index ff3a8cce95e..896b3994934 100644 --- a/backend/danswer/auth/invited_users.py +++ b/backend/onyx/auth/invited_users.py @@ -1,9 +1,9 @@ from typing import cast -from danswer.configs.constants import KV_USER_STORE_KEY -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.utils.special_types import JSON_ro +from onyx.configs.constants import KV_USER_STORE_KEY +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.utils.special_types import JSON_ro def get_invited_users() -> list[str]: diff --git a/backend/danswer/auth/noauth_user.py b/backend/onyx/auth/noauth_user.py similarity index 71% rename from backend/danswer/auth/noauth_user.py rename to backend/onyx/auth/noauth_user.py index c7e11cd452a..e26032a9a99 100644 --- a/backend/danswer/auth/noauth_user.py +++ b/backend/onyx/auth/noauth_user.py @@ -2,12 +2,12 @@ from typing import Any from typing import cast -from danswer.auth.schemas import UserRole -from danswer.configs.constants import KV_NO_AUTH_USER_PREFERENCES_KEY -from danswer.key_value_store.store import KeyValueStore -from danswer.key_value_store.store import KvKeyNotFoundError -from danswer.server.manage.models import UserInfo -from danswer.server.manage.models import UserPreferences +from onyx.auth.schemas import UserRole +from onyx.configs.constants import KV_NO_AUTH_USER_PREFERENCES_KEY +from onyx.key_value_store.store import KeyValueStore +from onyx.key_value_store.store import KvKeyNotFoundError +from onyx.server.manage.models import UserInfo +from onyx.server.manage.models import UserPreferences def set_no_auth_user_preferences( @@ -31,7 +31,7 @@ def load_no_auth_user_preferences(store: KeyValueStore) -> UserPreferences: def fetch_no_auth_user(store: KeyValueStore) -> UserInfo: return UserInfo( id="__no_auth_user__", - email="anonymous@danswer.ai", + email="anonymous@onyx.app", is_active=True, is_superuser=False, is_verified=True, diff --git a/backend/danswer/auth/schemas.py b/backend/onyx/auth/schemas.py similarity index 93% rename from backend/danswer/auth/schemas.py rename to backend/onyx/auth/schemas.py index e943504c584..51983dd3e00 100644 --- a/backend/danswer/auth/schemas.py +++ b/backend/onyx/auth/schemas.py @@ -14,7 +14,7 @@ class UserRole(str, Enum): - Global Curator can perform admin actions for all groups they are a member of - Limited can access a limited set of basic api endpoints - - Slack are users that have used danswer via slack but dont have a web login + - Slack are users that have used onyx via slack but dont have a web login - External permissioned users that have been picked up during the external permissions sync process but don't have a web login """ diff --git a/backend/danswer/auth/users.py b/backend/onyx/auth/users.py similarity index 92% rename from backend/danswer/auth/users.py rename to backend/onyx/auth/users.py index 13f39643f4b..3347a14cbf2 100644 --- a/backend/danswer/auth/users.py +++ b/backend/onyx/auth/users.py @@ -51,47 +51,47 @@ from sqlalchemy import text from sqlalchemy.ext.asyncio import AsyncSession -from danswer.auth.api_key import get_hashed_api_key_from_request -from danswer.auth.invited_users import get_invited_users -from danswer.auth.schemas import UserCreate -from danswer.auth.schemas import UserRole -from danswer.auth.schemas import UserUpdate -from danswer.configs.app_configs import AUTH_TYPE -from danswer.configs.app_configs import DISABLE_AUTH -from danswer.configs.app_configs import EMAIL_FROM -from danswer.configs.app_configs import REQUIRE_EMAIL_VERIFICATION -from danswer.configs.app_configs import SESSION_EXPIRE_TIME_SECONDS -from danswer.configs.app_configs import SMTP_PASS -from danswer.configs.app_configs import SMTP_PORT -from danswer.configs.app_configs import SMTP_SERVER -from danswer.configs.app_configs import SMTP_USER -from danswer.configs.app_configs import TRACK_EXTERNAL_IDP_EXPIRY -from danswer.configs.app_configs import USER_AUTH_SECRET -from danswer.configs.app_configs import VALID_EMAIL_DOMAINS -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.configs.constants import AuthType -from danswer.configs.constants import DANSWER_API_KEY_DUMMY_EMAIL_DOMAIN -from danswer.configs.constants import DANSWER_API_KEY_PREFIX -from danswer.configs.constants import UNNAMED_KEY_PLACEHOLDER -from danswer.db.api_key import fetch_user_for_api_key -from danswer.db.auth import get_access_token_db -from danswer.db.auth import get_default_admin_user_emails -from danswer.db.auth import get_user_count -from danswer.db.auth import get_user_db -from danswer.db.auth import SQLAlchemyUserAdminDB -from danswer.db.engine import get_async_session -from danswer.db.engine import get_async_session_with_tenant -from danswer.db.engine import get_session_with_tenant -from danswer.db.models import AccessToken -from danswer.db.models import OAuthAccount -from danswer.db.models import User -from danswer.db.users import get_user_by_email -from danswer.server.utils import BasicAuthenticationError -from danswer.utils.logger import setup_logger -from danswer.utils.telemetry import optional_telemetry -from danswer.utils.telemetry import RecordType -from danswer.utils.variable_functionality import fetch_ee_implementation_or_noop -from danswer.utils.variable_functionality import fetch_versioned_implementation +from onyx.auth.api_key import get_hashed_api_key_from_request +from onyx.auth.invited_users import get_invited_users +from onyx.auth.schemas import UserCreate +from onyx.auth.schemas import UserRole +from onyx.auth.schemas import UserUpdate +from onyx.configs.app_configs import AUTH_TYPE +from onyx.configs.app_configs import DISABLE_AUTH +from onyx.configs.app_configs import EMAIL_FROM +from onyx.configs.app_configs import REQUIRE_EMAIL_VERIFICATION +from onyx.configs.app_configs import SESSION_EXPIRE_TIME_SECONDS +from onyx.configs.app_configs import SMTP_PASS +from onyx.configs.app_configs import SMTP_PORT +from onyx.configs.app_configs import SMTP_SERVER +from onyx.configs.app_configs import SMTP_USER +from onyx.configs.app_configs import TRACK_EXTERNAL_IDP_EXPIRY +from onyx.configs.app_configs import USER_AUTH_SECRET +from onyx.configs.app_configs import VALID_EMAIL_DOMAINS +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.configs.constants import AuthType +from onyx.configs.constants import DANSWER_API_KEY_DUMMY_EMAIL_DOMAIN +from onyx.configs.constants import DANSWER_API_KEY_PREFIX +from onyx.configs.constants import UNNAMED_KEY_PLACEHOLDER +from onyx.db.api_key import fetch_user_for_api_key +from onyx.db.auth import get_access_token_db +from onyx.db.auth import get_default_admin_user_emails +from onyx.db.auth import get_user_count +from onyx.db.auth import get_user_db +from onyx.db.auth import SQLAlchemyUserAdminDB +from onyx.db.engine import get_async_session +from onyx.db.engine import get_async_session_with_tenant +from onyx.db.engine import get_session_with_tenant +from onyx.db.models import AccessToken +from onyx.db.models import OAuthAccount +from onyx.db.models import User +from onyx.db.users import get_user_by_email +from onyx.server.utils import BasicAuthenticationError +from onyx.utils.logger import setup_logger +from onyx.utils.telemetry import optional_telemetry +from onyx.utils.telemetry import RecordType +from onyx.utils.variable_functionality import fetch_ee_implementation_or_noop +from onyx.utils.variable_functionality import fetch_versioned_implementation from shared_configs.configs import async_return_default_schema from shared_configs.configs import MULTI_TENANT from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR @@ -195,7 +195,7 @@ def send_user_verification_email( mail_from: str = EMAIL_FROM, ) -> None: msg = MIMEMultipart() - msg["Subject"] = "Danswer Email Verification" + msg["Subject"] = "Onyx Email Verification" msg["To"] = user_email if mail_from: msg["From"] = mail_from @@ -230,7 +230,7 @@ async def create( referral_source = request.cookies.get("referral_source", None) tenant_id = await fetch_ee_implementation_or_noop( - "danswer.server.tenants.provisioning", + "onyx.server.tenants.provisioning", "get_or_create_tenant_id", async_return_default_schema, )( @@ -298,7 +298,7 @@ async def oauth_callback( referral_source = getattr(request.state, "referral_source", None) tenant_id = await fetch_ee_implementation_or_noop( - "danswer.server.tenants.provisioning", + "onyx.server.tenants.provisioning", "get_or_create_tenant_id", async_return_default_schema, )( @@ -448,7 +448,7 @@ async def authenticate( # Get tenant_id from mapping table tenant_id = await fetch_ee_implementation_or_noop( - "danswer.server.tenants.provisioning", + "onyx.server.tenants.provisioning", "get_or_create_tenant_id", async_return_default_schema, )( @@ -509,7 +509,7 @@ async def get_user_manager( class TenantAwareJWTStrategy(JWTStrategy): async def _create_token_data(self, user: User, impersonate: bool = False) -> dict: tenant_id = await fetch_ee_implementation_or_noop( - "danswer.server.tenants.provisioning", + "onyx.server.tenants.provisioning", "get_or_create_tenant_id", async_return_default_schema, )( @@ -618,7 +618,7 @@ async def optional_user( user: User | None = Depends(optional_fastapi_current_user), ) -> User | None: versioned_fetch_user = fetch_versioned_implementation( - "danswer.auth.users", "optional_user_" + "onyx.auth.users", "optional_user_" ) user = await versioned_fetch_user(request, user, async_db_session) @@ -720,7 +720,7 @@ async def current_admin_user(user: User | None = Depends(current_user)) -> User def get_default_admin_user_emails_() -> list[str]: - # No default seeding available for Danswer MIT + # No default seeding available for Onyx MIT return [] @@ -740,7 +740,7 @@ def generate_state_token( # refer to https://github.com/fastapi-users/fastapi-users/blob/42ddc241b965475390e2bce887b084152ae1a2cd/fastapi_users/fastapi_users.py#L91 -def create_danswer_oauth_router( +def create_onyx_oauth_router( oauth_client: BaseOAuth2, backend: AuthenticationBackend, state_secret: SecretType, diff --git a/backend/danswer/background/celery/apps/app_base.py b/backend/onyx/background/celery/apps/app_base.py similarity index 90% rename from backend/danswer/background/celery/apps/app_base.py rename to backend/onyx/background/celery/apps/app_base.py index a92f0c742bd..0c3c1c81458 100644 --- a/backend/danswer/background/celery/apps/app_base.py +++ b/backend/onyx/background/celery/apps/app_base.py @@ -16,24 +16,24 @@ from sqlalchemy import text from sqlalchemy.orm import Session -from danswer.background.celery.apps.task_formatters import CeleryTaskColoredFormatter -from danswer.background.celery.apps.task_formatters import CeleryTaskPlainFormatter -from danswer.background.celery.celery_utils import celery_is_worker_primary -from danswer.configs.constants import DanswerRedisLocks -from danswer.db.engine import get_sqlalchemy_engine -from danswer.document_index.vespa_constants import VESPA_CONFIG_SERVER_URL -from danswer.redis.redis_connector import RedisConnector -from danswer.redis.redis_connector_credential_pair import RedisConnectorCredentialPair -from danswer.redis.redis_connector_delete import RedisConnectorDelete -from danswer.redis.redis_connector_doc_perm_sync import RedisConnectorPermissionSync -from danswer.redis.redis_connector_ext_group_sync import RedisConnectorExternalGroupSync -from danswer.redis.redis_connector_prune import RedisConnectorPrune -from danswer.redis.redis_document_set import RedisDocumentSet -from danswer.redis.redis_pool import get_redis_client -from danswer.redis.redis_usergroup import RedisUserGroup -from danswer.utils.logger import ColoredFormatter -from danswer.utils.logger import PlainFormatter -from danswer.utils.logger import setup_logger +from onyx.background.celery.apps.task_formatters import CeleryTaskColoredFormatter +from onyx.background.celery.apps.task_formatters import CeleryTaskPlainFormatter +from onyx.background.celery.celery_utils import celery_is_worker_primary +from onyx.configs.constants import OnyxRedisLocks +from onyx.db.engine import get_sqlalchemy_engine +from onyx.document_index.vespa_constants import VESPA_CONFIG_SERVER_URL +from onyx.redis.redis_connector import RedisConnector +from onyx.redis.redis_connector_credential_pair import RedisConnectorCredentialPair +from onyx.redis.redis_connector_delete import RedisConnectorDelete +from onyx.redis.redis_connector_doc_perm_sync import RedisConnectorPermissionSync +from onyx.redis.redis_connector_ext_group_sync import RedisConnectorExternalGroupSync +from onyx.redis.redis_connector_prune import RedisConnectorPrune +from onyx.redis.redis_document_set import RedisDocumentSet +from onyx.redis.redis_pool import get_redis_client +from onyx.redis.redis_usergroup import RedisUserGroup +from onyx.utils.logger import ColoredFormatter +from onyx.utils.logger import PlainFormatter +from onyx.utils.logger import setup_logger from shared_configs.configs import SENTRY_DSN @@ -300,7 +300,7 @@ def on_secondary_worker_init(sender: Any, **kwargs: Any) -> None: logger.info("Waiting for primary worker to be ready...") while True: - if r.exists(DanswerRedisLocks.PRIMARY_WORKER): + if r.exists(OnyxRedisLocks.PRIMARY_WORKER): break time_elapsed = time.monotonic() - time_start diff --git a/backend/danswer/background/celery/apps/beat.py b/backend/onyx/background/celery/apps/beat.py similarity index 92% rename from backend/danswer/background/celery/apps/beat.py rename to backend/onyx/background/celery/apps/beat.py index f7ae3ec2655..6880a253a81 100644 --- a/backend/danswer/background/celery/apps/beat.py +++ b/backend/onyx/background/celery/apps/beat.py @@ -6,19 +6,19 @@ from celery.beat import PersistentScheduler # type: ignore from celery.signals import beat_init -import danswer.background.celery.apps.app_base as app_base -from danswer.configs.constants import POSTGRES_CELERY_BEAT_APP_NAME -from danswer.db.engine import get_all_tenant_ids -from danswer.db.engine import SqlEngine -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_versioned_implementation +import onyx.background.celery.apps.app_base as app_base +from onyx.configs.constants import POSTGRES_CELERY_BEAT_APP_NAME +from onyx.db.engine import get_all_tenant_ids +from onyx.db.engine import SqlEngine +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_versioned_implementation from shared_configs.configs import IGNORED_SYNCING_TENANT_LIST from shared_configs.configs import MULTI_TENANT logger = setup_logger(__name__) celery_app = Celery(__name__) -celery_app.config_from_object("danswer.background.celery.configs.beat") +celery_app.config_from_object("onyx.background.celery.configs.beat") class DynamicTenantScheduler(PersistentScheduler): @@ -59,7 +59,7 @@ def _update_tenant_tasks(self) -> None: logger.info("Fetching tasks to schedule") tasks_to_schedule = fetch_versioned_implementation( - "danswer.background.celery.tasks.beat_schedule", "get_tasks_to_schedule" + "onyx.background.celery.tasks.beat_schedule", "get_tasks_to_schedule" ) new_beat_schedule: dict[str, dict[str, Any]] = {} diff --git a/backend/danswer/background/celery/apps/heavy.py b/backend/onyx/background/celery/apps/heavy.py similarity index 83% rename from backend/danswer/background/celery/apps/heavy.py rename to backend/onyx/background/celery/apps/heavy.py index 714c91ee421..efbbf64fda5 100644 --- a/backend/danswer/background/celery/apps/heavy.py +++ b/backend/onyx/background/celery/apps/heavy.py @@ -9,17 +9,17 @@ from celery.signals import worker_ready from celery.signals import worker_shutdown -import danswer.background.celery.apps.app_base as app_base -from danswer.configs.constants import POSTGRES_CELERY_WORKER_HEAVY_APP_NAME -from danswer.db.engine import SqlEngine -from danswer.utils.logger import setup_logger +import onyx.background.celery.apps.app_base as app_base +from onyx.configs.constants import POSTGRES_CELERY_WORKER_HEAVY_APP_NAME +from onyx.db.engine import SqlEngine +from onyx.utils.logger import setup_logger from shared_configs.configs import MULTI_TENANT logger = setup_logger() celery_app = Celery(__name__) -celery_app.config_from_object("danswer.background.celery.configs.heavy") +celery_app.config_from_object("onyx.background.celery.configs.heavy") @signals.task_prerun.connect @@ -90,8 +90,8 @@ def on_setup_logging( celery_app.autodiscover_tasks( [ - "danswer.background.celery.tasks.pruning", - "danswer.background.celery.tasks.doc_permission_syncing", - "danswer.background.celery.tasks.external_group_syncing", + "onyx.background.celery.tasks.pruning", + "onyx.background.celery.tasks.doc_permission_syncing", + "onyx.background.celery.tasks.external_group_syncing", ] ) diff --git a/backend/danswer/background/celery/apps/indexing.py b/backend/onyx/background/celery/apps/indexing.py similarity index 88% rename from backend/danswer/background/celery/apps/indexing.py rename to backend/onyx/background/celery/apps/indexing.py index 9cd8d42af5e..466964c7a5a 100644 --- a/backend/danswer/background/celery/apps/indexing.py +++ b/backend/onyx/background/celery/apps/indexing.py @@ -10,17 +10,17 @@ from celery.signals import worker_ready from celery.signals import worker_shutdown -import danswer.background.celery.apps.app_base as app_base -from danswer.configs.constants import POSTGRES_CELERY_WORKER_INDEXING_APP_NAME -from danswer.db.engine import SqlEngine -from danswer.utils.logger import setup_logger +import onyx.background.celery.apps.app_base as app_base +from onyx.configs.constants import POSTGRES_CELERY_WORKER_INDEXING_APP_NAME +from onyx.db.engine import SqlEngine +from onyx.utils.logger import setup_logger from shared_configs.configs import MULTI_TENANT logger = setup_logger() celery_app = Celery(__name__) -celery_app.config_from_object("danswer.background.celery.configs.indexing") +celery_app.config_from_object("onyx.background.celery.configs.indexing") @signals.task_prerun.connect @@ -96,6 +96,6 @@ def on_setup_logging( celery_app.autodiscover_tasks( [ - "danswer.background.celery.tasks.indexing", + "onyx.background.celery.tasks.indexing", ] ) diff --git a/backend/danswer/background/celery/apps/light.py b/backend/onyx/background/celery/apps/light.py similarity index 82% rename from backend/danswer/background/celery/apps/light.py rename to backend/onyx/background/celery/apps/light.py index 17292743f9d..cf156f05f0b 100644 --- a/backend/danswer/background/celery/apps/light.py +++ b/backend/onyx/background/celery/apps/light.py @@ -9,17 +9,17 @@ from celery.signals import worker_ready from celery.signals import worker_shutdown -import danswer.background.celery.apps.app_base as app_base -from danswer.configs.constants import POSTGRES_CELERY_WORKER_LIGHT_APP_NAME -from danswer.db.engine import SqlEngine -from danswer.utils.logger import setup_logger +import onyx.background.celery.apps.app_base as app_base +from onyx.configs.constants import POSTGRES_CELERY_WORKER_LIGHT_APP_NAME +from onyx.db.engine import SqlEngine +from onyx.utils.logger import setup_logger from shared_configs.configs import MULTI_TENANT logger = setup_logger() celery_app = Celery(__name__) -celery_app.config_from_object("danswer.background.celery.configs.light") +celery_app.config_from_object("onyx.background.celery.configs.light") @signals.task_prerun.connect @@ -89,9 +89,9 @@ def on_setup_logging( celery_app.autodiscover_tasks( [ - "danswer.background.celery.tasks.shared", - "danswer.background.celery.tasks.vespa", - "danswer.background.celery.tasks.connector_deletion", - "danswer.background.celery.tasks.doc_permission_syncing", + "onyx.background.celery.tasks.shared", + "onyx.background.celery.tasks.vespa", + "onyx.background.celery.tasks.connector_deletion", + "onyx.background.celery.tasks.doc_permission_syncing", ] ) diff --git a/backend/danswer/background/celery/apps/primary.py b/backend/onyx/background/celery/apps/primary.py similarity index 79% rename from backend/danswer/background/celery/apps/primary.py rename to backend/onyx/background/celery/apps/primary.py index cab251c6fb3..48d60b801b2 100644 --- a/backend/danswer/background/celery/apps/primary.py +++ b/backend/onyx/background/celery/apps/primary.py @@ -13,36 +13,36 @@ from celery.signals import worker_shutdown from redis.lock import Lock as RedisLock -import danswer.background.celery.apps.app_base as app_base -from danswer.background.celery.apps.app_base import task_logger -from danswer.background.celery.celery_utils import celery_is_worker_primary -from danswer.background.celery.tasks.indexing.tasks import ( +import onyx.background.celery.apps.app_base as app_base +from onyx.background.celery.apps.app_base import task_logger +from onyx.background.celery.celery_utils import celery_is_worker_primary +from onyx.background.celery.tasks.indexing.tasks import ( get_unfenced_index_attempt_ids, ) -from danswer.configs.constants import CELERY_PRIMARY_WORKER_LOCK_TIMEOUT -from danswer.configs.constants import DanswerRedisLocks -from danswer.configs.constants import POSTGRES_CELERY_WORKER_PRIMARY_APP_NAME -from danswer.db.engine import get_session_with_default_tenant -from danswer.db.engine import SqlEngine -from danswer.db.index_attempt import get_index_attempt -from danswer.db.index_attempt import mark_attempt_canceled -from danswer.redis.redis_connector_credential_pair import RedisConnectorCredentialPair -from danswer.redis.redis_connector_delete import RedisConnectorDelete -from danswer.redis.redis_connector_doc_perm_sync import RedisConnectorPermissionSync -from danswer.redis.redis_connector_ext_group_sync import RedisConnectorExternalGroupSync -from danswer.redis.redis_connector_index import RedisConnectorIndex -from danswer.redis.redis_connector_prune import RedisConnectorPrune -from danswer.redis.redis_connector_stop import RedisConnectorStop -from danswer.redis.redis_document_set import RedisDocumentSet -from danswer.redis.redis_pool import get_redis_client -from danswer.redis.redis_usergroup import RedisUserGroup -from danswer.utils.logger import setup_logger +from onyx.configs.constants import CELERY_PRIMARY_WORKER_LOCK_TIMEOUT +from onyx.configs.constants import OnyxRedisLocks +from onyx.configs.constants import POSTGRES_CELERY_WORKER_PRIMARY_APP_NAME +from onyx.db.engine import get_session_with_default_tenant +from onyx.db.engine import SqlEngine +from onyx.db.index_attempt import get_index_attempt +from onyx.db.index_attempt import mark_attempt_canceled +from onyx.redis.redis_connector_credential_pair import RedisConnectorCredentialPair +from onyx.redis.redis_connector_delete import RedisConnectorDelete +from onyx.redis.redis_connector_doc_perm_sync import RedisConnectorPermissionSync +from onyx.redis.redis_connector_ext_group_sync import RedisConnectorExternalGroupSync +from onyx.redis.redis_connector_index import RedisConnectorIndex +from onyx.redis.redis_connector_prune import RedisConnectorPrune +from onyx.redis.redis_connector_stop import RedisConnectorStop +from onyx.redis.redis_document_set import RedisDocumentSet +from onyx.redis.redis_pool import get_redis_client +from onyx.redis.redis_usergroup import RedisUserGroup +from onyx.utils.logger import setup_logger from shared_configs.configs import MULTI_TENANT logger = setup_logger() celery_app = Celery(__name__) -celery_app.config_from_object("danswer.background.celery.configs.primary") +celery_app.config_from_object("onyx.background.celery.configs.primary") @signals.task_prerun.connect @@ -110,7 +110,7 @@ def on_worker_init(sender: Any, **kwargs: Any) -> None: # For the moment, we're assuming that we are the only primary worker # that should be running. # TODO: maybe check for or clean up another zombie primary worker if we detect it - r.delete(DanswerRedisLocks.PRIMARY_WORKER) + r.delete(OnyxRedisLocks.PRIMARY_WORKER) # this process wide lock is taken to help other workers start up in order. # it is planned to use this lock to enforce singleton behavior on the primary @@ -120,7 +120,7 @@ def on_worker_init(sender: Any, **kwargs: Any) -> None: # set thread_local=False since we don't control what thread the periodic task might # reacquire the lock with lock: RedisLock = r.lock( - DanswerRedisLocks.PRIMARY_WORKER, + OnyxRedisLocks.PRIMARY_WORKER, timeout=CELERY_PRIMARY_WORKER_LOCK_TIMEOUT, thread_local=False, ) @@ -138,8 +138,8 @@ def on_worker_init(sender: Any, **kwargs: Any) -> None: # As currently designed, when this worker starts as "primary", we reinitialize redis # to a clean state (for our purposes, anyway) - r.delete(DanswerRedisLocks.CHECK_VESPA_SYNC_BEAT_LOCK) - r.delete(DanswerRedisLocks.MONITOR_VESPA_SYNC_BEAT_LOCK) + r.delete(OnyxRedisLocks.CHECK_VESPA_SYNC_BEAT_LOCK) + r.delete(OnyxRedisLocks.MONITOR_VESPA_SYNC_BEAT_LOCK) r.delete(RedisConnectorCredentialPair.get_taskset_key()) r.delete(RedisConnectorCredentialPair.get_fence_key()) @@ -244,7 +244,7 @@ def run_periodic_task(self, worker: Any) -> None: "Reasons could be worker restart or lock expiration." ) lock = r.lock( - DanswerRedisLocks.PRIMARY_WORKER, + OnyxRedisLocks.PRIMARY_WORKER, timeout=CELERY_PRIMARY_WORKER_LOCK_TIMEOUT, ) @@ -273,13 +273,13 @@ def stop(self, worker: Any) -> None: celery_app.autodiscover_tasks( [ - "danswer.background.celery.tasks.connector_deletion", - "danswer.background.celery.tasks.indexing", - "danswer.background.celery.tasks.periodic", - "danswer.background.celery.tasks.doc_permission_syncing", - "danswer.background.celery.tasks.external_group_syncing", - "danswer.background.celery.tasks.pruning", - "danswer.background.celery.tasks.shared", - "danswer.background.celery.tasks.vespa", + "onyx.background.celery.tasks.connector_deletion", + "onyx.background.celery.tasks.indexing", + "onyx.background.celery.tasks.periodic", + "onyx.background.celery.tasks.doc_permission_syncing", + "onyx.background.celery.tasks.external_group_syncing", + "onyx.background.celery.tasks.pruning", + "onyx.background.celery.tasks.shared", + "onyx.background.celery.tasks.vespa", ] ) diff --git a/backend/danswer/background/celery/apps/task_formatters.py b/backend/onyx/background/celery/apps/task_formatters.py similarity index 88% rename from backend/danswer/background/celery/apps/task_formatters.py rename to backend/onyx/background/celery/apps/task_formatters.py index e82b23a5431..5c59de69e2b 100644 --- a/backend/danswer/background/celery/apps/task_formatters.py +++ b/backend/onyx/background/celery/apps/task_formatters.py @@ -2,8 +2,8 @@ from celery import current_task -from danswer.utils.logger import ColoredFormatter -from danswer.utils.logger import PlainFormatter +from onyx.utils.logger import ColoredFormatter +from onyx.utils.logger import PlainFormatter class CeleryTaskPlainFormatter(PlainFormatter): diff --git a/backend/danswer/background/celery/celery_redis.py b/backend/onyx/background/celery/celery_redis.py similarity index 79% rename from backend/danswer/background/celery/celery_redis.py rename to backend/onyx/background/celery/celery_redis.py index 3e205d71ded..9f879bbbee4 100644 --- a/backend/danswer/background/celery/celery_redis.py +++ b/backend/onyx/background/celery/celery_redis.py @@ -3,8 +3,8 @@ from redis import Redis -from danswer.background.celery.configs.base import CELERY_SEPARATOR -from danswer.configs.constants import DanswerCeleryPriority +from onyx.background.celery.configs.base import CELERY_SEPARATOR +from onyx.configs.constants import OnyxCeleryPriority def celery_get_queue_length(queue: str, r: Redis) -> int: @@ -13,7 +13,7 @@ def celery_get_queue_length(queue: str, r: Redis) -> int: used to implement task prioritization. This operation is not atomic.""" total_length = 0 - for i in range(len(DanswerCeleryPriority)): + for i in range(len(OnyxCeleryPriority)): queue_name = queue if i > 0: queue_name += CELERY_SEPARATOR diff --git a/backend/danswer/background/celery/celery_utils.py b/backend/onyx/background/celery/celery_utils.py similarity index 83% rename from backend/danswer/background/celery/celery_utils.py rename to backend/onyx/background/celery/celery_utils.py index 22142fee202..fc6fef1fab5 100644 --- a/backend/danswer/background/celery/celery_utils.py +++ b/backend/onyx/background/celery/celery_utils.py @@ -4,22 +4,22 @@ from sqlalchemy.orm import Session -from danswer.configs.app_configs import MAX_PRUNING_DOCUMENT_RETRIEVAL_PER_MINUTE -from danswer.connectors.cross_connector_utils.rate_limit_wrapper import ( +from onyx.configs.app_configs import MAX_PRUNING_DOCUMENT_RETRIEVAL_PER_MINUTE +from onyx.connectors.cross_connector_utils.rate_limit_wrapper import ( rate_limit_builder, ) -from danswer.connectors.interfaces import BaseConnector -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SlimConnector -from danswer.connectors.models import Document -from danswer.db.connector_credential_pair import get_connector_credential_pair -from danswer.db.enums import TaskStatus -from danswer.db.models import TaskQueueState -from danswer.indexing.indexing_heartbeat import IndexingHeartbeatInterface -from danswer.redis.redis_connector import RedisConnector -from danswer.server.documents.models import DeletionAttemptSnapshot -from danswer.utils.logger import setup_logger +from onyx.connectors.interfaces import BaseConnector +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SlimConnector +from onyx.connectors.models import Document +from onyx.db.connector_credential_pair import get_connector_credential_pair +from onyx.db.enums import TaskStatus +from onyx.db.models import TaskQueueState +from onyx.indexing.indexing_heartbeat import IndexingHeartbeatInterface +from onyx.redis.redis_connector import RedisConnector +from onyx.server.documents.models import DeletionAttemptSnapshot +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/background/celery/configs/base.py b/backend/onyx/background/celery/configs/base.py similarity index 78% rename from backend/danswer/background/celery/configs/base.py rename to backend/onyx/background/celery/configs/base.py index 886fcf545c9..a33c1284a5d 100644 --- a/backend/danswer/background/celery/configs/base.py +++ b/backend/onyx/background/celery/configs/base.py @@ -1,19 +1,19 @@ # docs: https://docs.celeryq.dev/en/stable/userguide/configuration.html import urllib.parse -from danswer.configs.app_configs import CELERY_BROKER_POOL_LIMIT -from danswer.configs.app_configs import CELERY_RESULT_EXPIRES -from danswer.configs.app_configs import REDIS_DB_NUMBER_CELERY -from danswer.configs.app_configs import REDIS_DB_NUMBER_CELERY_RESULT_BACKEND -from danswer.configs.app_configs import REDIS_HEALTH_CHECK_INTERVAL -from danswer.configs.app_configs import REDIS_HOST -from danswer.configs.app_configs import REDIS_PASSWORD -from danswer.configs.app_configs import REDIS_PORT -from danswer.configs.app_configs import REDIS_SSL -from danswer.configs.app_configs import REDIS_SSL_CA_CERTS -from danswer.configs.app_configs import REDIS_SSL_CERT_REQS -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import REDIS_SOCKET_KEEPALIVE_OPTIONS +from onyx.configs.app_configs import CELERY_BROKER_POOL_LIMIT +from onyx.configs.app_configs import CELERY_RESULT_EXPIRES +from onyx.configs.app_configs import REDIS_DB_NUMBER_CELERY +from onyx.configs.app_configs import REDIS_DB_NUMBER_CELERY_RESULT_BACKEND +from onyx.configs.app_configs import REDIS_HEALTH_CHECK_INTERVAL +from onyx.configs.app_configs import REDIS_HOST +from onyx.configs.app_configs import REDIS_PASSWORD +from onyx.configs.app_configs import REDIS_PORT +from onyx.configs.app_configs import REDIS_SSL +from onyx.configs.app_configs import REDIS_SSL_CA_CERTS +from onyx.configs.app_configs import REDIS_SSL_CERT_REQS +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import REDIS_SOCKET_KEEPALIVE_OPTIONS CELERY_SEPARATOR = ":" @@ -41,7 +41,7 @@ # redis broker settings # https://docs.celeryq.dev/projects/kombu/en/stable/reference/kombu.transport.redis.html broker_transport_options = { - "priority_steps": list(range(len(DanswerCeleryPriority))), + "priority_steps": list(range(len(OnyxCeleryPriority))), "sep": CELERY_SEPARATOR, "queue_order_strategy": "priority", "retry_on_timeout": True, @@ -60,7 +60,7 @@ redis_backend_health_check_interval = REDIS_HEALTH_CHECK_INTERVAL -task_default_priority = DanswerCeleryPriority.MEDIUM +task_default_priority = OnyxCeleryPriority.MEDIUM task_acks_late = True # region Task result backend settings diff --git a/backend/danswer/background/celery/configs/beat.py b/backend/onyx/background/celery/configs/beat.py similarity index 91% rename from backend/danswer/background/celery/configs/beat.py rename to backend/onyx/background/celery/configs/beat.py index ef8b21c386f..171b033cb6c 100644 --- a/backend/danswer/background/celery/configs/beat.py +++ b/backend/onyx/background/celery/configs/beat.py @@ -1,5 +1,5 @@ # docs: https://docs.celeryq.dev/en/stable/userguide/configuration.html -import danswer.background.celery.configs.base as shared_config +import onyx.background.celery.configs.base as shared_config broker_url = shared_config.broker_url broker_connection_retry_on_startup = shared_config.broker_connection_retry_on_startup diff --git a/backend/danswer/background/celery/configs/heavy.py b/backend/onyx/background/celery/configs/heavy.py similarity index 92% rename from backend/danswer/background/celery/configs/heavy.py rename to backend/onyx/background/celery/configs/heavy.py index 2d1c65aa86e..52019bb7349 100644 --- a/backend/danswer/background/celery/configs/heavy.py +++ b/backend/onyx/background/celery/configs/heavy.py @@ -1,4 +1,4 @@ -import danswer.background.celery.configs.base as shared_config +import onyx.background.celery.configs.base as shared_config broker_url = shared_config.broker_url broker_connection_retry_on_startup = shared_config.broker_connection_retry_on_startup diff --git a/backend/danswer/background/celery/configs/indexing.py b/backend/onyx/background/celery/configs/indexing.py similarity index 85% rename from backend/danswer/background/celery/configs/indexing.py rename to backend/onyx/background/celery/configs/indexing.py index d2b1b99baa9..1c6a2b662f5 100644 --- a/backend/danswer/background/celery/configs/indexing.py +++ b/backend/onyx/background/celery/configs/indexing.py @@ -1,5 +1,5 @@ -import danswer.background.celery.configs.base as shared_config -from danswer.configs.app_configs import CELERY_WORKER_INDEXING_CONCURRENCY +import onyx.background.celery.configs.base as shared_config +from onyx.configs.app_configs import CELERY_WORKER_INDEXING_CONCURRENCY broker_url = shared_config.broker_url broker_connection_retry_on_startup = shared_config.broker_connection_retry_on_startup diff --git a/backend/danswer/background/celery/configs/light.py b/backend/onyx/background/celery/configs/light.py similarity index 79% rename from backend/danswer/background/celery/configs/light.py rename to backend/onyx/background/celery/configs/light.py index f75ddfd0fb5..5eaa091796d 100644 --- a/backend/danswer/background/celery/configs/light.py +++ b/backend/onyx/background/celery/configs/light.py @@ -1,6 +1,6 @@ -import danswer.background.celery.configs.base as shared_config -from danswer.configs.app_configs import CELERY_WORKER_LIGHT_CONCURRENCY -from danswer.configs.app_configs import CELERY_WORKER_LIGHT_PREFETCH_MULTIPLIER +import onyx.background.celery.configs.base as shared_config +from onyx.configs.app_configs import CELERY_WORKER_LIGHT_CONCURRENCY +from onyx.configs.app_configs import CELERY_WORKER_LIGHT_PREFETCH_MULTIPLIER broker_url = shared_config.broker_url broker_connection_retry_on_startup = shared_config.broker_connection_retry_on_startup diff --git a/backend/danswer/background/celery/configs/primary.py b/backend/onyx/background/celery/configs/primary.py similarity index 92% rename from backend/danswer/background/celery/configs/primary.py rename to backend/onyx/background/celery/configs/primary.py index 2d1c65aa86e..52019bb7349 100644 --- a/backend/danswer/background/celery/configs/primary.py +++ b/backend/onyx/background/celery/configs/primary.py @@ -1,4 +1,4 @@ -import danswer.background.celery.configs.base as shared_config +import onyx.background.celery.configs.base as shared_config broker_url = shared_config.broker_url broker_connection_retry_on_startup = shared_config.broker_connection_retry_on_startup diff --git a/backend/onyx/background/celery/tasks/beat_schedule.py b/backend/onyx/background/celery/tasks/beat_schedule.py new file mode 100644 index 00000000000..c3d45d616f8 --- /dev/null +++ b/backend/onyx/background/celery/tasks/beat_schedule.py @@ -0,0 +1,61 @@ +from datetime import timedelta +from typing import Any + +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryTask + + +tasks_to_schedule = [ + { + "name": "check-for-vespa-sync", + "task": OnyxCeleryTask.CHECK_FOR_VESPA_SYNC_TASK, + "schedule": timedelta(seconds=20), + "options": {"priority": OnyxCeleryPriority.HIGH}, + }, + { + "name": "check-for-connector-deletion", + "task": OnyxCeleryTask.CHECK_FOR_CONNECTOR_DELETION, + "schedule": timedelta(seconds=20), + "options": {"priority": OnyxCeleryPriority.HIGH}, + }, + { + "name": "check-for-indexing", + "task": OnyxCeleryTask.CHECK_FOR_INDEXING, + "schedule": timedelta(seconds=15), + "options": {"priority": OnyxCeleryPriority.HIGH}, + }, + { + "name": "check-for-prune", + "task": OnyxCeleryTask.CHECK_FOR_PRUNING, + "schedule": timedelta(seconds=15), + "options": {"priority": OnyxCeleryPriority.HIGH}, + }, + { + "name": "kombu-message-cleanup", + "task": OnyxCeleryTask.KOMBU_MESSAGE_CLEANUP_TASK, + "schedule": timedelta(seconds=3600), + "options": {"priority": OnyxCeleryPriority.LOWEST}, + }, + { + "name": "monitor-vespa-sync", + "task": OnyxCeleryTask.MONITOR_VESPA_SYNC, + "schedule": timedelta(seconds=5), + "options": {"priority": OnyxCeleryPriority.HIGH}, + }, + { + "name": "check-for-doc-permissions-sync", + "task": OnyxCeleryTask.CHECK_FOR_DOC_PERMISSIONS_SYNC, + "schedule": timedelta(seconds=30), + "options": {"priority": OnyxCeleryPriority.HIGH}, + }, + { + "name": "check-for-external-group-sync", + "task": OnyxCeleryTask.CHECK_FOR_EXTERNAL_GROUP_SYNC, + "schedule": timedelta(seconds=20), + "options": {"priority": OnyxCeleryPriority.HIGH}, + }, +] + + +def get_tasks_to_schedule() -> list[dict[str, Any]]: + return tasks_to_schedule diff --git a/backend/danswer/background/celery/tasks/connector_deletion/tasks.py b/backend/onyx/background/celery/tasks/connector_deletion/tasks.py similarity index 86% rename from backend/danswer/background/celery/tasks/connector_deletion/tasks.py rename to backend/onyx/background/celery/tasks/connector_deletion/tasks.py index d0298f2dd6a..31a456286d7 100644 --- a/backend/danswer/background/celery/tasks/connector_deletion/tasks.py +++ b/backend/onyx/background/celery/tasks/connector_deletion/tasks.py @@ -8,19 +8,19 @@ from redis.lock import Lock as RedisLock from sqlalchemy.orm import Session -from danswer.background.celery.apps.app_base import task_logger -from danswer.configs.app_configs import JOB_TIMEOUT -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DanswerCeleryTask -from danswer.configs.constants import DanswerRedisLocks -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.connector_credential_pair import get_connector_credential_pairs -from danswer.db.engine import get_session_with_tenant -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.search_settings import get_all_search_settings -from danswer.redis.redis_connector import RedisConnector -from danswer.redis.redis_connector_delete import RedisConnectorDeletePayload -from danswer.redis.redis_pool import get_redis_client +from onyx.background.celery.apps.app_base import task_logger +from onyx.configs.app_configs import JOB_TIMEOUT +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import OnyxCeleryTask +from onyx.configs.constants import OnyxRedisLocks +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.connector_credential_pair import get_connector_credential_pairs +from onyx.db.engine import get_session_with_tenant +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.search_settings import get_all_search_settings +from onyx.redis.redis_connector import RedisConnector +from onyx.redis.redis_connector_delete import RedisConnectorDeletePayload +from onyx.redis.redis_pool import get_redis_client class TaskDependencyError(RuntimeError): @@ -29,7 +29,7 @@ class TaskDependencyError(RuntimeError): @shared_task( - name=DanswerCeleryTask.CHECK_FOR_CONNECTOR_DELETION, + name=OnyxCeleryTask.CHECK_FOR_CONNECTOR_DELETION, soft_time_limit=JOB_TIMEOUT, trail=False, bind=True, @@ -38,7 +38,7 @@ def check_for_connector_deletion_task(self: Task, *, tenant_id: str | None) -> N r = get_redis_client(tenant_id=tenant_id) lock_beat: RedisLock = r.lock( - DanswerRedisLocks.CHECK_CONNECTOR_DELETION_BEAT_LOCK, + OnyxRedisLocks.CHECK_CONNECTOR_DELETION_BEAT_LOCK, timeout=CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT, ) diff --git a/backend/danswer/background/celery/tasks/doc_permission_syncing/tasks.py b/backend/onyx/background/celery/tasks/doc_permission_syncing/tasks.py similarity index 81% rename from backend/danswer/background/celery/tasks/doc_permission_syncing/tasks.py rename to backend/onyx/background/celery/tasks/doc_permission_syncing/tasks.py index e95fbac05d6..2c65995ef9d 100644 --- a/backend/danswer/background/celery/tasks/doc_permission_syncing/tasks.py +++ b/backend/onyx/background/celery/tasks/doc_permission_syncing/tasks.py @@ -10,35 +10,35 @@ from redis import Redis from redis.lock import Lock as RedisLock -from danswer.access.models import DocExternalAccess -from danswer.background.celery.apps.app_base import task_logger -from danswer.configs.app_configs import JOB_TIMEOUT -from danswer.configs.constants import CELERY_PERMISSIONS_SYNC_LOCK_TIMEOUT -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DANSWER_REDIS_FUNCTION_LOCK_PREFIX -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.configs.constants import DanswerRedisLocks -from danswer.configs.constants import DocumentSource -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.document import upsert_document_by_connector_credential_pair -from danswer.db.engine import get_session_with_tenant -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.models import ConnectorCredentialPair -from danswer.db.users import batch_add_ext_perm_user_if_not_exists -from danswer.redis.redis_connector import RedisConnector -from danswer.redis.redis_connector_doc_perm_sync import ( +from ee.onyx.db.connector_credential_pair import get_all_auto_sync_cc_pairs +from ee.onyx.db.document import upsert_document_external_perms +from ee.onyx.external_permissions.sync_params import DOC_PERMISSION_SYNC_PERIODS +from ee.onyx.external_permissions.sync_params import DOC_PERMISSIONS_FUNC_MAP +from onyx.access.models import DocExternalAccess +from onyx.background.celery.apps.app_base import task_logger +from onyx.configs.app_configs import JOB_TIMEOUT +from onyx.configs.constants import CELERY_PERMISSIONS_SYNC_LOCK_TIMEOUT +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import DANSWER_REDIS_FUNCTION_LOCK_PREFIX +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.configs.constants import OnyxRedisLocks +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.document import upsert_document_by_connector_credential_pair +from onyx.db.engine import get_session_with_tenant +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.models import ConnectorCredentialPair +from onyx.db.users import batch_add_ext_perm_user_if_not_exists +from onyx.redis.redis_connector import RedisConnector +from onyx.redis.redis_connector_doc_perm_sync import ( RedisConnectorPermissionSyncPayload, ) -from danswer.redis.redis_pool import get_redis_client -from danswer.utils.logger import doc_permission_sync_ctx -from danswer.utils.logger import setup_logger -from ee.danswer.db.connector_credential_pair import get_all_auto_sync_cc_pairs -from ee.danswer.db.document import upsert_document_external_perms -from ee.danswer.external_permissions.sync_params import DOC_PERMISSION_SYNC_PERIODS -from ee.danswer.external_permissions.sync_params import DOC_PERMISSIONS_FUNC_MAP +from onyx.redis.redis_pool import get_redis_client +from onyx.utils.logger import doc_permission_sync_ctx +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -84,7 +84,7 @@ def _is_external_doc_permissions_sync_due(cc_pair: ConnectorCredentialPair) -> b @shared_task( - name=DanswerCeleryTask.CHECK_FOR_DOC_PERMISSIONS_SYNC, + name=OnyxCeleryTask.CHECK_FOR_DOC_PERMISSIONS_SYNC, soft_time_limit=JOB_TIMEOUT, bind=True, ) @@ -92,7 +92,7 @@ def check_for_doc_permissions_sync(self: Task, *, tenant_id: str | None) -> None r = get_redis_client(tenant_id=tenant_id) lock_beat = r.lock( - DanswerRedisLocks.CHECK_CONNECTOR_DOC_PERMISSIONS_SYNC_BEAT_LOCK, + OnyxRedisLocks.CHECK_CONNECTOR_DOC_PERMISSIONS_SYNC_BEAT_LOCK, timeout=CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT, ) @@ -166,14 +166,14 @@ def try_creating_permissions_sync_task( custom_task_id = f"{redis_connector.permissions.generator_task_key}_{uuid4()}" result = app.send_task( - DanswerCeleryTask.CONNECTOR_PERMISSION_SYNC_GENERATOR_TASK, + OnyxCeleryTask.CONNECTOR_PERMISSION_SYNC_GENERATOR_TASK, kwargs=dict( cc_pair_id=cc_pair_id, tenant_id=tenant_id, ), - queue=DanswerCeleryQueues.CONNECTOR_DOC_PERMISSIONS_SYNC, + queue=OnyxCeleryQueues.CONNECTOR_DOC_PERMISSIONS_SYNC, task_id=custom_task_id, - priority=DanswerCeleryPriority.HIGH, + priority=OnyxCeleryPriority.HIGH, ) # set a basic fence to start @@ -193,7 +193,7 @@ def try_creating_permissions_sync_task( @shared_task( - name=DanswerCeleryTask.CONNECTOR_PERMISSION_SYNC_GENERATOR_TASK, + name=OnyxCeleryTask.CONNECTOR_PERMISSION_SYNC_GENERATOR_TASK, acks_late=False, soft_time_limit=JOB_TIMEOUT, track_started=True, @@ -220,7 +220,7 @@ def connector_permission_sync_generator_task( r = get_redis_client(tenant_id=tenant_id) lock: RedisLock = r.lock( - DanswerRedisLocks.CONNECTOR_DOC_PERMISSIONS_SYNC_LOCK_PREFIX + OnyxRedisLocks.CONNECTOR_DOC_PERMISSIONS_SYNC_LOCK_PREFIX + f"_{redis_connector.id}", timeout=CELERY_PERMISSIONS_SYNC_LOCK_TIMEOUT, ) @@ -293,7 +293,7 @@ def connector_permission_sync_generator_task( @shared_task( - name=DanswerCeleryTask.UPDATE_EXTERNAL_DOCUMENT_PERMISSIONS_TASK, + name=OnyxCeleryTask.UPDATE_EXTERNAL_DOCUMENT_PERMISSIONS_TASK, soft_time_limit=LIGHT_SOFT_TIME_LIMIT, time_limit=LIGHT_TIME_LIMIT, max_retries=DOCUMENT_PERMISSIONS_UPDATE_MAX_RETRIES, diff --git a/backend/danswer/background/celery/tasks/external_group_syncing/tasks.py b/backend/onyx/background/celery/tasks/external_group_syncing/tasks.py similarity index 80% rename from backend/danswer/background/celery/tasks/external_group_syncing/tasks.py rename to backend/onyx/background/celery/tasks/external_group_syncing/tasks.py index c8ac5f870d3..204a3a63ce4 100644 --- a/backend/danswer/background/celery/tasks/external_group_syncing/tasks.py +++ b/backend/onyx/background/celery/tasks/external_group_syncing/tasks.py @@ -10,36 +10,36 @@ from redis import Redis from redis.lock import Lock as RedisLock -from danswer.background.celery.apps.app_base import task_logger -from danswer.configs.app_configs import JOB_TIMEOUT -from danswer.configs.constants import CELERY_EXTERNAL_GROUP_SYNC_LOCK_TIMEOUT -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DANSWER_REDIS_FUNCTION_LOCK_PREFIX -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.configs.constants import DanswerRedisLocks -from danswer.db.connector import mark_cc_pair_as_external_group_synced -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.engine import get_session_with_tenant -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.models import ConnectorCredentialPair -from danswer.redis.redis_connector import RedisConnector -from danswer.redis.redis_connector_ext_group_sync import ( - RedisConnectorExternalGroupSyncPayload, -) -from danswer.redis.redis_pool import get_redis_client -from danswer.utils.logger import setup_logger -from ee.danswer.db.connector_credential_pair import get_all_auto_sync_cc_pairs -from ee.danswer.db.connector_credential_pair import get_cc_pairs_by_source -from ee.danswer.db.external_perm import ExternalUserGroup -from ee.danswer.db.external_perm import replace_user__ext_group_for_cc_pair -from ee.danswer.external_permissions.sync_params import EXTERNAL_GROUP_SYNC_PERIODS -from ee.danswer.external_permissions.sync_params import GROUP_PERMISSIONS_FUNC_MAP -from ee.danswer.external_permissions.sync_params import ( +from ee.onyx.db.connector_credential_pair import get_all_auto_sync_cc_pairs +from ee.onyx.db.connector_credential_pair import get_cc_pairs_by_source +from ee.onyx.db.external_perm import ExternalUserGroup +from ee.onyx.db.external_perm import replace_user__ext_group_for_cc_pair +from ee.onyx.external_permissions.sync_params import EXTERNAL_GROUP_SYNC_PERIODS +from ee.onyx.external_permissions.sync_params import GROUP_PERMISSIONS_FUNC_MAP +from ee.onyx.external_permissions.sync_params import ( GROUP_PERMISSIONS_IS_CC_PAIR_AGNOSTIC, ) +from onyx.background.celery.apps.app_base import task_logger +from onyx.configs.app_configs import JOB_TIMEOUT +from onyx.configs.constants import CELERY_EXTERNAL_GROUP_SYNC_LOCK_TIMEOUT +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import DANSWER_REDIS_FUNCTION_LOCK_PREFIX +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.configs.constants import OnyxRedisLocks +from onyx.db.connector import mark_cc_pair_as_external_group_synced +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.engine import get_session_with_tenant +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.models import ConnectorCredentialPair +from onyx.redis.redis_connector import RedisConnector +from onyx.redis.redis_connector_ext_group_sync import ( + RedisConnectorExternalGroupSyncPayload, +) +from onyx.redis.redis_pool import get_redis_client +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -90,7 +90,7 @@ def _is_external_group_sync_due(cc_pair: ConnectorCredentialPair) -> bool: @shared_task( - name=DanswerCeleryTask.CHECK_FOR_EXTERNAL_GROUP_SYNC, + name=OnyxCeleryTask.CHECK_FOR_EXTERNAL_GROUP_SYNC, soft_time_limit=JOB_TIMEOUT, bind=True, ) @@ -98,7 +98,7 @@ def check_for_external_group_sync(self: Task, *, tenant_id: str | None) -> None: r = get_redis_client(tenant_id=tenant_id) lock_beat = r.lock( - DanswerRedisLocks.CHECK_CONNECTOR_EXTERNAL_GROUP_SYNC_BEAT_LOCK, + OnyxRedisLocks.CHECK_CONNECTOR_EXTERNAL_GROUP_SYNC_BEAT_LOCK, timeout=CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT, ) @@ -182,14 +182,14 @@ def try_creating_external_group_sync_task( custom_task_id = f"{redis_connector.external_group_sync.taskset_key}_{uuid4()}" result = app.send_task( - DanswerCeleryTask.CONNECTOR_EXTERNAL_GROUP_SYNC_GENERATOR_TASK, + OnyxCeleryTask.CONNECTOR_EXTERNAL_GROUP_SYNC_GENERATOR_TASK, kwargs=dict( cc_pair_id=cc_pair_id, tenant_id=tenant_id, ), - queue=DanswerCeleryQueues.CONNECTOR_EXTERNAL_GROUP_SYNC, + queue=OnyxCeleryQueues.CONNECTOR_EXTERNAL_GROUP_SYNC, task_id=custom_task_id, - priority=DanswerCeleryPriority.HIGH, + priority=OnyxCeleryPriority.HIGH, ) payload = RedisConnectorExternalGroupSyncPayload( @@ -212,7 +212,7 @@ def try_creating_external_group_sync_task( @shared_task( - name=DanswerCeleryTask.CONNECTOR_EXTERNAL_GROUP_SYNC_GENERATOR_TASK, + name=OnyxCeleryTask.CONNECTOR_EXTERNAL_GROUP_SYNC_GENERATOR_TASK, acks_late=False, soft_time_limit=JOB_TIMEOUT, track_started=True, @@ -234,7 +234,7 @@ def connector_external_group_sync_generator_task( r = get_redis_client(tenant_id=tenant_id) lock: RedisLock = r.lock( - DanswerRedisLocks.CONNECTOR_EXTERNAL_GROUP_SYNC_LOCK_PREFIX + OnyxRedisLocks.CONNECTOR_EXTERNAL_GROUP_SYNC_LOCK_PREFIX + f"_{redis_connector.id}", timeout=CELERY_EXTERNAL_GROUP_SYNC_LOCK_TIMEOUT, ) diff --git a/backend/danswer/background/celery/tasks/indexing/tasks.py b/backend/onyx/background/celery/tasks/indexing/tasks.py similarity index 91% rename from backend/danswer/background/celery/tasks/indexing/tasks.py rename to backend/onyx/background/celery/tasks/indexing/tasks.py index 22572c0fd8e..ad7ac2c9af6 100644 --- a/backend/danswer/background/celery/tasks/indexing/tasks.py +++ b/backend/onyx/background/celery/tasks/indexing/tasks.py @@ -14,49 +14,49 @@ from redis.lock import Lock as RedisLock from sqlalchemy.orm import Session -from danswer.background.celery.apps.app_base import task_logger -from danswer.background.indexing.job_client import SimpleJobClient -from danswer.background.indexing.run_indexing import run_indexing_entrypoint -from danswer.configs.app_configs import DISABLE_INDEX_UPDATE_ON_SWAP -from danswer.configs.constants import CELERY_INDEXING_LOCK_TIMEOUT -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DANSWER_REDIS_FUNCTION_LOCK_PREFIX -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.configs.constants import DanswerRedisLocks -from danswer.configs.constants import DocumentSource -from danswer.db.connector import mark_ccpair_with_indexing_trigger -from danswer.db.connector_credential_pair import fetch_connector_credential_pairs -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.engine import get_db_current_time -from danswer.db.engine import get_session_with_tenant -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.enums import IndexingMode -from danswer.db.enums import IndexingStatus -from danswer.db.enums import IndexModelStatus -from danswer.db.index_attempt import create_index_attempt -from danswer.db.index_attempt import delete_index_attempt -from danswer.db.index_attempt import get_all_index_attempts_by_status -from danswer.db.index_attempt import get_index_attempt -from danswer.db.index_attempt import get_last_attempt_for_cc_pair -from danswer.db.index_attempt import mark_attempt_canceled -from danswer.db.index_attempt import mark_attempt_failed -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import IndexAttempt -from danswer.db.models import SearchSettings -from danswer.db.search_settings import get_active_search_settings -from danswer.db.search_settings import get_current_search_settings -from danswer.db.swap_index import check_index_swap -from danswer.indexing.indexing_heartbeat import IndexingHeartbeatInterface -from danswer.natural_language_processing.search_nlp_models import EmbeddingModel -from danswer.natural_language_processing.search_nlp_models import warm_up_bi_encoder -from danswer.redis.redis_connector import RedisConnector -from danswer.redis.redis_connector_index import RedisConnectorIndex -from danswer.redis.redis_connector_index import RedisConnectorIndexPayload -from danswer.redis.redis_pool import get_redis_client -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import global_version +from onyx.background.celery.apps.app_base import task_logger +from onyx.background.indexing.job_client import SimpleJobClient +from onyx.background.indexing.run_indexing import run_indexing_entrypoint +from onyx.configs.app_configs import DISABLE_INDEX_UPDATE_ON_SWAP +from onyx.configs.constants import CELERY_INDEXING_LOCK_TIMEOUT +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import DANSWER_REDIS_FUNCTION_LOCK_PREFIX +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.configs.constants import OnyxRedisLocks +from onyx.db.connector import mark_ccpair_with_indexing_trigger +from onyx.db.connector_credential_pair import fetch_connector_credential_pairs +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.engine import get_db_current_time +from onyx.db.engine import get_session_with_tenant +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.enums import IndexingMode +from onyx.db.enums import IndexingStatus +from onyx.db.enums import IndexModelStatus +from onyx.db.index_attempt import create_index_attempt +from onyx.db.index_attempt import delete_index_attempt +from onyx.db.index_attempt import get_all_index_attempts_by_status +from onyx.db.index_attempt import get_index_attempt +from onyx.db.index_attempt import get_last_attempt_for_cc_pair +from onyx.db.index_attempt import mark_attempt_canceled +from onyx.db.index_attempt import mark_attempt_failed +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import IndexAttempt +from onyx.db.models import SearchSettings +from onyx.db.search_settings import get_active_search_settings +from onyx.db.search_settings import get_current_search_settings +from onyx.db.swap_index import check_index_swap +from onyx.indexing.indexing_heartbeat import IndexingHeartbeatInterface +from onyx.natural_language_processing.search_nlp_models import EmbeddingModel +from onyx.natural_language_processing.search_nlp_models import warm_up_bi_encoder +from onyx.redis.redis_connector import RedisConnector +from onyx.redis.redis_connector_index import RedisConnectorIndex +from onyx.redis.redis_connector_index import RedisConnectorIndexPayload +from onyx.redis.redis_pool import get_redis_client +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import global_version from shared_configs.configs import INDEXING_MODEL_SERVER_HOST from shared_configs.configs import INDEXING_MODEL_SERVER_PORT from shared_configs.configs import MULTI_TENANT @@ -157,7 +157,7 @@ def get_unfenced_index_attempt_ids(db_session: Session, r: redis.Redis) -> list[ @shared_task( - name=DanswerCeleryTask.CHECK_FOR_INDEXING, + name=OnyxCeleryTask.CHECK_FOR_INDEXING, soft_time_limit=300, bind=True, ) @@ -167,7 +167,7 @@ def check_for_indexing(self: Task, *, tenant_id: str | None) -> int | None: r = get_redis_client(tenant_id=tenant_id) lock_beat: RedisLock = r.lock( - DanswerRedisLocks.CHECK_INDEXING_BEAT_LOCK, + OnyxRedisLocks.CHECK_INDEXING_BEAT_LOCK, timeout=CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT, ) @@ -487,16 +487,16 @@ def try_creating_indexing_task( # when the task is sent, we have yet to finish setting up the fence # therefore, the task must contain code that blocks until the fence is ready result = celery_app.send_task( - DanswerCeleryTask.CONNECTOR_INDEXING_PROXY_TASK, + OnyxCeleryTask.CONNECTOR_INDEXING_PROXY_TASK, kwargs=dict( index_attempt_id=index_attempt_id, cc_pair_id=cc_pair.id, search_settings_id=search_settings.id, tenant_id=tenant_id, ), - queue=DanswerCeleryQueues.CONNECTOR_INDEXING, + queue=OnyxCeleryQueues.CONNECTOR_INDEXING, task_id=custom_task_id, - priority=DanswerCeleryPriority.MEDIUM, + priority=OnyxCeleryPriority.MEDIUM, ) if not result: raise RuntimeError("send_task for connector_indexing_proxy_task failed.") @@ -525,7 +525,7 @@ def try_creating_indexing_task( @shared_task( - name=DanswerCeleryTask.CONNECTOR_INDEXING_PROXY_TASK, + name=OnyxCeleryTask.CONNECTOR_INDEXING_PROXY_TASK, bind=True, acks_late=False, track_started=True, diff --git a/backend/danswer/background/celery/tasks/periodic/tasks.py b/backend/onyx/background/celery/tasks/periodic/tasks.py similarity index 92% rename from backend/danswer/background/celery/tasks/periodic/tasks.py rename to backend/onyx/background/celery/tasks/periodic/tasks.py index efef013f5e4..09b0a799d9f 100644 --- a/backend/danswer/background/celery/tasks/periodic/tasks.py +++ b/backend/onyx/background/celery/tasks/periodic/tasks.py @@ -11,15 +11,15 @@ from sqlalchemy import text from sqlalchemy.orm import Session -from danswer.background.celery.apps.app_base import task_logger -from danswer.configs.app_configs import JOB_TIMEOUT -from danswer.configs.constants import DanswerCeleryTask -from danswer.configs.constants import PostgresAdvisoryLocks -from danswer.db.engine import get_session_with_tenant +from onyx.background.celery.apps.app_base import task_logger +from onyx.configs.app_configs import JOB_TIMEOUT +from onyx.configs.constants import OnyxCeleryTask +from onyx.configs.constants import PostgresAdvisoryLocks +from onyx.db.engine import get_session_with_tenant @shared_task( - name=DanswerCeleryTask.KOMBU_MESSAGE_CLEANUP_TASK, + name=OnyxCeleryTask.KOMBU_MESSAGE_CLEANUP_TASK, soft_time_limit=JOB_TIMEOUT, bind=True, base=AbortableTask, diff --git a/backend/danswer/background/celery/tasks/pruning/tasks.py b/backend/onyx/background/celery/tasks/pruning/tasks.py similarity index 83% rename from backend/danswer/background/celery/tasks/pruning/tasks.py rename to backend/onyx/background/celery/tasks/pruning/tasks.py index 5497f1211a3..1d76ecc7e0e 100644 --- a/backend/danswer/background/celery/tasks/pruning/tasks.py +++ b/backend/onyx/background/celery/tasks/pruning/tasks.py @@ -11,31 +11,31 @@ from redis.lock import Lock as RedisLock from sqlalchemy.orm import Session -from danswer.background.celery.apps.app_base import task_logger -from danswer.background.celery.celery_utils import extract_ids_from_runnable_connector -from danswer.background.celery.tasks.indexing.tasks import IndexingCallback -from danswer.configs.app_configs import ALLOW_SIMULTANEOUS_PRUNING -from danswer.configs.app_configs import JOB_TIMEOUT -from danswer.configs.constants import CELERY_PRUNING_LOCK_TIMEOUT -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DANSWER_REDIS_FUNCTION_LOCK_PREFIX -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.configs.constants import DanswerRedisLocks -from danswer.connectors.factory import instantiate_connector -from danswer.connectors.models import InputType -from danswer.db.connector_credential_pair import get_connector_credential_pair -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.connector_credential_pair import get_connector_credential_pairs -from danswer.db.document import get_documents_for_connector_credential_pair -from danswer.db.engine import get_session_with_tenant -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.models import ConnectorCredentialPair -from danswer.redis.redis_connector import RedisConnector -from danswer.redis.redis_pool import get_redis_client -from danswer.utils.logger import pruning_ctx -from danswer.utils.logger import setup_logger +from onyx.background.celery.apps.app_base import task_logger +from onyx.background.celery.celery_utils import extract_ids_from_runnable_connector +from onyx.background.celery.tasks.indexing.tasks import IndexingCallback +from onyx.configs.app_configs import ALLOW_SIMULTANEOUS_PRUNING +from onyx.configs.app_configs import JOB_TIMEOUT +from onyx.configs.constants import CELERY_PRUNING_LOCK_TIMEOUT +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import DANSWER_REDIS_FUNCTION_LOCK_PREFIX +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.configs.constants import OnyxRedisLocks +from onyx.connectors.factory import instantiate_connector +from onyx.connectors.models import InputType +from onyx.db.connector_credential_pair import get_connector_credential_pair +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.connector_credential_pair import get_connector_credential_pairs +from onyx.db.document import get_documents_for_connector_credential_pair +from onyx.db.engine import get_session_with_tenant +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.models import ConnectorCredentialPair +from onyx.redis.redis_connector import RedisConnector +from onyx.redis.redis_pool import get_redis_client +from onyx.utils.logger import pruning_ctx +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -77,7 +77,7 @@ def _is_pruning_due(cc_pair: ConnectorCredentialPair) -> bool: @shared_task( - name=DanswerCeleryTask.CHECK_FOR_PRUNING, + name=OnyxCeleryTask.CHECK_FOR_PRUNING, soft_time_limit=JOB_TIMEOUT, bind=True, ) @@ -85,7 +85,7 @@ def check_for_pruning(self: Task, *, tenant_id: str | None) -> None: r = get_redis_client(tenant_id=tenant_id) lock_beat = r.lock( - DanswerRedisLocks.CHECK_PRUNE_BEAT_LOCK, + OnyxRedisLocks.CHECK_PRUNE_BEAT_LOCK, timeout=CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT, ) @@ -186,16 +186,16 @@ def try_creating_prune_generator_task( custom_task_id = f"{redis_connector.prune.generator_task_key}_{uuid4()}" celery_app.send_task( - DanswerCeleryTask.CONNECTOR_PRUNING_GENERATOR_TASK, + OnyxCeleryTask.CONNECTOR_PRUNING_GENERATOR_TASK, kwargs=dict( cc_pair_id=cc_pair.id, connector_id=cc_pair.connector_id, credential_id=cc_pair.credential_id, tenant_id=tenant_id, ), - queue=DanswerCeleryQueues.CONNECTOR_PRUNING, + queue=OnyxCeleryQueues.CONNECTOR_PRUNING, task_id=custom_task_id, - priority=DanswerCeleryPriority.LOW, + priority=OnyxCeleryPriority.LOW, ) # set this only after all tasks have been added @@ -211,7 +211,7 @@ def try_creating_prune_generator_task( @shared_task( - name=DanswerCeleryTask.CONNECTOR_PRUNING_GENERATOR_TASK, + name=OnyxCeleryTask.CONNECTOR_PRUNING_GENERATOR_TASK, acks_late=False, soft_time_limit=JOB_TIMEOUT, track_started=True, @@ -243,7 +243,7 @@ def connector_pruning_generator_task( # set thread_local=False since we don't control what thread the indexing/pruning # might run our callback with lock: RedisLock = r.lock( - DanswerRedisLocks.PRUNING_LOCK_PREFIX + f"_{redis_connector.id}", + OnyxRedisLocks.PRUNING_LOCK_PREFIX + f"_{redis_connector.id}", timeout=CELERY_PRUNING_LOCK_TIMEOUT, thread_local=False, ) diff --git a/backend/danswer/background/celery/tasks/shared/RetryDocumentIndex.py b/backend/onyx/background/celery/tasks/shared/RetryDocumentIndex.py similarity index 90% rename from backend/danswer/background/celery/tasks/shared/RetryDocumentIndex.py rename to backend/onyx/background/celery/tasks/shared/RetryDocumentIndex.py index bdaca0d811e..62a34196f60 100644 --- a/backend/danswer/background/celery/tasks/shared/RetryDocumentIndex.py +++ b/backend/onyx/background/celery/tasks/shared/RetryDocumentIndex.py @@ -4,8 +4,8 @@ from tenacity import stop_after_delay from tenacity import wait_random_exponential -from danswer.document_index.interfaces import DocumentIndex -from danswer.document_index.interfaces import VespaDocumentFields +from onyx.document_index.interfaces import DocumentIndex +from onyx.document_index.interfaces import VespaDocumentFields class RetryDocumentIndex: diff --git a/backend/danswer/background/celery/tasks/shared/tasks.py b/backend/onyx/background/celery/tasks/shared/tasks.py similarity index 86% rename from backend/danswer/background/celery/tasks/shared/tasks.py rename to backend/onyx/background/celery/tasks/shared/tasks.py index 2212046c3e9..2686689708d 100644 --- a/backend/danswer/background/celery/tasks/shared/tasks.py +++ b/backend/onyx/background/celery/tasks/shared/tasks.py @@ -6,22 +6,22 @@ from celery.exceptions import SoftTimeLimitExceeded from tenacity import RetryError -from danswer.access.access import get_access_for_document -from danswer.background.celery.apps.app_base import task_logger -from danswer.background.celery.tasks.shared.RetryDocumentIndex import RetryDocumentIndex -from danswer.configs.constants import DanswerCeleryTask -from danswer.db.document import delete_document_by_connector_credential_pair__no_commit -from danswer.db.document import delete_documents_complete__no_commit -from danswer.db.document import get_document -from danswer.db.document import get_document_connector_count -from danswer.db.document import mark_document_as_modified -from danswer.db.document import mark_document_as_synced -from danswer.db.document_set import fetch_document_sets_for_document -from danswer.db.engine import get_session_with_tenant -from danswer.document_index.document_index_utils import get_both_index_names -from danswer.document_index.factory import get_default_document_index -from danswer.document_index.interfaces import VespaDocumentFields -from danswer.server.documents.models import ConnectorCredentialPairIdentifier +from onyx.access.access import get_access_for_document +from onyx.background.celery.apps.app_base import task_logger +from onyx.background.celery.tasks.shared.RetryDocumentIndex import RetryDocumentIndex +from onyx.configs.constants import OnyxCeleryTask +from onyx.db.document import delete_document_by_connector_credential_pair__no_commit +from onyx.db.document import delete_documents_complete__no_commit +from onyx.db.document import get_document +from onyx.db.document import get_document_connector_count +from onyx.db.document import mark_document_as_modified +from onyx.db.document import mark_document_as_synced +from onyx.db.document_set import fetch_document_sets_for_document +from onyx.db.engine import get_session_with_tenant +from onyx.document_index.document_index_utils import get_both_index_names +from onyx.document_index.factory import get_default_document_index +from onyx.document_index.interfaces import VespaDocumentFields +from onyx.server.documents.models import ConnectorCredentialPairIdentifier DOCUMENT_BY_CC_PAIR_CLEANUP_MAX_RETRIES = 3 @@ -32,7 +32,7 @@ @shared_task( - name=DanswerCeleryTask.DOCUMENT_BY_CC_PAIR_CLEANUP_TASK, + name=OnyxCeleryTask.DOCUMENT_BY_CC_PAIR_CLEANUP_TASK, soft_time_limit=LIGHT_SOFT_TIME_LIMIT, time_limit=LIGHT_TIME_LIMIT, max_retries=DOCUMENT_BY_CC_PAIR_CLEANUP_MAX_RETRIES, diff --git a/backend/danswer/background/celery/tasks/vespa/tasks.py b/backend/onyx/background/celery/tasks/vespa/tasks.py similarity index 87% rename from backend/danswer/background/celery/tasks/vespa/tasks.py rename to backend/onyx/background/celery/tasks/vespa/tasks.py index be9e82f6365..05e74f7f06c 100644 --- a/backend/danswer/background/celery/tasks/vespa/tasks.py +++ b/backend/onyx/background/celery/tasks/vespa/tasks.py @@ -16,64 +16,64 @@ from sqlalchemy.orm import Session from tenacity import RetryError -from danswer.access.access import get_access_for_document -from danswer.background.celery.apps.app_base import task_logger -from danswer.background.celery.celery_redis import celery_get_queue_length -from danswer.background.celery.tasks.shared.RetryDocumentIndex import RetryDocumentIndex -from danswer.background.celery.tasks.shared.tasks import LIGHT_SOFT_TIME_LIMIT -from danswer.background.celery.tasks.shared.tasks import LIGHT_TIME_LIMIT -from danswer.configs.app_configs import JOB_TIMEOUT -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.configs.constants import DanswerRedisLocks -from danswer.db.connector import fetch_connector_by_id -from danswer.db.connector import mark_cc_pair_as_permissions_synced -from danswer.db.connector import mark_ccpair_as_pruned -from danswer.db.connector_credential_pair import add_deletion_failure_message -from danswer.db.connector_credential_pair import ( +from onyx.access.access import get_access_for_document +from onyx.background.celery.apps.app_base import task_logger +from onyx.background.celery.celery_redis import celery_get_queue_length +from onyx.background.celery.tasks.shared.RetryDocumentIndex import RetryDocumentIndex +from onyx.background.celery.tasks.shared.tasks import LIGHT_SOFT_TIME_LIMIT +from onyx.background.celery.tasks.shared.tasks import LIGHT_TIME_LIMIT +from onyx.configs.app_configs import JOB_TIMEOUT +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.configs.constants import OnyxRedisLocks +from onyx.db.connector import fetch_connector_by_id +from onyx.db.connector import mark_cc_pair_as_permissions_synced +from onyx.db.connector import mark_ccpair_as_pruned +from onyx.db.connector_credential_pair import add_deletion_failure_message +from onyx.db.connector_credential_pair import ( delete_connector_credential_pair__no_commit, ) -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.connector_credential_pair import get_connector_credential_pairs -from danswer.db.document import count_documents_by_needs_sync -from danswer.db.document import get_document -from danswer.db.document import get_document_ids_for_connector_credential_pair -from danswer.db.document import mark_document_as_synced -from danswer.db.document_set import delete_document_set -from danswer.db.document_set import delete_document_set_cc_pair_relationship__no_commit -from danswer.db.document_set import fetch_document_sets -from danswer.db.document_set import fetch_document_sets_for_document -from danswer.db.document_set import get_document_set_by_id -from danswer.db.document_set import mark_document_set_as_synced -from danswer.db.engine import get_session_with_tenant -from danswer.db.enums import IndexingStatus -from danswer.db.index_attempt import delete_index_attempts -from danswer.db.index_attempt import get_index_attempt -from danswer.db.index_attempt import mark_attempt_failed -from danswer.db.models import DocumentSet -from danswer.document_index.document_index_utils import get_both_index_names -from danswer.document_index.factory import get_default_document_index -from danswer.document_index.interfaces import VespaDocumentFields -from danswer.redis.redis_connector import RedisConnector -from danswer.redis.redis_connector_credential_pair import RedisConnectorCredentialPair -from danswer.redis.redis_connector_delete import RedisConnectorDelete -from danswer.redis.redis_connector_doc_perm_sync import RedisConnectorPermissionSync -from danswer.redis.redis_connector_doc_perm_sync import ( +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.connector_credential_pair import get_connector_credential_pairs +from onyx.db.document import count_documents_by_needs_sync +from onyx.db.document import get_document +from onyx.db.document import get_document_ids_for_connector_credential_pair +from onyx.db.document import mark_document_as_synced +from onyx.db.document_set import delete_document_set +from onyx.db.document_set import delete_document_set_cc_pair_relationship__no_commit +from onyx.db.document_set import fetch_document_sets +from onyx.db.document_set import fetch_document_sets_for_document +from onyx.db.document_set import get_document_set_by_id +from onyx.db.document_set import mark_document_set_as_synced +from onyx.db.engine import get_session_with_tenant +from onyx.db.enums import IndexingStatus +from onyx.db.index_attempt import delete_index_attempts +from onyx.db.index_attempt import get_index_attempt +from onyx.db.index_attempt import mark_attempt_failed +from onyx.db.models import DocumentSet +from onyx.document_index.document_index_utils import get_both_index_names +from onyx.document_index.factory import get_default_document_index +from onyx.document_index.interfaces import VespaDocumentFields +from onyx.redis.redis_connector import RedisConnector +from onyx.redis.redis_connector_credential_pair import RedisConnectorCredentialPair +from onyx.redis.redis_connector_delete import RedisConnectorDelete +from onyx.redis.redis_connector_doc_perm_sync import RedisConnectorPermissionSync +from onyx.redis.redis_connector_doc_perm_sync import ( RedisConnectorPermissionSyncPayload, ) -from danswer.redis.redis_connector_index import RedisConnectorIndex -from danswer.redis.redis_connector_prune import RedisConnectorPrune -from danswer.redis.redis_document_set import RedisDocumentSet -from danswer.redis.redis_pool import get_redis_client -from danswer.redis.redis_usergroup import RedisUserGroup -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_versioned_implementation -from danswer.utils.variable_functionality import ( +from onyx.redis.redis_connector_index import RedisConnectorIndex +from onyx.redis.redis_connector_prune import RedisConnectorPrune +from onyx.redis.redis_document_set import RedisDocumentSet +from onyx.redis.redis_pool import get_redis_client +from onyx.redis.redis_usergroup import RedisUserGroup +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_versioned_implementation +from onyx.utils.variable_functionality import ( fetch_versioned_implementation_with_fallback, ) -from danswer.utils.variable_functionality import global_version -from danswer.utils.variable_functionality import noop_fallback +from onyx.utils.variable_functionality import global_version +from onyx.utils.variable_functionality import noop_fallback logger = setup_logger() @@ -81,7 +81,7 @@ # celery auto associates tasks created inside another task, # which bloats the result metadata considerably. trail=False prevents this. @shared_task( - name=DanswerCeleryTask.CHECK_FOR_VESPA_SYNC_TASK, + name=OnyxCeleryTask.CHECK_FOR_VESPA_SYNC_TASK, soft_time_limit=JOB_TIMEOUT, trail=False, bind=True, @@ -93,7 +93,7 @@ def check_for_vespa_sync_task(self: Task, *, tenant_id: str | None) -> None: r = get_redis_client(tenant_id=tenant_id) lock_beat = r.lock( - DanswerRedisLocks.CHECK_VESPA_SYNC_BEAT_LOCK, + OnyxRedisLocks.CHECK_VESPA_SYNC_BEAT_LOCK, timeout=CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT, ) @@ -129,7 +129,7 @@ def check_for_vespa_sync_task(self: Task, *, tenant_id: str | None) -> None: if global_version.is_ee_version(): try: fetch_user_groups = fetch_versioned_implementation( - "danswer.db.user_group", "fetch_user_groups" + "onyx.db.user_group", "fetch_user_groups" ) except ModuleNotFoundError: # Always exceptions on the MIT version, which is expected @@ -292,7 +292,7 @@ def try_generate_user_group_sync_tasks( # race condition with the monitor/cleanup function if we use a cached result! fetch_user_group = fetch_versioned_implementation( - "danswer.db.user_group", "fetch_user_group" + "onyx.db.user_group", "fetch_user_group" ) usergroup = fetch_user_group(db_session, usergroup_id) @@ -476,7 +476,7 @@ def monitor_connector_deletion_taskset( # user groups cleanup_user_groups = fetch_versioned_implementation_with_fallback( - "danswer.db.user_group", + "onyx.db.user_group", "delete_user_group_cc_pair_relationship__no_commit", noop_fallback, ) @@ -719,7 +719,7 @@ def monitor_ccpair_indexing_taskset( redis_connector_index.reset() -@shared_task(name=DanswerCeleryTask.MONITOR_VESPA_SYNC, soft_time_limit=300, bind=True) +@shared_task(name=OnyxCeleryTask.MONITOR_VESPA_SYNC, soft_time_limit=300, bind=True) def monitor_vespa_sync(self: Task, tenant_id: str | None) -> bool: """This is a celery beat task that monitors and finalizes metadata sync tasksets. It scans for fence values and then gets the counts of any associated tasksets. @@ -733,7 +733,7 @@ def monitor_vespa_sync(self: Task, tenant_id: str | None) -> bool: r = get_redis_client(tenant_id=tenant_id) lock_beat: RedisLock = r.lock( - DanswerRedisLocks.MONITOR_VESPA_SYNC_BEAT_LOCK, + OnyxRedisLocks.MONITOR_VESPA_SYNC_BEAT_LOCK, timeout=CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT, ) @@ -746,19 +746,17 @@ def monitor_vespa_sync(self: Task, tenant_id: str | None) -> bool: r_celery = self.app.broker_connection().channel().client # type: ignore n_celery = celery_get_queue_length("celery", r_celery) n_indexing = celery_get_queue_length( - DanswerCeleryQueues.CONNECTOR_INDEXING, r_celery - ) - n_sync = celery_get_queue_length( - DanswerCeleryQueues.VESPA_METADATA_SYNC, r_celery + OnyxCeleryQueues.CONNECTOR_INDEXING, r_celery ) + n_sync = celery_get_queue_length(OnyxCeleryQueues.VESPA_METADATA_SYNC, r_celery) n_deletion = celery_get_queue_length( - DanswerCeleryQueues.CONNECTOR_DELETION, r_celery + OnyxCeleryQueues.CONNECTOR_DELETION, r_celery ) n_pruning = celery_get_queue_length( - DanswerCeleryQueues.CONNECTOR_PRUNING, r_celery + OnyxCeleryQueues.CONNECTOR_PRUNING, r_celery ) n_permissions_sync = celery_get_queue_length( - DanswerCeleryQueues.CONNECTOR_DOC_PERMISSIONS_SYNC, r_celery + OnyxCeleryQueues.CONNECTOR_DOC_PERMISSIONS_SYNC, r_celery ) task_logger.info( @@ -789,7 +787,7 @@ def monitor_vespa_sync(self: Task, tenant_id: str | None) -> bool: for key_bytes in r.scan_iter(RedisUserGroup.FENCE_PREFIX + "*"): lock_beat.reacquire() monitor_usergroup_taskset = fetch_versioned_implementation_with_fallback( - "danswer.background.celery.tasks.vespa.tasks", + "onyx.background.celery.tasks.vespa.tasks", "monitor_usergroup_taskset", noop_fallback, ) @@ -816,8 +814,8 @@ def monitor_vespa_sync(self: Task, tenant_id: str | None) -> bool: # uncomment for debugging if needed # r_celery = celery_app.broker_connection().channel().client - # length = celery_get_queue_length(DanswerCeleryQueues.VESPA_METADATA_SYNC, r_celery) - # task_logger.warning(f"queue={DanswerCeleryQueues.VESPA_METADATA_SYNC} length={length}") + # length = celery_get_queue_length(OnyxCeleryQueues.VESPA_METADATA_SYNC, r_celery) + # task_logger.warning(f"queue={OnyxCeleryQueues.VESPA_METADATA_SYNC} length={length}") except SoftTimeLimitExceeded: task_logger.info( "Soft time limit exceeded, task is being terminated gracefully." @@ -830,7 +828,7 @@ def monitor_vespa_sync(self: Task, tenant_id: str | None) -> bool: @shared_task( - name=DanswerCeleryTask.VESPA_METADATA_SYNC_TASK, + name=OnyxCeleryTask.VESPA_METADATA_SYNC_TASK, bind=True, soft_time_limit=LIGHT_SOFT_TIME_LIMIT, time_limit=LIGHT_TIME_LIMIT, diff --git a/backend/danswer/background/celery/versioned_apps/beat.py b/backend/onyx/background/celery/versioned_apps/beat.py similarity index 51% rename from backend/danswer/background/celery/versioned_apps/beat.py rename to backend/onyx/background/celery/versioned_apps/beat.py index 64bc1112ed3..2cae923a78a 100644 --- a/backend/danswer/background/celery/versioned_apps/beat.py +++ b/backend/onyx/background/celery/versioned_apps/beat.py @@ -1,8 +1,8 @@ """Factory stub for running celery worker / celery beat.""" from celery import Celery -from danswer.background.celery.apps.beat import celery_app -from danswer.utils.variable_functionality import set_is_ee_based_on_env_variable +from onyx.background.celery.apps.beat import celery_app +from onyx.utils.variable_functionality import set_is_ee_based_on_env_variable set_is_ee_based_on_env_variable() app: Celery = celery_app diff --git a/backend/danswer/background/celery/versioned_apps/heavy.py b/backend/onyx/background/celery/versioned_apps/heavy.py similarity index 71% rename from backend/danswer/background/celery/versioned_apps/heavy.py rename to backend/onyx/background/celery/versioned_apps/heavy.py index c2b58a53bfc..a4cf0363ef9 100644 --- a/backend/danswer/background/celery/versioned_apps/heavy.py +++ b/backend/onyx/background/celery/versioned_apps/heavy.py @@ -3,13 +3,13 @@ fetch. Port over the code in those files if we add an EE version of this worker.""" from celery import Celery -from danswer.utils.variable_functionality import set_is_ee_based_on_env_variable +from onyx.utils.variable_functionality import set_is_ee_based_on_env_variable set_is_ee_based_on_env_variable() def get_app() -> Celery: - from danswer.background.celery.apps.heavy import celery_app + from onyx.background.celery.apps.heavy import celery_app return celery_app diff --git a/backend/danswer/background/celery/versioned_apps/indexing.py b/backend/onyx/background/celery/versioned_apps/indexing.py similarity index 70% rename from backend/danswer/background/celery/versioned_apps/indexing.py rename to backend/onyx/background/celery/versioned_apps/indexing.py index ed26fc548bc..fe1bdb2d788 100644 --- a/backend/danswer/background/celery/versioned_apps/indexing.py +++ b/backend/onyx/background/celery/versioned_apps/indexing.py @@ -3,13 +3,13 @@ fetch. Port over the code in those files if we add an EE version of this worker.""" from celery import Celery -from danswer.utils.variable_functionality import set_is_ee_based_on_env_variable +from onyx.utils.variable_functionality import set_is_ee_based_on_env_variable set_is_ee_based_on_env_variable() def get_app() -> Celery: - from danswer.background.celery.apps.indexing import celery_app + from onyx.background.celery.apps.indexing import celery_app return celery_app diff --git a/backend/danswer/background/celery/versioned_apps/light.py b/backend/onyx/background/celery/versioned_apps/light.py similarity index 71% rename from backend/danswer/background/celery/versioned_apps/light.py rename to backend/onyx/background/celery/versioned_apps/light.py index 3d229431ce5..890de25d45b 100644 --- a/backend/danswer/background/celery/versioned_apps/light.py +++ b/backend/onyx/background/celery/versioned_apps/light.py @@ -3,13 +3,13 @@ fetch. Port over the code in those files if we add an EE version of this worker.""" from celery import Celery -from danswer.utils.variable_functionality import set_is_ee_based_on_env_variable +from onyx.utils.variable_functionality import set_is_ee_based_on_env_variable set_is_ee_based_on_env_variable() def get_app() -> Celery: - from danswer.background.celery.apps.light import celery_app + from onyx.background.celery.apps.light import celery_app return celery_app diff --git a/backend/onyx/background/celery/versioned_apps/primary.py b/backend/onyx/background/celery/versioned_apps/primary.py new file mode 100644 index 00000000000..b6949c06ba5 --- /dev/null +++ b/backend/onyx/background/celery/versioned_apps/primary.py @@ -0,0 +1,10 @@ +"""Factory stub for running celery worker / celery beat.""" +from celery import Celery + +from onyx.utils.variable_functionality import fetch_versioned_implementation +from onyx.utils.variable_functionality import set_is_ee_based_on_env_variable + +set_is_ee_based_on_env_variable() +app: Celery = fetch_versioned_implementation( + "onyx.background.celery.apps.primary", "celery_app" +) diff --git a/backend/danswer/background/indexing/checkpointing.py b/backend/onyx/background/indexing/checkpointing.py similarity index 93% rename from backend/danswer/background/indexing/checkpointing.py rename to backend/onyx/background/indexing/checkpointing.py index ec3ce5c8ffa..a7376aab01b 100644 --- a/backend/danswer/background/indexing/checkpointing.py +++ b/backend/onyx/background/indexing/checkpointing.py @@ -3,9 +3,9 @@ / jobs being killed by cloud providers.""" import datetime -from danswer.configs.app_configs import EXPERIMENTAL_CHECKPOINTING_ENABLED -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import datetime_to_utc +from onyx.configs.app_configs import EXPERIMENTAL_CHECKPOINTING_ENABLED +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import datetime_to_utc def _2010_dt() -> datetime.datetime: diff --git a/backend/danswer/background/indexing/dask_utils.py b/backend/onyx/background/indexing/dask_utils.py similarity index 96% rename from backend/danswer/background/indexing/dask_utils.py rename to backend/onyx/background/indexing/dask_utils.py index 84335041dc4..1f1ccb566c6 100644 --- a/backend/danswer/background/indexing/dask_utils.py +++ b/backend/onyx/background/indexing/dask_utils.py @@ -4,7 +4,7 @@ from dask.distributed import WorkerPlugin from distributed import Worker -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/background/indexing/job_client.py b/backend/onyx/background/indexing/job_client.py similarity index 96% rename from backend/danswer/background/indexing/job_client.py rename to backend/onyx/background/indexing/job_client.py index a31b7b3119e..444894f8d6e 100644 --- a/backend/danswer/background/indexing/job_client.py +++ b/backend/onyx/background/indexing/job_client.py @@ -11,9 +11,9 @@ from typing import Literal from typing import Optional -from danswer.configs.constants import POSTGRES_CELERY_WORKER_INDEXING_CHILD_APP_NAME -from danswer.db.engine import SqlEngine -from danswer.utils.logger import setup_logger +from onyx.configs.constants import POSTGRES_CELERY_WORKER_INDEXING_CHILD_APP_NAME +from onyx.db.engine import SqlEngine +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/background/indexing/run_indexing.py b/backend/onyx/background/indexing/run_indexing.py similarity index 90% rename from backend/danswer/background/indexing/run_indexing.py rename to backend/onyx/background/indexing/run_indexing.py index 40ed778f033..942a06f8ea5 100644 --- a/backend/danswer/background/indexing/run_indexing.py +++ b/backend/onyx/background/indexing/run_indexing.py @@ -6,35 +6,35 @@ from sqlalchemy.orm import Session -from danswer.background.indexing.checkpointing import get_time_windows_for_index_attempt -from danswer.background.indexing.tracer import DanswerTracer -from danswer.configs.app_configs import INDEXING_SIZE_WARNING_THRESHOLD -from danswer.configs.app_configs import INDEXING_TRACER_INTERVAL -from danswer.configs.app_configs import POLL_CONNECTOR_OFFSET -from danswer.connectors.connector_runner import ConnectorRunner -from danswer.connectors.factory import instantiate_connector -from danswer.connectors.models import IndexAttemptMetadata -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.connector_credential_pair import get_last_successful_attempt_time -from danswer.db.connector_credential_pair import update_connector_credential_pair -from danswer.db.engine import get_session_with_tenant -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.index_attempt import mark_attempt_canceled -from danswer.db.index_attempt import mark_attempt_failed -from danswer.db.index_attempt import mark_attempt_partially_succeeded -from danswer.db.index_attempt import mark_attempt_succeeded -from danswer.db.index_attempt import transition_attempt_to_in_progress -from danswer.db.index_attempt import update_docs_indexed -from danswer.db.models import IndexAttempt -from danswer.db.models import IndexingStatus -from danswer.db.models import IndexModelStatus -from danswer.document_index.factory import get_default_document_index -from danswer.indexing.embedder import DefaultIndexingEmbedder -from danswer.indexing.indexing_heartbeat import IndexingHeartbeatInterface -from danswer.indexing.indexing_pipeline import build_indexing_pipeline -from danswer.utils.logger import setup_logger -from danswer.utils.logger import TaskAttemptSingleton -from danswer.utils.variable_functionality import global_version +from onyx.background.indexing.checkpointing import get_time_windows_for_index_attempt +from onyx.background.indexing.tracer import OnyxTracer +from onyx.configs.app_configs import INDEXING_SIZE_WARNING_THRESHOLD +from onyx.configs.app_configs import INDEXING_TRACER_INTERVAL +from onyx.configs.app_configs import POLL_CONNECTOR_OFFSET +from onyx.connectors.connector_runner import ConnectorRunner +from onyx.connectors.factory import instantiate_connector +from onyx.connectors.models import IndexAttemptMetadata +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.connector_credential_pair import get_last_successful_attempt_time +from onyx.db.connector_credential_pair import update_connector_credential_pair +from onyx.db.engine import get_session_with_tenant +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.index_attempt import mark_attempt_canceled +from onyx.db.index_attempt import mark_attempt_failed +from onyx.db.index_attempt import mark_attempt_partially_succeeded +from onyx.db.index_attempt import mark_attempt_succeeded +from onyx.db.index_attempt import transition_attempt_to_in_progress +from onyx.db.index_attempt import update_docs_indexed +from onyx.db.models import IndexAttempt +from onyx.db.models import IndexingStatus +from onyx.db.models import IndexModelStatus +from onyx.document_index.factory import get_default_document_index +from onyx.indexing.embedder import DefaultIndexingEmbedder +from onyx.indexing.indexing_heartbeat import IndexingHeartbeatInterface +from onyx.indexing.indexing_pipeline import build_indexing_pipeline +from onyx.utils.logger import setup_logger +from onyx.utils.logger import TaskAttemptSingleton +from onyx.utils.variable_functionality import global_version logger = setup_logger() @@ -165,7 +165,7 @@ def _run_indexing( if INDEXING_TRACER_INTERVAL > 0: logger.debug(f"Memory tracer starting: interval={INDEXING_TRACER_INTERVAL}") - tracer = DanswerTracer() + tracer = OnyxTracer() tracer.start() tracer.snap() diff --git a/backend/danswer/background/indexing/tracer.py b/backend/onyx/background/indexing/tracer.py similarity index 90% rename from backend/danswer/background/indexing/tracer.py rename to backend/onyx/background/indexing/tracer.py index baad9623087..0068d4e0213 100644 --- a/backend/danswer/background/indexing/tracer.py +++ b/backend/onyx/background/indexing/tracer.py @@ -1,13 +1,13 @@ import tracemalloc -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() DANSWER_TRACEMALLOC_FRAMES = 10 -class DanswerTracer: +class OnyxTracer: def __init__(self) -> None: self.snapshot_first: tracemalloc.Snapshot | None = None self.snapshot_prev: tracemalloc.Snapshot | None = None @@ -68,10 +68,10 @@ def log_previous_diff(self, numEntries: int) -> None: if not self.snapshot or not self.snapshot_prev: return - DanswerTracer.log_diff(self.snapshot, self.snapshot_prev, numEntries) + OnyxTracer.log_diff(self.snapshot, self.snapshot_prev, numEntries) def log_first_diff(self, numEntries: int) -> None: if not self.snapshot or not self.snapshot_first: return - DanswerTracer.log_diff(self.snapshot, self.snapshot_first, numEntries) + OnyxTracer.log_diff(self.snapshot, self.snapshot_first, numEntries) diff --git a/backend/danswer/background/task_utils.py b/backend/onyx/background/task_utils.py similarity index 95% rename from backend/danswer/background/task_utils.py rename to backend/onyx/background/task_utils.py index f4562892460..90d3efffbf4 100644 --- a/backend/danswer/background/task_utils.py +++ b/backend/onyx/background/task_utils.py @@ -8,10 +8,10 @@ from celery.result import AsyncResult from sqlalchemy.orm import Session -from danswer.db.engine import get_sqlalchemy_engine -from danswer.db.tasks import mark_task_finished -from danswer.db.tasks import mark_task_start -from danswer.db.tasks import register_task +from onyx.db.engine import get_sqlalchemy_engine +from onyx.db.tasks import mark_task_finished +from onyx.db.tasks import mark_task_start +from onyx.db.tasks import register_task T = TypeVar("T", bound=Callable) diff --git a/backend/danswer/connectors/document360/__init__.py b/backend/onyx/chat/__init__.py similarity index 100% rename from backend/danswer/connectors/document360/__init__.py rename to backend/onyx/chat/__init__.py diff --git a/backend/danswer/chat/answer.py b/backend/onyx/chat/answer.py similarity index 87% rename from backend/danswer/chat/answer.py rename to backend/onyx/chat/answer.py index 578529364cd..51836c228d1 100644 --- a/backend/danswer/chat/answer.py +++ b/backend/onyx/chat/answer.py @@ -6,35 +6,35 @@ from langchain_core.messages import AIMessageChunk from langchain_core.messages import ToolCall -from danswer.chat.llm_response_handler import LLMResponseHandlerManager -from danswer.chat.models import AnswerQuestionPossibleReturn -from danswer.chat.models import AnswerStyleConfig -from danswer.chat.models import CitationInfo -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import PromptConfig -from danswer.chat.prompt_builder.build import AnswerPromptBuilder -from danswer.chat.prompt_builder.build import default_build_system_message -from danswer.chat.prompt_builder.build import default_build_user_message -from danswer.chat.prompt_builder.build import LLMCall -from danswer.chat.stream_processing.answer_response_handler import ( +from onyx.chat.llm_response_handler import LLMResponseHandlerManager +from onyx.chat.models import AnswerQuestionPossibleReturn +from onyx.chat.models import AnswerStyleConfig +from onyx.chat.models import CitationInfo +from onyx.chat.models import OnyxAnswerPiece +from onyx.chat.models import PromptConfig +from onyx.chat.prompt_builder.build import AnswerPromptBuilder +from onyx.chat.prompt_builder.build import default_build_system_message +from onyx.chat.prompt_builder.build import default_build_user_message +from onyx.chat.prompt_builder.build import LLMCall +from onyx.chat.stream_processing.answer_response_handler import ( CitationResponseHandler, ) -from danswer.chat.stream_processing.answer_response_handler import ( +from onyx.chat.stream_processing.answer_response_handler import ( DummyAnswerResponseHandler, ) -from danswer.chat.stream_processing.utils import map_document_id_order -from danswer.chat.tool_handling.tool_response_handler import ToolResponseHandler -from danswer.file_store.utils import InMemoryChatFile -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.tools.force import ForceUseTool -from danswer.tools.models import ToolResponse -from danswer.tools.tool import Tool -from danswer.tools.tool_implementations.search.search_tool import SearchTool -from danswer.tools.tool_runner import ToolCallKickoff -from danswer.tools.utils import explicit_tool_calling_supported -from danswer.utils.logger import setup_logger +from onyx.chat.stream_processing.utils import map_document_id_order +from onyx.chat.tool_handling.tool_response_handler import ToolResponseHandler +from onyx.file_store.utils import InMemoryChatFile +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.tools.force import ForceUseTool +from onyx.tools.models import ToolResponse +from onyx.tools.tool import Tool +from onyx.tools.tool_implementations.search.search_tool import SearchTool +from onyx.tools.tool_runner import ToolCallKickoff +from onyx.tools.utils import explicit_tool_calling_supported +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -292,7 +292,7 @@ def processed_streamed_output(self) -> AnswerStream: def llm_answer(self) -> str: answer = "" for packet in self.processed_streamed_output: - if isinstance(packet, DanswerAnswerPiece) and packet.answer_piece: + if isinstance(packet, OnyxAnswerPiece) and packet.answer_piece: answer += packet.answer_piece return answer diff --git a/backend/danswer/chat/chat_utils.py b/backend/onyx/chat/chat_utils.py similarity index 90% rename from backend/danswer/chat/chat_utils.py rename to backend/onyx/chat/chat_utils.py index eb63c68754d..70083a0da24 100644 --- a/backend/danswer/chat/chat_utils.py +++ b/backend/onyx/chat/chat_utils.py @@ -6,33 +6,33 @@ from fastapi.datastructures import Headers from sqlalchemy.orm import Session -from danswer.auth.users import is_user_admin -from danswer.chat.models import CitationInfo -from danswer.chat.models import LlmDoc -from danswer.chat.models import PersonaOverrideConfig -from danswer.chat.models import ThreadMessage -from danswer.configs.constants import DEFAULT_PERSONA_ID -from danswer.configs.constants import MessageType -from danswer.context.search.models import InferenceSection -from danswer.context.search.models import RerankingDetails -from danswer.context.search.models import RetrievalDetails -from danswer.db.chat import create_chat_session -from danswer.db.chat import get_chat_messages_by_session -from danswer.db.llm import fetch_existing_doc_sets -from danswer.db.llm import fetch_existing_tools -from danswer.db.models import ChatMessage -from danswer.db.models import Persona -from danswer.db.models import Prompt -from danswer.db.models import Tool -from danswer.db.models import User -from danswer.db.persona import get_prompts_by_ids -from danswer.llm.models import PreviousMessage -from danswer.natural_language_processing.utils import BaseTokenizer -from danswer.server.query_and_chat.models import CreateChatMessageRequest -from danswer.tools.tool_implementations.custom.custom_tool import ( +from onyx.auth.users import is_user_admin +from onyx.chat.models import CitationInfo +from onyx.chat.models import LlmDoc +from onyx.chat.models import PersonaOverrideConfig +from onyx.chat.models import ThreadMessage +from onyx.configs.constants import DEFAULT_PERSONA_ID +from onyx.configs.constants import MessageType +from onyx.context.search.models import InferenceSection +from onyx.context.search.models import RerankingDetails +from onyx.context.search.models import RetrievalDetails +from onyx.db.chat import create_chat_session +from onyx.db.chat import get_chat_messages_by_session +from onyx.db.llm import fetch_existing_doc_sets +from onyx.db.llm import fetch_existing_tools +from onyx.db.models import ChatMessage +from onyx.db.models import Persona +from onyx.db.models import Prompt +from onyx.db.models import Tool +from onyx.db.models import User +from onyx.db.persona import get_prompts_by_ids +from onyx.llm.models import PreviousMessage +from onyx.natural_language_processing.utils import BaseTokenizer +from onyx.server.query_and_chat.models import CreateChatMessageRequest +from onyx.tools.tool_implementations.custom.custom_tool import ( build_custom_tools_from_openapi_schema_and_headers, ) -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -56,7 +56,7 @@ def prepare_chat_message_request( user_id=user.id if user else None, # If using an override, this id will be ignored later on persona_id=persona_id or DEFAULT_PERSONA_ID, - danswerbot_flow=True, + onyxbot_flow=True, slack_thread_id=message_ts_to_respond_to, ) diff --git a/backend/danswer/chat/llm_response_handler.py b/backend/onyx/chat/llm_response_handler.py similarity index 80% rename from backend/danswer/chat/llm_response_handler.py rename to backend/onyx/chat/llm_response_handler.py index ee3d3f930bb..612ce5dd566 100644 --- a/backend/danswer/chat/llm_response_handler.py +++ b/backend/onyx/chat/llm_response_handler.py @@ -4,12 +4,12 @@ from langchain_core.messages import BaseMessage -from danswer.chat.models import ResponsePart -from danswer.chat.models import StreamStopInfo -from danswer.chat.models import StreamStopReason -from danswer.chat.prompt_builder.build import LLMCall -from danswer.chat.stream_processing.answer_response_handler import AnswerResponseHandler -from danswer.chat.tool_handling.tool_response_handler import ToolResponseHandler +from onyx.chat.models import ResponsePart +from onyx.chat.models import StreamStopInfo +from onyx.chat.models import StreamStopReason +from onyx.chat.prompt_builder.build import LLMCall +from onyx.chat.stream_processing.answer_response_handler import AnswerResponseHandler +from onyx.chat.tool_handling.tool_response_handler import ToolResponseHandler class LLMResponseHandlerManager: diff --git a/backend/danswer/chat/models.py b/backend/onyx/chat/models.py similarity index 90% rename from backend/danswer/chat/models.py rename to backend/onyx/chat/models.py index 213a5ed74a5..44973446f5b 100644 --- a/backend/danswer/chat/models.py +++ b/backend/onyx/chat/models.py @@ -10,20 +10,20 @@ from pydantic import Field from pydantic import model_validator -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import MessageType -from danswer.context.search.enums import QueryFlow -from danswer.context.search.enums import RecencyBiasSetting -from danswer.context.search.enums import SearchType -from danswer.context.search.models import RetrievalDocs -from danswer.llm.override_models import PromptOverride -from danswer.tools.models import ToolCallFinalResult -from danswer.tools.models import ToolCallKickoff -from danswer.tools.models import ToolResponse -from danswer.tools.tool_implementations.custom.base_tool_types import ToolResultType +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import MessageType +from onyx.context.search.enums import QueryFlow +from onyx.context.search.enums import RecencyBiasSetting +from onyx.context.search.enums import SearchType +from onyx.context.search.models import RetrievalDocs +from onyx.llm.override_models import PromptOverride +from onyx.tools.models import ToolCallFinalResult +from onyx.tools.models import ToolCallKickoff +from onyx.tools.models import ToolResponse +from onyx.tools.tool_implementations.custom.base_tool_types import ToolResultType if TYPE_CHECKING: - from danswer.db.models import Prompt + from onyx.db.models import Prompt class LlmDoc(BaseModel): @@ -99,7 +99,7 @@ class DocumentRelevance(BaseModel): relevance_summaries: dict[str, RelevanceAnalysis] -class DanswerAnswerPiece(BaseModel): +class OnyxAnswerPiece(BaseModel): # A small piece of a complete answer. Used for streaming back answers. answer_piece: str | None # if None, specifies the end of an Answer @@ -131,18 +131,18 @@ class StreamingError(BaseModel): stack_trace: str | None = None -class DanswerContext(BaseModel): +class OnyxContext(BaseModel): content: str document_id: str semantic_identifier: str blurb: str -class DanswerContexts(BaseModel): - contexts: list[DanswerContext] +class OnyxContexts(BaseModel): + contexts: list[OnyxContext] -class DanswerAnswer(BaseModel): +class OnyxAnswer(BaseModel): answer: str | None @@ -152,7 +152,7 @@ class ThreadMessage(BaseModel): role: MessageType = MessageType.USER -class ChatDanswerBotResponse(BaseModel): +class ChatOnyxBotResponse(BaseModel): answer: str | None = None citations: list[CitationInfo] | None = None docs: QADocsResponse | None = None @@ -205,9 +205,9 @@ class PersonaOverrideConfig(BaseModel): AnswerQuestionPossibleReturn = ( - DanswerAnswerPiece + OnyxAnswerPiece | CitationInfo - | DanswerContexts + | OnyxContexts | FileChatDisplay | CustomToolResponse | StreamingError @@ -320,7 +320,7 @@ def from_model( ResponsePart = ( - DanswerAnswerPiece + OnyxAnswerPiece | CitationInfo | ToolCallKickoff | ToolResponse diff --git a/backend/danswer/chat/process_message.py b/backend/onyx/chat/process_message.py similarity index 85% rename from backend/danswer/chat/process_message.py rename to backend/onyx/chat/process_message.py index e7eab659830..87dbb500e84 100644 --- a/backend/danswer/chat/process_message.py +++ b/backend/onyx/chat/process_message.py @@ -6,119 +6,119 @@ from sqlalchemy.orm import Session -from danswer.chat.answer import Answer -from danswer.chat.chat_utils import create_chat_chain -from danswer.chat.chat_utils import create_temporary_persona -from danswer.chat.models import AllCitations -from danswer.chat.models import AnswerStyleConfig -from danswer.chat.models import ChatDanswerBotResponse -from danswer.chat.models import CitationConfig -from danswer.chat.models import CitationInfo -from danswer.chat.models import CustomToolResponse -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import DanswerContexts -from danswer.chat.models import DocumentPruningConfig -from danswer.chat.models import FileChatDisplay -from danswer.chat.models import FinalUsedContextDocsResponse -from danswer.chat.models import LLMRelevanceFilterResponse -from danswer.chat.models import MessageResponseIDInfo -from danswer.chat.models import MessageSpecificCitations -from danswer.chat.models import PromptConfig -from danswer.chat.models import QADocsResponse -from danswer.chat.models import StreamingError -from danswer.chat.models import StreamStopInfo -from danswer.configs.chat_configs import CHAT_TARGET_CHUNK_PERCENTAGE -from danswer.configs.chat_configs import DISABLE_LLM_CHOOSE_SEARCH -from danswer.configs.chat_configs import MAX_CHUNKS_FED_TO_CHAT -from danswer.configs.constants import MessageType -from danswer.context.search.enums import OptionalSearchSetting -from danswer.context.search.enums import QueryFlow -from danswer.context.search.enums import SearchType -from danswer.context.search.models import InferenceSection -from danswer.context.search.models import RetrievalDetails -from danswer.context.search.retrieval.search_runner import inference_sections_from_ids -from danswer.context.search.utils import chunks_or_sections_to_search_docs -from danswer.context.search.utils import dedupe_documents -from danswer.context.search.utils import drop_llm_indices -from danswer.context.search.utils import relevant_sections_to_indices -from danswer.db.chat import attach_files_to_chat_message -from danswer.db.chat import create_db_search_doc -from danswer.db.chat import create_new_chat_message -from danswer.db.chat import get_chat_message -from danswer.db.chat import get_chat_session_by_id -from danswer.db.chat import get_db_search_doc_by_id -from danswer.db.chat import get_doc_query_identifiers_from_model -from danswer.db.chat import get_or_create_root_message -from danswer.db.chat import reserve_message_id -from danswer.db.chat import translate_db_message_to_chat_message_detail -from danswer.db.chat import translate_db_search_doc_to_server_search_doc -from danswer.db.engine import get_session_context_manager -from danswer.db.models import SearchDoc as DbSearchDoc -from danswer.db.models import ToolCall -from danswer.db.models import User -from danswer.db.persona import get_persona_by_id -from danswer.db.search_settings import get_current_search_settings -from danswer.document_index.factory import get_default_document_index -from danswer.file_store.models import ChatFileType -from danswer.file_store.models import FileDescriptor -from danswer.file_store.utils import load_all_chat_files -from danswer.file_store.utils import save_files -from danswer.llm.exceptions import GenAIDisabledException -from danswer.llm.factory import get_llms_for_persona -from danswer.llm.factory import get_main_llm_from_tuple -from danswer.llm.models import PreviousMessage -from danswer.llm.utils import litellm_exception_to_error_msg -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.server.query_and_chat.models import ChatMessageDetail -from danswer.server.query_and_chat.models import CreateChatMessageRequest -from danswer.server.utils import get_json_line -from danswer.tools.force import ForceUseTool -from danswer.tools.models import ToolResponse -from danswer.tools.tool import Tool -from danswer.tools.tool_constructor import construct_tools -from danswer.tools.tool_constructor import CustomToolConfig -from danswer.tools.tool_constructor import ImageGenerationToolConfig -from danswer.tools.tool_constructor import InternetSearchToolConfig -from danswer.tools.tool_constructor import SearchToolConfig -from danswer.tools.tool_implementations.custom.custom_tool import ( +from onyx.chat.answer import Answer +from onyx.chat.chat_utils import create_chat_chain +from onyx.chat.chat_utils import create_temporary_persona +from onyx.chat.models import AllCitations +from onyx.chat.models import AnswerStyleConfig +from onyx.chat.models import ChatOnyxBotResponse +from onyx.chat.models import CitationConfig +from onyx.chat.models import CitationInfo +from onyx.chat.models import CustomToolResponse +from onyx.chat.models import DocumentPruningConfig +from onyx.chat.models import FileChatDisplay +from onyx.chat.models import FinalUsedContextDocsResponse +from onyx.chat.models import LLMRelevanceFilterResponse +from onyx.chat.models import MessageResponseIDInfo +from onyx.chat.models import MessageSpecificCitations +from onyx.chat.models import OnyxAnswerPiece +from onyx.chat.models import OnyxContexts +from onyx.chat.models import PromptConfig +from onyx.chat.models import QADocsResponse +from onyx.chat.models import StreamingError +from onyx.chat.models import StreamStopInfo +from onyx.configs.chat_configs import CHAT_TARGET_CHUNK_PERCENTAGE +from onyx.configs.chat_configs import DISABLE_LLM_CHOOSE_SEARCH +from onyx.configs.chat_configs import MAX_CHUNKS_FED_TO_CHAT +from onyx.configs.constants import MessageType +from onyx.context.search.enums import OptionalSearchSetting +from onyx.context.search.enums import QueryFlow +from onyx.context.search.enums import SearchType +from onyx.context.search.models import InferenceSection +from onyx.context.search.models import RetrievalDetails +from onyx.context.search.retrieval.search_runner import inference_sections_from_ids +from onyx.context.search.utils import chunks_or_sections_to_search_docs +from onyx.context.search.utils import dedupe_documents +from onyx.context.search.utils import drop_llm_indices +from onyx.context.search.utils import relevant_sections_to_indices +from onyx.db.chat import attach_files_to_chat_message +from onyx.db.chat import create_db_search_doc +from onyx.db.chat import create_new_chat_message +from onyx.db.chat import get_chat_message +from onyx.db.chat import get_chat_session_by_id +from onyx.db.chat import get_db_search_doc_by_id +from onyx.db.chat import get_doc_query_identifiers_from_model +from onyx.db.chat import get_or_create_root_message +from onyx.db.chat import reserve_message_id +from onyx.db.chat import translate_db_message_to_chat_message_detail +from onyx.db.chat import translate_db_search_doc_to_server_search_doc +from onyx.db.engine import get_session_context_manager +from onyx.db.models import SearchDoc as DbSearchDoc +from onyx.db.models import ToolCall +from onyx.db.models import User +from onyx.db.persona import get_persona_by_id +from onyx.db.search_settings import get_current_search_settings +from onyx.document_index.factory import get_default_document_index +from onyx.file_store.models import ChatFileType +from onyx.file_store.models import FileDescriptor +from onyx.file_store.utils import load_all_chat_files +from onyx.file_store.utils import save_files +from onyx.llm.exceptions import GenAIDisabledException +from onyx.llm.factory import get_llms_for_persona +from onyx.llm.factory import get_main_llm_from_tuple +from onyx.llm.models import PreviousMessage +from onyx.llm.utils import litellm_exception_to_error_msg +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.server.query_and_chat.models import ChatMessageDetail +from onyx.server.query_and_chat.models import CreateChatMessageRequest +from onyx.server.utils import get_json_line +from onyx.tools.force import ForceUseTool +from onyx.tools.models import ToolResponse +from onyx.tools.tool import Tool +from onyx.tools.tool_constructor import construct_tools +from onyx.tools.tool_constructor import CustomToolConfig +from onyx.tools.tool_constructor import ImageGenerationToolConfig +from onyx.tools.tool_constructor import InternetSearchToolConfig +from onyx.tools.tool_constructor import SearchToolConfig +from onyx.tools.tool_implementations.custom.custom_tool import ( CUSTOM_TOOL_RESPONSE_ID, ) -from danswer.tools.tool_implementations.custom.custom_tool import CustomToolCallSummary -from danswer.tools.tool_implementations.images.image_generation_tool import ( +from onyx.tools.tool_implementations.custom.custom_tool import CustomToolCallSummary +from onyx.tools.tool_implementations.images.image_generation_tool import ( IMAGE_GENERATION_RESPONSE_ID, ) -from danswer.tools.tool_implementations.images.image_generation_tool import ( +from onyx.tools.tool_implementations.images.image_generation_tool import ( ImageGenerationResponse, ) -from danswer.tools.tool_implementations.internet_search.internet_search_tool import ( +from onyx.tools.tool_implementations.internet_search.internet_search_tool import ( INTERNET_SEARCH_RESPONSE_ID, ) -from danswer.tools.tool_implementations.internet_search.internet_search_tool import ( +from onyx.tools.tool_implementations.internet_search.internet_search_tool import ( internet_search_response_to_search_docs, ) -from danswer.tools.tool_implementations.internet_search.internet_search_tool import ( +from onyx.tools.tool_implementations.internet_search.internet_search_tool import ( InternetSearchResponse, ) -from danswer.tools.tool_implementations.internet_search.internet_search_tool import ( +from onyx.tools.tool_implementations.internet_search.internet_search_tool import ( InternetSearchTool, ) -from danswer.tools.tool_implementations.search.search_tool import ( +from onyx.tools.tool_implementations.search.search_tool import ( FINAL_CONTEXT_DOCUMENTS_ID, ) -from danswer.tools.tool_implementations.search.search_tool import SEARCH_DOC_CONTENT_ID -from danswer.tools.tool_implementations.search.search_tool import ( +from onyx.tools.tool_implementations.search.search_tool import SEARCH_DOC_CONTENT_ID +from onyx.tools.tool_implementations.search.search_tool import ( SEARCH_RESPONSE_SUMMARY_ID, ) -from danswer.tools.tool_implementations.search.search_tool import SearchResponseSummary -from danswer.tools.tool_implementations.search.search_tool import SearchTool -from danswer.tools.tool_implementations.search.search_tool import ( +from onyx.tools.tool_implementations.search.search_tool import SearchResponseSummary +from onyx.tools.tool_implementations.search.search_tool import SearchTool +from onyx.tools.tool_implementations.search.search_tool import ( SECTION_RELEVANCE_LIST_ID, ) -from danswer.tools.tool_runner import ToolCallFinalResult -from danswer.utils.logger import setup_logger -from danswer.utils.long_term_log import LongTermLogger -from danswer.utils.timing import log_function_time -from danswer.utils.timing import log_generator_function_time +from onyx.tools.tool_runner import ToolCallFinalResult +from onyx.utils.logger import setup_logger +from onyx.utils.long_term_log import LongTermLogger +from onyx.utils.timing import log_function_time +from onyx.utils.timing import log_generator_function_time from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR @@ -263,11 +263,11 @@ def _get_force_search_settings( ChatPacket = ( StreamingError | QADocsResponse - | DanswerContexts + | OnyxContexts | LLMRelevanceFilterResponse | FinalUsedContextDocsResponse | ChatMessageDetail - | DanswerAnswerPiece + | OnyxAnswerPiece | AllCitations | CitationInfo | FileChatDisplay @@ -791,7 +791,7 @@ def stream_chat_message_objects( tool_name=custom_tool_response.tool_name, ) elif packet.id == SEARCH_DOC_CONTENT_ID and include_contexts: - yield cast(DanswerContexts, packet.response) + yield cast(OnyxContexts, packet.response) elif isinstance(packet, StreamStopInfo): pass @@ -906,12 +906,12 @@ def stream_chat_message( @log_function_time() def gather_stream_for_slack( packets: ChatPacketStream, -) -> ChatDanswerBotResponse: - response = ChatDanswerBotResponse() +) -> ChatOnyxBotResponse: + response = ChatOnyxBotResponse() answer = "" for packet in packets: - if isinstance(packet, DanswerAnswerPiece) and packet.answer_piece: + if isinstance(packet, OnyxAnswerPiece) and packet.answer_piece: answer += packet.answer_piece elif isinstance(packet, QADocsResponse): response.docs = packet diff --git a/backend/danswer/chat/prompt_builder/build.py b/backend/onyx/chat/prompt_builder/build.py similarity index 82% rename from backend/danswer/chat/prompt_builder/build.py rename to backend/onyx/chat/prompt_builder/build.py index b5a90197bf0..affca0e9397 100644 --- a/backend/danswer/chat/prompt_builder/build.py +++ b/backend/onyx/chat/prompt_builder/build.py @@ -6,24 +6,24 @@ from langchain_core.messages import SystemMessage from pydantic.v1 import BaseModel as BaseModel__v1 -from danswer.chat.models import PromptConfig -from danswer.chat.prompt_builder.citations_prompt import compute_max_llm_input_tokens -from danswer.chat.prompt_builder.utils import translate_history_to_basemessages -from danswer.file_store.models import InMemoryChatFile -from danswer.llm.interfaces import LLMConfig -from danswer.llm.models import PreviousMessage -from danswer.llm.utils import build_content_with_imgs -from danswer.llm.utils import check_message_tokens -from danswer.llm.utils import message_to_prompt_and_imgs -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.prompts.chat_prompts import CHAT_USER_CONTEXT_FREE_PROMPT -from danswer.prompts.prompt_utils import add_date_time_to_prompt -from danswer.prompts.prompt_utils import drop_messages_history_overflow -from danswer.tools.force import ForceUseTool -from danswer.tools.models import ToolCallFinalResult -from danswer.tools.models import ToolCallKickoff -from danswer.tools.models import ToolResponse -from danswer.tools.tool import Tool +from onyx.chat.models import PromptConfig +from onyx.chat.prompt_builder.citations_prompt import compute_max_llm_input_tokens +from onyx.chat.prompt_builder.utils import translate_history_to_basemessages +from onyx.file_store.models import InMemoryChatFile +from onyx.llm.interfaces import LLMConfig +from onyx.llm.models import PreviousMessage +from onyx.llm.utils import build_content_with_imgs +from onyx.llm.utils import check_message_tokens +from onyx.llm.utils import message_to_prompt_and_imgs +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.prompts.chat_prompts import CHAT_USER_CONTEXT_FREE_PROMPT +from onyx.prompts.prompt_utils import add_date_time_to_prompt +from onyx.prompts.prompt_utils import drop_messages_history_overflow +from onyx.tools.force import ForceUseTool +from onyx.tools.models import ToolCallFinalResult +from onyx.tools.models import ToolCallKickoff +from onyx.tools.models import ToolResponse +from onyx.tools.tool import Tool def default_build_system_message( diff --git a/backend/danswer/chat/prompt_builder/citations_prompt.py b/backend/onyx/chat/prompt_builder/citations_prompt.py similarity index 75% rename from backend/danswer/chat/prompt_builder/citations_prompt.py rename to backend/onyx/chat/prompt_builder/citations_prompt.py index a49dd25ae92..03ff8a657ed 100644 --- a/backend/danswer/chat/prompt_builder/citations_prompt.py +++ b/backend/onyx/chat/prompt_builder/citations_prompt.py @@ -1,36 +1,36 @@ from langchain.schema.messages import HumanMessage from langchain.schema.messages import SystemMessage -from danswer.chat.models import LlmDoc -from danswer.chat.models import PromptConfig -from danswer.configs.model_configs import GEN_AI_SINGLE_USER_MESSAGE_EXPECTED_MAX_TOKENS -from danswer.context.search.models import InferenceChunk -from danswer.db.models import Persona -from danswer.db.persona import get_default_prompt__read_only -from danswer.db.search_settings import get_multilingual_expansion -from danswer.llm.factory import get_llms_for_persona -from danswer.llm.factory import get_main_llm_from_tuple -from danswer.llm.interfaces import LLMConfig -from danswer.llm.utils import build_content_with_imgs -from danswer.llm.utils import check_number_of_tokens -from danswer.llm.utils import get_max_input_tokens -from danswer.llm.utils import message_to_prompt_and_imgs -from danswer.prompts.chat_prompts import REQUIRE_CITATION_STATEMENT -from danswer.prompts.constants import DEFAULT_IGNORE_STATEMENT -from danswer.prompts.direct_qa_prompts import CITATIONS_PROMPT -from danswer.prompts.direct_qa_prompts import CITATIONS_PROMPT_FOR_TOOL_CALLING -from danswer.prompts.direct_qa_prompts import HISTORY_BLOCK -from danswer.prompts.prompt_utils import add_date_time_to_prompt -from danswer.prompts.prompt_utils import build_complete_context_str -from danswer.prompts.prompt_utils import build_task_prompt_reminders -from danswer.prompts.token_counts import ADDITIONAL_INFO_TOKEN_CNT -from danswer.prompts.token_counts import ( +from onyx.chat.models import LlmDoc +from onyx.chat.models import PromptConfig +from onyx.configs.model_configs import GEN_AI_SINGLE_USER_MESSAGE_EXPECTED_MAX_TOKENS +from onyx.context.search.models import InferenceChunk +from onyx.db.models import Persona +from onyx.db.persona import get_default_prompt__read_only +from onyx.db.search_settings import get_multilingual_expansion +from onyx.llm.factory import get_llms_for_persona +from onyx.llm.factory import get_main_llm_from_tuple +from onyx.llm.interfaces import LLMConfig +from onyx.llm.utils import build_content_with_imgs +from onyx.llm.utils import check_number_of_tokens +from onyx.llm.utils import get_max_input_tokens +from onyx.llm.utils import message_to_prompt_and_imgs +from onyx.prompts.chat_prompts import REQUIRE_CITATION_STATEMENT +from onyx.prompts.constants import DEFAULT_IGNORE_STATEMENT +from onyx.prompts.direct_qa_prompts import CITATIONS_PROMPT +from onyx.prompts.direct_qa_prompts import CITATIONS_PROMPT_FOR_TOOL_CALLING +from onyx.prompts.direct_qa_prompts import HISTORY_BLOCK +from onyx.prompts.prompt_utils import add_date_time_to_prompt +from onyx.prompts.prompt_utils import build_complete_context_str +from onyx.prompts.prompt_utils import build_task_prompt_reminders +from onyx.prompts.token_counts import ADDITIONAL_INFO_TOKEN_CNT +from onyx.prompts.token_counts import ( CHAT_USER_PROMPT_WITH_CONTEXT_OVERHEAD_TOKEN_CNT, ) -from danswer.prompts.token_counts import CITATION_REMINDER_TOKEN_CNT -from danswer.prompts.token_counts import CITATION_STATEMENT_TOKEN_CNT -from danswer.prompts.token_counts import LANGUAGE_HINT_TOKEN_CNT -from danswer.utils.logger import setup_logger +from onyx.prompts.token_counts import CITATION_REMINDER_TOKEN_CNT +from onyx.prompts.token_counts import CITATION_STATEMENT_TOKEN_CNT +from onyx.prompts.token_counts import LANGUAGE_HINT_TOKEN_CNT +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/chat/prompt_builder/quotes_prompt.py b/backend/onyx/chat/prompt_builder/quotes_prompt.py similarity index 69% rename from backend/danswer/chat/prompt_builder/quotes_prompt.py rename to backend/onyx/chat/prompt_builder/quotes_prompt.py index fa51b571e4d..daca6a88e73 100644 --- a/backend/danswer/chat/prompt_builder/quotes_prompt.py +++ b/backend/onyx/chat/prompt_builder/quotes_prompt.py @@ -1,16 +1,16 @@ from langchain.schema.messages import HumanMessage -from danswer.chat.models import LlmDoc -from danswer.chat.models import PromptConfig -from danswer.configs.chat_configs import LANGUAGE_HINT -from danswer.context.search.models import InferenceChunk -from danswer.db.search_settings import get_multilingual_expansion -from danswer.llm.utils import message_to_prompt_and_imgs -from danswer.prompts.direct_qa_prompts import CONTEXT_BLOCK -from danswer.prompts.direct_qa_prompts import HISTORY_BLOCK -from danswer.prompts.direct_qa_prompts import JSON_PROMPT -from danswer.prompts.prompt_utils import add_date_time_to_prompt -from danswer.prompts.prompt_utils import build_complete_context_str +from onyx.chat.models import LlmDoc +from onyx.chat.models import PromptConfig +from onyx.configs.chat_configs import LANGUAGE_HINT +from onyx.context.search.models import InferenceChunk +from onyx.db.search_settings import get_multilingual_expansion +from onyx.llm.utils import message_to_prompt_and_imgs +from onyx.prompts.direct_qa_prompts import CONTEXT_BLOCK +from onyx.prompts.direct_qa_prompts import HISTORY_BLOCK +from onyx.prompts.direct_qa_prompts import JSON_PROMPT +from onyx.prompts.prompt_utils import add_date_time_to_prompt +from onyx.prompts.prompt_utils import build_complete_context_str def _build_strong_llm_quotes_prompt( diff --git a/backend/danswer/chat/prompt_builder/utils.py b/backend/onyx/chat/prompt_builder/utils.py similarity index 76% rename from backend/danswer/chat/prompt_builder/utils.py rename to backend/onyx/chat/prompt_builder/utils.py index 6383be5345e..13084fcd188 100644 --- a/backend/danswer/chat/prompt_builder/utils.py +++ b/backend/onyx/chat/prompt_builder/utils.py @@ -2,13 +2,13 @@ from langchain.schema.messages import BaseMessage from langchain.schema.messages import HumanMessage -from danswer.configs.constants import MessageType -from danswer.db.models import ChatMessage -from danswer.file_store.models import InMemoryChatFile -from danswer.llm.models import PreviousMessage -from danswer.llm.utils import build_content_with_imgs -from danswer.prompts.direct_qa_prompts import PARAMATERIZED_PROMPT -from danswer.prompts.direct_qa_prompts import PARAMATERIZED_PROMPT_WITHOUT_CONTEXT +from onyx.configs.constants import MessageType +from onyx.db.models import ChatMessage +from onyx.file_store.models import InMemoryChatFile +from onyx.llm.models import PreviousMessage +from onyx.llm.utils import build_content_with_imgs +from onyx.prompts.direct_qa_prompts import PARAMATERIZED_PROMPT +from onyx.prompts.direct_qa_prompts import PARAMATERIZED_PROMPT_WITHOUT_CONTEXT def build_dummy_prompt( @@ -29,7 +29,7 @@ def build_dummy_prompt( ).strip() -def translate_danswer_msg_to_langchain( +def translate_onyx_msg_to_langchain( msg: ChatMessage | PreviousMessage, ) -> BaseMessage: files: list[InMemoryChatFile] = [] @@ -54,9 +54,7 @@ def translate_history_to_basemessages( history: list[ChatMessage] | list["PreviousMessage"], ) -> tuple[list[BaseMessage], list[int]]: history_basemessages = [ - translate_danswer_msg_to_langchain(msg) - for msg in history - if msg.token_count != 0 + translate_onyx_msg_to_langchain(msg) for msg in history if msg.token_count != 0 ] history_token_counts = [msg.token_count for msg in history if msg.token_count != 0] return history_basemessages, history_token_counts diff --git a/backend/danswer/chat/prune_and_merge.py b/backend/onyx/chat/prune_and_merge.py similarity index 94% rename from backend/danswer/chat/prune_and_merge.py rename to backend/onyx/chat/prune_and_merge.py index 0085793f88c..284a1e193fe 100644 --- a/backend/danswer/chat/prune_and_merge.py +++ b/backend/onyx/chat/prune_and_merge.py @@ -5,22 +5,22 @@ from pydantic import BaseModel -from danswer.chat.models import ContextualPruningConfig -from danswer.chat.models import ( +from onyx.chat.models import ContextualPruningConfig +from onyx.chat.models import ( LlmDoc, ) -from danswer.chat.models import PromptConfig -from danswer.chat.prompt_builder.citations_prompt import compute_max_document_tokens -from danswer.configs.constants import IGNORE_FOR_QA -from danswer.configs.model_configs import DOC_EMBEDDING_CONTEXT_SIZE -from danswer.context.search.models import InferenceChunk -from danswer.context.search.models import InferenceSection -from danswer.llm.interfaces import LLMConfig -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.natural_language_processing.utils import tokenizer_trim_content -from danswer.prompts.prompt_utils import build_doc_context_str -from danswer.tools.tool_implementations.search.search_utils import section_to_dict -from danswer.utils.logger import setup_logger +from onyx.chat.models import PromptConfig +from onyx.chat.prompt_builder.citations_prompt import compute_max_document_tokens +from onyx.configs.constants import IGNORE_FOR_QA +from onyx.configs.model_configs import DOC_EMBEDDING_CONTEXT_SIZE +from onyx.context.search.models import InferenceChunk +from onyx.context.search.models import InferenceSection +from onyx.llm.interfaces import LLMConfig +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.natural_language_processing.utils import tokenizer_trim_content +from onyx.prompts.prompt_utils import build_doc_context_str +from onyx.tools.tool_implementations.search.search_utils import section_to_dict +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/chat/stream_processing/answer_response_handler.py b/backend/onyx/chat/stream_processing/answer_response_handler.py similarity index 89% rename from backend/danswer/chat/stream_processing/answer_response_handler.py rename to backend/onyx/chat/stream_processing/answer_response_handler.py index a10f46be5f5..6d1031e95d0 100644 --- a/backend/danswer/chat/stream_processing/answer_response_handler.py +++ b/backend/onyx/chat/stream_processing/answer_response_handler.py @@ -3,12 +3,12 @@ from langchain_core.messages import BaseMessage -from danswer.chat.llm_response_handler import ResponsePart -from danswer.chat.models import CitationInfo -from danswer.chat.models import LlmDoc -from danswer.chat.stream_processing.citation_processing import CitationProcessor -from danswer.chat.stream_processing.utils import DocumentIdOrderMapping -from danswer.utils.logger import setup_logger +from onyx.chat.llm_response_handler import ResponsePart +from onyx.chat.models import CitationInfo +from onyx.chat.models import LlmDoc +from onyx.chat.stream_processing.citation_processing import CitationProcessor +from onyx.chat.stream_processing.utils import DocumentIdOrderMapping +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/chat/stream_processing/citation_processing.py b/backend/onyx/chat/stream_processing/citation_processing.py similarity index 93% rename from backend/danswer/chat/stream_processing/citation_processing.py rename to backend/onyx/chat/stream_processing/citation_processing.py index 8966303faff..e66be3fb840 100644 --- a/backend/danswer/chat/stream_processing/citation_processing.py +++ b/backend/onyx/chat/stream_processing/citation_processing.py @@ -1,13 +1,13 @@ import re from collections.abc import Generator -from danswer.chat.models import CitationInfo -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import LlmDoc -from danswer.chat.stream_processing.utils import DocumentIdOrderMapping -from danswer.configs.chat_configs import STOP_STREAM_PAT -from danswer.prompts.constants import TRIPLE_BACKTICK -from danswer.utils.logger import setup_logger +from onyx.chat.models import CitationInfo +from onyx.chat.models import LlmDoc +from onyx.chat.models import OnyxAnswerPiece +from onyx.chat.stream_processing.utils import DocumentIdOrderMapping +from onyx.configs.chat_configs import STOP_STREAM_PAT +from onyx.prompts.constants import TRIPLE_BACKTICK +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -43,10 +43,10 @@ def __init__( def process_token( self, token: str | None - ) -> Generator[DanswerAnswerPiece | CitationInfo, None, None]: + ) -> Generator[OnyxAnswerPiece | CitationInfo, None, None]: # None -> end of stream if token is None: - yield DanswerAnswerPiece(answer_piece=self.curr_segment) + yield OnyxAnswerPiece(answer_piece=self.curr_segment) return if self.stop_stream: @@ -192,4 +192,4 @@ def process_token( self.curr_segment = "" if result: - yield DanswerAnswerPiece(answer_piece=result) + yield OnyxAnswerPiece(answer_piece=result) diff --git a/backend/danswer/chat/stream_processing/quotes_processing.py b/backend/onyx/chat/stream_processing/quotes_processing.py similarity index 85% rename from backend/danswer/chat/stream_processing/quotes_processing.py rename to backend/onyx/chat/stream_processing/quotes_processing.py index 306901ca396..e121abb462d 100644 --- a/backend/danswer/chat/stream_processing/quotes_processing.py +++ b/backend/onyx/chat/stream_processing/quotes_processing.py @@ -8,25 +8,25 @@ import regex from pydantic import BaseModel -from danswer.chat.models import DanswerAnswer -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import LlmDoc -from danswer.configs.chat_configs import QUOTE_ALLOWED_ERROR_PERCENT -from danswer.context.search.models import InferenceChunk -from danswer.prompts.constants import ANSWER_PAT -from danswer.prompts.constants import QUOTE_PAT -from danswer.utils.logger import setup_logger -from danswer.utils.text_processing import clean_model_quote -from danswer.utils.text_processing import clean_up_code_blocks -from danswer.utils.text_processing import extract_embedded_json -from danswer.utils.text_processing import shared_precompare_cleanup +from onyx.chat.models import LlmDoc +from onyx.chat.models import OnyxAnswer +from onyx.chat.models import OnyxAnswerPiece +from onyx.configs.chat_configs import QUOTE_ALLOWED_ERROR_PERCENT +from onyx.context.search.models import InferenceChunk +from onyx.prompts.constants import ANSWER_PAT +from onyx.prompts.constants import QUOTE_PAT +from onyx.utils.logger import setup_logger +from onyx.utils.text_processing import clean_model_quote +from onyx.utils.text_processing import clean_up_code_blocks +from onyx.utils.text_processing import extract_embedded_json +from onyx.utils.text_processing import shared_precompare_cleanup logger = setup_logger() answer_pattern = re.compile(r'{\s*"answer"\s*:\s*"', re.IGNORECASE) -class DanswerQuote(BaseModel): +class OnyxQuote(BaseModel): # This is during inference so everything is a string by this point quote: str document_id: str @@ -36,8 +36,8 @@ class DanswerQuote(BaseModel): blurb: str -class DanswerQuotes(BaseModel): - quotes: list[DanswerQuote] +class OnyxQuotes(BaseModel): + quotes: list[OnyxQuote] def _extract_answer_quotes_freeform( @@ -104,8 +104,8 @@ def match_quotes_to_docs( max_error_percent: float = QUOTE_ALLOWED_ERROR_PERCENT, fuzzy_search: bool = False, prefix_only_length: int = 100, -) -> DanswerQuotes: - danswer_quotes: list[DanswerQuote] = [] +) -> OnyxQuotes: + onyx_quotes: list[OnyxQuote] = [] for quote in quotes: max_edits = math.ceil(float(len(quote)) * max_error_percent) @@ -142,8 +142,8 @@ def match_quotes_to_docs( else: break - danswer_quotes.append( - DanswerQuote( + onyx_quotes.append( + OnyxQuote( quote=quote, document_id=doc.document_id, link=curr_link, @@ -154,7 +154,7 @@ def match_quotes_to_docs( ) break - return DanswerQuotes(quotes=danswer_quotes) + return OnyxQuotes(quotes=onyx_quotes) def separate_answer_quotes( @@ -172,24 +172,24 @@ def _process_answer( answer_raw: str, docs: list[LlmDoc], is_json_prompt: bool = True, -) -> tuple[DanswerAnswer, DanswerQuotes]: +) -> tuple[OnyxAnswer, OnyxQuotes]: """Used (1) in the non-streaming case to process the model output into an Answer and Quotes AND (2) after the complete streaming response has been received to process the model output into an Answer and Quotes.""" answer, quote_strings = separate_answer_quotes(answer_raw, is_json_prompt) if not answer: logger.debug("No answer extracted from raw output") - return DanswerAnswer(answer=None), DanswerQuotes(quotes=[]) + return OnyxAnswer(answer=None), OnyxQuotes(quotes=[]) logger.notice(f"Answer: {answer}") if not quote_strings: logger.debug("No quotes extracted from raw output") - return DanswerAnswer(answer=answer), DanswerQuotes(quotes=[]) + return OnyxAnswer(answer=answer), OnyxQuotes(quotes=[]) logger.debug(f"All quotes (including unmatched): {quote_strings}") quotes = match_quotes_to_docs(quote_strings, docs) logger.debug(f"Final quotes: {quotes}") - return DanswerAnswer(answer=answer), quotes + return OnyxAnswer(answer=answer), quotes def _stream_json_answer_end(answer_so_far: str, next_token: str) -> bool: @@ -205,7 +205,7 @@ def _stream_json_answer_end(answer_so_far: str, next_token: str) -> bool: def _extract_quotes_from_completed_token_stream( model_output: str, context_docs: list[LlmDoc], is_json_prompt: bool = True -) -> DanswerQuotes: +) -> OnyxQuotes: answer, quotes = _process_answer(model_output, context_docs, is_json_prompt) if answer: logger.notice(answer) @@ -232,7 +232,7 @@ def __init__( def process_token( self, token: str | None - ) -> Generator[DanswerAnswerPiece | DanswerQuotes, None, None]: + ) -> Generator[OnyxAnswerPiece | OnyxQuotes, None, None]: # None -> end of stream if token is None: if self.model_output: @@ -271,12 +271,12 @@ def process_token( pos -= 1 # If even number of backslashes, quote is not escaped if num_backslashes % 2 == 0: - yield DanswerAnswerPiece(answer_piece=remaining[:quote_idx]) + yield OnyxAnswerPiece(answer_piece=remaining[:quote_idx]) return # If no unescaped quote found, yield the remaining string if len(remaining) > 0: - yield DanswerAnswerPiece(answer_piece=remaining) + yield OnyxAnswerPiece(answer_piece=remaining) return if self.found_answer_start and not self.found_answer_end: @@ -286,13 +286,13 @@ def process_token( if token: try: answer_token_section = token.index('"') - yield DanswerAnswerPiece( + yield OnyxAnswerPiece( answer_piece=self.hold_quote + token[:answer_token_section] ) except ValueError: logger.error("Quotation mark not found in token") - yield DanswerAnswerPiece(answer_piece=self.hold_quote + token) - yield DanswerAnswerPiece(answer_piece=None) + yield OnyxAnswerPiece(answer_piece=self.hold_quote + token) + yield OnyxAnswerPiece(answer_piece=None) return elif not self.is_json_prompt: @@ -305,11 +305,11 @@ def process_token( or quote_loose in self.hold_quote + token ): self.found_answer_end = True - yield DanswerAnswerPiece(answer_piece=None) + yield OnyxAnswerPiece(answer_piece=None) return if self.hold_quote + token in quote_pat_full: self.hold_quote += token return - yield DanswerAnswerPiece(answer_piece=self.hold_quote + token) + yield OnyxAnswerPiece(answer_piece=self.hold_quote + token) self.hold_quote = "" diff --git a/backend/danswer/chat/stream_processing/utils.py b/backend/onyx/chat/stream_processing/utils.py similarity index 85% rename from backend/danswer/chat/stream_processing/utils.py rename to backend/onyx/chat/stream_processing/utils.py index 4f328fc7240..97aa4ce607b 100644 --- a/backend/danswer/chat/stream_processing/utils.py +++ b/backend/onyx/chat/stream_processing/utils.py @@ -2,8 +2,8 @@ from pydantic import BaseModel -from danswer.chat.models import LlmDoc -from danswer.context.search.models import InferenceChunk +from onyx.chat.models import LlmDoc +from onyx.context.search.models import InferenceChunk class DocumentIdOrderMapping(BaseModel): diff --git a/backend/danswer/chat/tool_handling/tool_response_handler.py b/backend/onyx/chat/tool_handling/tool_response_handler.py similarity index 91% rename from backend/danswer/chat/tool_handling/tool_response_handler.py rename to backend/onyx/chat/tool_handling/tool_response_handler.py index 5438aa2255e..1a39e5c8d0f 100644 --- a/backend/danswer/chat/tool_handling/tool_response_handler.py +++ b/backend/onyx/chat/tool_handling/tool_response_handler.py @@ -4,22 +4,22 @@ from langchain_core.messages import BaseMessage from langchain_core.messages import ToolCall -from danswer.chat.models import ResponsePart -from danswer.chat.prompt_builder.build import LLMCall -from danswer.llm.interfaces import LLM -from danswer.tools.force import ForceUseTool -from danswer.tools.message import build_tool_message -from danswer.tools.message import ToolCallSummary -from danswer.tools.models import ToolCallFinalResult -from danswer.tools.models import ToolCallKickoff -from danswer.tools.models import ToolResponse -from danswer.tools.tool import Tool -from danswer.tools.tool_runner import ( +from onyx.chat.models import ResponsePart +from onyx.chat.prompt_builder.build import LLMCall +from onyx.llm.interfaces import LLM +from onyx.tools.force import ForceUseTool +from onyx.tools.message import build_tool_message +from onyx.tools.message import ToolCallSummary +from onyx.tools.models import ToolCallFinalResult +from onyx.tools.models import ToolCallKickoff +from onyx.tools.models import ToolResponse +from onyx.tools.tool import Tool +from onyx.tools.tool_runner import ( check_which_tools_should_run_for_non_tool_calling_llm, ) -from danswer.tools.tool_runner import ToolRunner -from danswer.tools.tool_selection import select_single_tool_for_non_tool_calling_llm -from danswer.utils.logger import setup_logger +from onyx.tools.tool_runner import ToolRunner +from onyx.tools.tool_selection import select_single_tool_for_non_tool_calling_llm +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/dropbox/__init__.py b/backend/onyx/configs/__init__.py similarity index 100% rename from backend/danswer/connectors/dropbox/__init__.py rename to backend/onyx/configs/__init__.py diff --git a/backend/danswer/configs/app_configs.py b/backend/onyx/configs/app_configs.py similarity index 96% rename from backend/danswer/configs/app_configs.py rename to backend/onyx/configs/app_configs.py index 18a6b0b38a4..5dbf440fbe6 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/onyx/configs/app_configs.py @@ -2,9 +2,9 @@ import os import urllib.parse -from danswer.configs.constants import AuthType -from danswer.configs.constants import DocumentIndexType -from danswer.file_processing.enums import HtmlBasedConnectorTransformLinksStrategy +from onyx.configs.constants import AuthType +from onyx.configs.constants import DocumentIndexType +from onyx.file_processing.enums import HtmlBasedConnectorTransformLinksStrategy ##### # App Configs @@ -31,7 +31,7 @@ # Web Configs ##### # WEB_DOMAIN is used to set the redirect_uri after login flows -# NOTE: if you are having problems accessing the Danswer web UI locally (especially +# NOTE: if you are having problems accessing the Onyx web UI locally (especially # on Windows, try setting this to `http://127.0.0.1:3000` instead and see if that # fixes it) WEB_DOMAIN = os.environ.get("WEB_DOMAIN") or "http://localhost:3000" @@ -45,7 +45,7 @@ # Encryption key secret is used to encrypt connector credentials, api keys, and other sensitive # information. This provides an extra layer of security on top of Postgres access controls -# and is available in Danswer EE +# and is available in Onyx EE ENCRYPTION_KEY_SECRET = os.environ.get("ENCRYPTION_KEY_SECRET") or "" # Turn off mask if admin users should see full credentials for data connectors. @@ -58,8 +58,8 @@ ) # 7 days # set `VALID_EMAIL_DOMAINS` to a comma seperated list of domains in order to -# restrict access to Danswer to only users with emails from those domains. -# E.g. `VALID_EMAIL_DOMAINS=example.com,example.org` will restrict Danswer +# restrict access to Onyx to only users with emails from those domains. +# E.g. `VALID_EMAIL_DOMAINS=example.com,example.org` will restrict Onyx # signups to users with either an @example.com or an @example.org email. # NOTE: maintaining `VALID_EMAIL_DOMAIN` to keep backwards compatibility _VALID_EMAIL_DOMAIN = os.environ.get("VALID_EMAIL_DOMAIN", "") @@ -93,7 +93,7 @@ SMTP_PASS = os.environ.get("SMTP_PASS", "your-gmail-password") EMAIL_FROM = os.environ.get("EMAIL_FROM") or SMTP_USER -# If set, Danswer will listen to the `expires_at` returned by the identity +# If set, Onyx will listen to the `expires_at` returned by the identity # provider (e.g. Okta, Google, etc.) and force the user to re-authenticate # after this time has elapsed. Disabled since by default many auth providers # have very short expiry times (e.g. 1 hour) which provide a poor user experience @@ -123,7 +123,7 @@ # The default below is for dockerized deployment VESPA_DEPLOYMENT_ZIP = ( - os.environ.get("VESPA_DEPLOYMENT_ZIP") or "/app/danswer/vespa-app.zip" + os.environ.get("VESPA_DEPLOYMENT_ZIP") or "/app/onyx/vespa-app.zip" ) VESPA_CLOUD_CERT_PATH = os.environ.get("VESPA_CLOUD_CERT_PATH") VESPA_CLOUD_KEY_PATH = os.environ.get("VESPA_CLOUD_KEY_PATH") @@ -252,7 +252,7 @@ POLL_CONNECTOR_OFFSET = 30 # Minutes overlap between poll windows # View the list here: -# https://github.com/danswer-ai/danswer/blob/main/backend/danswer/connectors/factory.py +# https://github.com/onyx-dot-app/onyx/blob/main/backend/onyx/connectors/factory.py # If this is empty, all connectors are enabled, this is an option for security heavy orgs where # only very select connectors are enabled and admins cannot add other connector types ENABLED_CONNECTOR_TYPES = os.environ.get("ENABLED_CONNECTOR_TYPES") or "" @@ -447,7 +447,7 @@ LOG_ALL_MODEL_INTERACTIONS = ( os.environ.get("LOG_ALL_MODEL_INTERACTIONS", "").lower() == "true" ) -# Logs Danswer only model interactions like prompts, responses, messages etc. +# Logs Onyx only model interactions like prompts, responses, messages etc. LOG_DANSWER_MODEL_INTERACTIONS = ( os.environ.get("LOG_DANSWER_MODEL_INTERACTIONS", "").lower() == "true" ) @@ -488,7 +488,7 @@ ##### # NOTE: this should only be enabled if you have purchased an enterprise license. # if you're interested in an enterprise license, please reach out to us at -# founders@danswer.ai OR message Chris Weaver or Yuhong Sun in the Danswer +# founders@onyx.app OR message Chris Weaver or Yuhong Sun in the Onyx # Slack community (https://join.slack.com/t/danswer/shared_invite/zt-1w76msxmd-HJHLe3KNFIAIzk_0dSOKaQ) ENTERPRISE_EDITION_ENABLED = ( os.environ.get("ENABLE_PAID_ENTERPRISE_EDITION_FEATURES", "").lower() == "true" diff --git a/backend/danswer/configs/chat_configs.py b/backend/onyx/configs/chat_configs.py similarity index 97% rename from backend/danswer/configs/chat_configs.py rename to backend/onyx/configs/chat_configs.py index 88ff301a99e..f0359abe38c 100644 --- a/backend/danswer/configs/chat_configs.py +++ b/backend/onyx/configs/chat_configs.py @@ -1,8 +1,8 @@ import os -PROMPTS_YAML = "./danswer/seeding/prompts.yaml" -PERSONAS_YAML = "./danswer/seeding/personas.yaml" +PROMPTS_YAML = "./onyx/seeding/prompts.yaml" +PERSONAS_YAML = "./onyx/seeding/personas.yaml" NUM_RETURNED_HITS = 50 # Used for LLM filtering and reranking diff --git a/backend/danswer/configs/constants.py b/backend/onyx/configs/constants.py similarity index 95% rename from backend/danswer/configs/constants.py rename to backend/onyx/configs/constants.py index b9b5f7deb26..1725de71788 100644 --- a/backend/danswer/configs/constants.py +++ b/backend/onyx/configs/constants.py @@ -22,13 +22,13 @@ INDEX_SEPARATOR = "===" # For File Connector Metadata override file -DANSWER_METADATA_FILENAME = ".danswer_metadata.json" +DANSWER_METADATA_FILENAME = ".onyx_metadata.json" # Messages DISABLED_GEN_AI_MSG = ( - "Your System Admin has disabled the Generative AI functionalities of Danswer.\n" + "Your System Admin has disabled the Generative AI functionalities of Onyx.\n" "Please contact them if you wish to have this enabled.\n" - "You can still use Danswer as a search engine." + "You can still use Onyx as a search engine." ) DEFAULT_PERSONA_ID = 0 @@ -48,7 +48,7 @@ # API Keys DANSWER_API_KEY_PREFIX = "API_KEY__" -DANSWER_API_KEY_DUMMY_EMAIL_DOMAIN = "danswerapikey.ai" +DANSWER_API_KEY_DUMMY_EMAIL_DOMAIN = "onyxapikey.ai" UNNAMED_KEY_PLACEHOLDER = "Unnamed" # Key-Value store keys @@ -63,10 +63,10 @@ KV_GOOGLE_DRIVE_CRED_KEY = "google_drive_app_credential" KV_GOOGLE_DRIVE_SERVICE_ACCOUNT_KEY = "google_drive_service_account_key" KV_GEN_AI_KEY_CHECK_TIME = "genai_api_key_last_check_time" -KV_SETTINGS_KEY = "danswer_settings" +KV_SETTINGS_KEY = "onyx_settings" KV_CUSTOMER_UUID_KEY = "customer_uuid" KV_INSTANCE_DOMAIN_KEY = "instance_domain" -KV_ENTERPRISE_SETTINGS_KEY = "danswer_enterprise_settings" +KV_ENTERPRISE_SETTINGS_KEY = "onyx_enterprise_settings" KV_CUSTOM_ANALYTICS_SCRIPT_KEY = "__custom_analytics_script__" KV_DOCUMENTS_SEEDED_KEY = "documents_seeded" @@ -89,7 +89,7 @@ class DocumentSource(str, Enum): - # Special case, document passed in via Danswer APIs without specifying a source type + # Special case, document passed in via Onyx APIs without specifying a source type INGESTION_API = "ingestion_api" SLACK = "slack" WEB = "web" @@ -214,7 +214,7 @@ class PostgresAdvisoryLocks(Enum): KOMBU_MESSAGE_CLEANUP_LOCK_ID = auto() -class DanswerCeleryQueues: +class OnyxCeleryQueues: # Light queue VESPA_METADATA_SYNC = "vespa_metadata_sync" DOC_PERMISSIONS_UPSERT = "doc_permissions_upsert" @@ -229,7 +229,7 @@ class DanswerCeleryQueues: CONNECTOR_INDEXING = "connector_indexing" -class DanswerRedisLocks: +class OnyxRedisLocks: PRIMARY_WORKER = "da_lock:primary_worker" CHECK_VESPA_SYNC_BEAT_LOCK = "da_lock:check_vespa_sync_beat" CHECK_CONNECTOR_DELETION_BEAT_LOCK = "da_lock:check_connector_deletion_beat" @@ -254,7 +254,7 @@ class DanswerRedisLocks: SLACK_BOT_HEARTBEAT_PREFIX = "da_heartbeat:slack_bot" -class DanswerCeleryPriority(int, Enum): +class OnyxCeleryPriority(int, Enum): HIGHEST = 0 HIGH = auto() MEDIUM = auto() @@ -262,7 +262,7 @@ class DanswerCeleryPriority(int, Enum): LOWEST = auto() -class DanswerCeleryTask: +class OnyxCeleryTask: CHECK_FOR_CONNECTOR_DELETION = "check_for_connector_deletion_task" CHECK_FOR_VESPA_SYNC_TASK = "check_for_vespa_sync_task" CHECK_FOR_INDEXING = "check_for_indexing" diff --git a/backend/danswer/configs/model_configs.py b/backend/onyx/configs/model_configs.py similarity index 98% rename from backend/danswer/configs/model_configs.py rename to backend/onyx/configs/model_configs.py index b71762a4c88..0c85661d6b5 100644 --- a/backend/danswer/configs/model_configs.py +++ b/backend/onyx/configs/model_configs.py @@ -100,7 +100,7 @@ LITELLM_EXTRA_HEADERS = json.loads(_LITELLM_EXTRA_HEADERS_RAW) except Exception: # need to import here to avoid circular imports - from danswer.utils.logger import setup_logger + from onyx.utils.logger import setup_logger logger = setup_logger() logger.error( @@ -115,7 +115,7 @@ LITELLM_PASS_THROUGH_HEADERS = json.loads(_LITELLM_PASS_THROUGH_HEADERS_RAW) except Exception: # need to import here to avoid circular imports - from danswer.utils.logger import setup_logger + from onyx.utils.logger import setup_logger logger = setup_logger() logger.error( diff --git a/backend/danswer/configs/danswerbot_configs.py b/backend/onyx/configs/onyxbot_configs.py similarity index 85% rename from backend/danswer/configs/danswerbot_configs.py rename to backend/onyx/configs/onyxbot_configs.py index 7a7e5f41377..5526c4fab6e 100644 --- a/backend/danswer/configs/danswerbot_configs.py +++ b/backend/onyx/configs/onyxbot_configs.py @@ -1,7 +1,7 @@ import os ##### -# Danswer Slack Bot Configs +# Onyx Slack Bot Configs ##### DANSWER_BOT_NUM_RETRIES = int(os.environ.get("DANSWER_BOT_NUM_RETRIES", "5")) # How much of the available input context can be used for thread context @@ -10,15 +10,15 @@ DANSWER_BOT_NUM_DOCS_TO_DISPLAY = int( os.environ.get("DANSWER_BOT_NUM_DOCS_TO_DISPLAY", "5") ) -# If the LLM fails to answer, Danswer can still show the "Reference Documents" +# If the LLM fails to answer, Onyx can still show the "Reference Documents" DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER = os.environ.get( "DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER", "" ).lower() not in ["false", ""] -# When Danswer is considering a message, what emoji does it react with +# When Onyx is considering a message, what emoji does it react with DANSWER_REACT_EMOJI = os.environ.get("DANSWER_REACT_EMOJI") or "eyes" # When User needs more help, what should the emoji be DANSWER_FOLLOWUP_EMOJI = os.environ.get("DANSWER_FOLLOWUP_EMOJI") or "sos" -# What kind of message should be shown when someone gives an AI answer feedback to DanswerBot +# What kind of message should be shown when someone gives an AI answer feedback to OnyxBot # Defaults to Private if not provided or invalid # Private: Only visible to user clicking the feedback # Anonymous: Public but anonymous @@ -26,14 +26,14 @@ DANSWER_BOT_FEEDBACK_VISIBILITY = ( os.environ.get("DANSWER_BOT_FEEDBACK_VISIBILITY") or "private" ) -# Should DanswerBot send an apology message if it's not able to find an answer -# That way the user isn't confused as to why DanswerBot reacted but then said nothing +# Should OnyxBot send an apology message if it's not able to find an answer +# That way the user isn't confused as to why OnyxBot reacted but then said nothing # Off by default to be less intrusive (don't want to give a notif that just says we couldnt help) NOTIFY_SLACKBOT_NO_ANSWER = ( os.environ.get("NOTIFY_SLACKBOT_NO_ANSWER", "").lower() == "true" ) # Mostly for debugging purposes but it's for explaining what went wrong -# if DanswerBot couldn't find an answer +# if OnyxBot couldn't find an answer DANSWER_BOT_DISPLAY_ERROR_MSGS = os.environ.get( "DANSWER_BOT_DISPLAY_ERROR_MSGS", "" ).lower() not in [ @@ -61,7 +61,7 @@ ) # DANSWER_BOT_RESPONSE_LIMIT_PER_TIME_PERIOD is the number of -# responses DanswerBot can send in a given time period. +# responses OnyxBot can send in a given time period. # Set to 0 to disable the limit. DANSWER_BOT_RESPONSE_LIMIT_PER_TIME_PERIOD = int( os.environ.get("DANSWER_BOT_RESPONSE_LIMIT_PER_TIME_PERIOD", "5000") diff --git a/backend/danswer/configs/tool_configs.py b/backend/onyx/configs/tool_configs.py similarity index 93% rename from backend/danswer/configs/tool_configs.py rename to backend/onyx/configs/tool_configs.py index 9e143301494..955d3af366e 100644 --- a/backend/danswer/configs/tool_configs.py +++ b/backend/onyx/configs/tool_configs.py @@ -16,7 +16,7 @@ ) except Exception: # need to import here to avoid circular imports - from danswer.utils.logger import setup_logger + from onyx.utils.logger import setup_logger logger = setup_logger() logger.error( diff --git a/backend/danswer/connectors/README.md b/backend/onyx/connectors/README.md similarity index 64% rename from backend/danswer/connectors/README.md rename to backend/onyx/connectors/README.md index 5a0fb1b2aef..b97e7afe698 100644 --- a/backend/danswer/connectors/README.md +++ b/backend/onyx/connectors/README.md @@ -1,21 +1,24 @@ - + -# Writing a new Danswer Connector -This README covers how to contribute a new Connector for Danswer. It includes an overview of the design, interfaces, +# Writing a new Onyx Connector + +This README covers how to contribute a new Connector for Onyx. It includes an overview of the design, interfaces, and required changes. Thank you for your contribution! ### Connector Overview + Connectors come in 3 different flows: + - Load Connector: - Bulk indexes documents to reflect a point in time. This type of connector generally works by either pulling all - documents via a connector's API or loads the documents from some sort of a dump file. + documents via a connector's API or loads the documents from some sort of a dump file. - Poll Connector: - Incrementally updates documents based on a provided time range. It is used by the background job to pull the latest - changes and additions since the last round of polling. This connector helps keep the document index up to date - without needing to fetch/embed/index every document which would be too slow to do frequently on large sets of - documents. + changes and additions since the last round of polling. This connector helps keep the document index up to date + without needing to fetch/embed/index every document which would be too slow to do frequently on large sets of + documents. - Slim Connector: - This connector should be a lighter weight method of checking all documents in the source to see if they still exist. - This connector should be identical to the Poll or Load Connector except that it only fetches the IDs of the documents, not the documents themselves. @@ -25,19 +28,19 @@ Connectors come in 3 different flows: - Connectors that listen to events and update documents accordingly. - Currently not used by the background job, this exists for future design purposes. - ### Connector Implementation -Refer to [interfaces.py](https://github.com/danswer-ai/danswer/blob/main/backend/danswer/connectors/interfaces.py) + +Refer to [interfaces.py](https://github.com/onyx-dot-app/onyx/blob/main/backend/onyx/connectors/interfaces.py) and this first contributor created Pull Request for a new connector (Shoutout to Dan Brown): -[Reference Pull Request](https://github.com/danswer-ai/danswer/pull/139) +[Reference Pull Request](https://github.com/onyx-dot-app/onyx/pull/139) For implementing a Slim Connector, refer to the comments in this PR: -[Slim Connector PR](https://github.com/danswer-ai/danswer/pull/3303/files) +[Slim Connector PR](https://github.com/onyx-dot-app/onyx/pull/3303/files) All new connectors should have tests added to the `backend/tests/daily/connectors` directory. Refer to the above PR for an example of adding tests for a new connector. - #### Implementing the new Connector + The connector must subclass one or more of LoadConnector, PollConnector, SlimConnector, or EventConnector. The `__init__` should take arguments for configuring what documents the connector will and where it finds those @@ -52,6 +55,7 @@ Refer to the existing connectors for `load_from_state` and `poll_source` example for EventConnector events, this will come down the line. #### Development Tip + It may be handy to test your new connector separate from the rest of the stack while developing. Follow the below template: @@ -64,33 +68,37 @@ if __name__ == "__main__": "access_token": "fake_token" }) all_docs = test_connector.load_from_state() - + current = time.time() one_day_ago = current - 24 * 60 * 60 # 1 day latest_docs = test_connector.poll_source(one_day_ago, current) ``` -> Note: Be sure to set PYTHONPATH to danswer/backend before running the above main. - +> Note: Be sure to set PYTHONPATH to onyx/backend before running the above main. ### Additional Required Changes: + #### Backend Changes + - Add a new type to -[DocumentSource](https://github.com/danswer-ai/danswer/blob/main/backend/danswer/configs/constants.py) + [DocumentSource](https://github.com/onyx-dot-app/onyx/blob/main/backend/onyx/configs/constants.py) - Add a mapping from DocumentSource (and optionally connector type) to the right connector class -[here](https://github.com/danswer-ai/danswer/blob/main/backend/danswer/connectors/factory.py#L33) + [here](https://github.com/onyx-dot-app/onyx/blob/main/backend/onyx/connectors/factory.py#L33) #### Frontend Changes -- Add the new Connector definition to the `SOURCE_METADATA_MAP` [here](https://github.com/danswer-ai/danswer/blob/main/web/src/lib/sources.ts#L59). -- Add the definition for the new Form to the `connectorConfigs` object [here](https://github.com/danswer-ai/danswer/blob/main/web/src/lib/connectors/connectors.ts#L79). + +- Add the new Connector definition to the `SOURCE_METADATA_MAP` [here](https://github.com/onyx-dot-app/onyx/blob/main/web/src/lib/sources.ts#L59). +- Add the definition for the new Form to the `connectorConfigs` object [here](https://github.com/onyx-dot-app/onyx/blob/main/web/src/lib/connectors/connectors.ts#L79). #### Docs Changes + Create the new connector page (with guiding images!) with how to get the connector credentials and how to set up the -connector in Danswer. Then create a Pull Request in https://github.com/danswer-ai/danswer-docs. +connector in Onyx. Then create a Pull Request in https://github.com/onyx-dot-app/onyx-docs. ### Before opening PR + 1. Be sure to fully test changes end to end with setting up the connector and updating the index with new docs from the -new connector. To make it easier to review, please attach a video showing the successful creation of the connector via the UI (starting from the `Add Connector` page). -2. Add a folder + tests under `backend/tests/daily/connectors` director. For an example, checkout the [test for Confluence](https://github.com/danswer-ai/danswer/blob/main/backend/tests/daily/connectors/confluence/test_confluence_basic.py). In the PR description, include a guide on how to setup the new source to pass the test. Before merging, we will re-create the environment and make sure the test(s) pass. + new connector. To make it easier to review, please attach a video showing the successful creation of the connector via the UI (starting from the `Add Connector` page). +2. Add a folder + tests under `backend/tests/daily/connectors` director. For an example, checkout the [test for Confluence](https://github.com/onyx-dot-app/onyx/blob/main/backend/tests/daily/connectors/confluence/test_confluence_basic.py). In the PR description, include a guide on how to setup the new source to pass the test. Before merging, we will re-create the environment and make sure the test(s) pass. 3. Be sure to run the linting/formatting, refer to the formatting and linting section in -[CONTRIBUTING.md](https://github.com/danswer-ai/danswer/blob/main/CONTRIBUTING.md#formatting-and-linting) + [CONTRIBUTING.md](https://github.com/onyx-dot-app/onyx/blob/main/CONTRIBUTING.md#formatting-and-linting) diff --git a/backend/danswer/connectors/file/__init__.py b/backend/onyx/connectors/__init__.py similarity index 100% rename from backend/danswer/connectors/file/__init__.py rename to backend/onyx/connectors/__init__.py diff --git a/backend/danswer/connectors/fireflies/__init__.py b/backend/onyx/connectors/asana/__init__.py similarity index 100% rename from backend/danswer/connectors/fireflies/__init__.py rename to backend/onyx/connectors/asana/__init__.py diff --git a/backend/danswer/connectors/asana/asana_api.py b/backend/onyx/connectors/asana/asana_api.py similarity index 99% rename from backend/danswer/connectors/asana/asana_api.py rename to backend/onyx/connectors/asana/asana_api.py index 57c470c4531..2270ee36b25 100755 --- a/backend/danswer/connectors/asana/asana_api.py +++ b/backend/onyx/connectors/asana/asana_api.py @@ -5,7 +5,7 @@ import asana # type: ignore -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/asana/connector.py b/backend/onyx/connectors/asana/connector.py similarity index 86% rename from backend/danswer/connectors/asana/connector.py rename to backend/onyx/connectors/asana/connector.py index 3e2c9a8aaf6..a13118d5443 100755 --- a/backend/danswer/connectors/asana/connector.py +++ b/backend/onyx/connectors/asana/connector.py @@ -1,17 +1,17 @@ import datetime from typing import Any -from danswer.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.asana import asana_api -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.asana import asana_api +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/github/__init__.py b/backend/onyx/connectors/axero/__init__.py similarity index 100% rename from backend/danswer/connectors/github/__init__.py rename to backend/onyx/connectors/axero/__init__.py diff --git a/backend/danswer/connectors/axero/connector.py b/backend/onyx/connectors/axero/connector.py similarity index 91% rename from backend/danswer/connectors/axero/connector.py rename to backend/onyx/connectors/axero/connector.py index 000151209de..8dd824b8333 100644 --- a/backend/danswer/connectors/axero/connector.py +++ b/backend/onyx/connectors/axero/connector.py @@ -6,24 +6,24 @@ import requests from pydantic import BaseModel -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import ( +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import ( process_in_batches, ) -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.cross_connector_utils.rate_limit_wrapper import ( +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.cross_connector_utils.rate_limit_wrapper import ( rate_limit_builder, ) -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.html_utils import parse_html_page_basic -from danswer.utils.logger import setup_logger -from danswer.utils.retry_wrapper import retry_builder +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.html_utils import parse_html_page_basic +from onyx.utils.logger import setup_logger +from onyx.utils.retry_wrapper import retry_builder logger = setup_logger() @@ -77,7 +77,7 @@ def _get_entities( # Axero limitations: # No next page token, can paginate but things may have changed - # for example, a doc that hasn't been read in by Danswer is updated and is now front of the list + # for example, a doc that hasn't been read in by Onyx is updated and is now front of the list # due to this limitation and the fact that Axero has no rate limiting but API calls can cause # increased latency for the team, we have to just fetch all the pages quickly to reduce the # chance of missing a document due to an update (it will still get updated next pass) diff --git a/backend/danswer/connectors/gitlab/__init__.py b/backend/onyx/connectors/blob/__init__.py similarity index 100% rename from backend/danswer/connectors/gitlab/__init__.py rename to backend/onyx/connectors/blob/__init__.py diff --git a/backend/danswer/connectors/blob/connector.py b/backend/onyx/connectors/blob/connector.py similarity index 93% rename from backend/danswer/connectors/blob/connector.py rename to backend/onyx/connectors/blob/connector.py index 20434c23075..674f1f82b7f 100644 --- a/backend/danswer/connectors/blob/connector.py +++ b/backend/onyx/connectors/blob/connector.py @@ -9,18 +9,18 @@ from botocore.client import Config # type: ignore from mypy_boto3_s3 import S3Client # type: ignore -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import BlobType -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.extract_file_text import extract_file_text -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import BlobType +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.extract_file_text import extract_file_text +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/gmail/__init__.py b/backend/onyx/connectors/bookstack/__init__.py similarity index 100% rename from backend/danswer/connectors/gmail/__init__.py rename to backend/onyx/connectors/bookstack/__init__.py diff --git a/backend/danswer/connectors/bookstack/client.py b/backend/onyx/connectors/bookstack/client.py similarity index 100% rename from backend/danswer/connectors/bookstack/client.py rename to backend/onyx/connectors/bookstack/client.py diff --git a/backend/danswer/connectors/bookstack/connector.py b/backend/onyx/connectors/bookstack/connector.py similarity index 90% rename from backend/danswer/connectors/bookstack/connector.py rename to backend/onyx/connectors/bookstack/connector.py index 9255bc3b8e5..a91936d8e3b 100644 --- a/backend/danswer/connectors/bookstack/connector.py +++ b/backend/onyx/connectors/bookstack/connector.py @@ -4,18 +4,18 @@ from datetime import datetime from typing import Any -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.bookstack.client import BookStackApiClient -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.html_utils import parse_html_page_basic +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.bookstack.client import BookStackApiClient +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.html_utils import parse_html_page_basic class BookstackConnector(LoadConnector, PollConnector): diff --git a/backend/danswer/connectors/gong/__init__.py b/backend/onyx/connectors/clickup/__init__.py similarity index 100% rename from backend/danswer/connectors/gong/__init__.py rename to backend/onyx/connectors/clickup/__init__.py diff --git a/backend/danswer/connectors/clickup/connector.py b/backend/onyx/connectors/clickup/connector.py similarity index 90% rename from backend/danswer/connectors/clickup/connector.py rename to backend/onyx/connectors/clickup/connector.py index 2ccc5ef4f65..2370629d1f1 100644 --- a/backend/danswer/connectors/clickup/connector.py +++ b/backend/onyx/connectors/clickup/connector.py @@ -5,20 +5,20 @@ import requests -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.rate_limit_wrapper import ( +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.rate_limit_wrapper import ( rate_limit_builder, ) -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.retry_wrapper import retry_builder +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.retry_wrapper import retry_builder CLICKUP_API_BASE_URL = "https://api.clickup.com/api/v2" diff --git a/backend/danswer/connectors/google_drive/__init__.py b/backend/onyx/connectors/confluence/__init__.py similarity index 100% rename from backend/danswer/connectors/google_drive/__init__.py rename to backend/onyx/connectors/confluence/__init__.py diff --git a/backend/danswer/connectors/confluence/connector.py b/backend/onyx/connectors/confluence/connector.py similarity index 88% rename from backend/danswer/connectors/confluence/connector.py rename to backend/onyx/connectors/confluence/connector.py index c909fe90219..6868dd795c2 100644 --- a/backend/danswer/connectors/confluence/connector.py +++ b/backend/onyx/connectors/confluence/connector.py @@ -4,30 +4,30 @@ from typing import Any from urllib.parse import quote -from danswer.configs.app_configs import CONFLUENCE_CONNECTOR_LABELS_TO_SKIP -from danswer.configs.app_configs import CONFLUENCE_TIMEZONE_OFFSET -from danswer.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.confluence.onyx_confluence import build_confluence_client -from danswer.connectors.confluence.onyx_confluence import OnyxConfluence -from danswer.connectors.confluence.utils import attachment_to_content -from danswer.connectors.confluence.utils import build_confluence_document_id -from danswer.connectors.confluence.utils import datetime_from_string -from danswer.connectors.confluence.utils import extract_text_from_confluence_html -from danswer.connectors.confluence.utils import validate_attachment_filetype -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import GenerateSlimDocumentOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.interfaces import SlimConnector -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.connectors.models import SlimDocument -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import CONFLUENCE_CONNECTOR_LABELS_TO_SKIP +from onyx.configs.app_configs import CONFLUENCE_TIMEZONE_OFFSET +from onyx.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.confluence.onyx_confluence import build_confluence_client +from onyx.connectors.confluence.onyx_confluence import OnyxConfluence +from onyx.connectors.confluence.utils import attachment_to_content +from onyx.connectors.confluence.utils import build_confluence_document_id +from onyx.connectors.confluence.utils import datetime_from_string +from onyx.connectors.confluence.utils import extract_text_from_confluence_html +from onyx.connectors.confluence.utils import validate_attachment_filetype +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import GenerateSlimDocumentOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.interfaces import SlimConnector +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.connectors.models import SlimDocument +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/confluence/onyx_confluence.py b/backend/onyx/connectors/confluence/onyx_confluence.py similarity index 99% rename from backend/danswer/connectors/confluence/onyx_confluence.py rename to backend/onyx/connectors/confluence/onyx_confluence.py index c6ffd5aa3fb..1ae765dca25 100644 --- a/backend/danswer/connectors/confluence/onyx_confluence.py +++ b/backend/onyx/connectors/confluence/onyx_confluence.py @@ -10,7 +10,7 @@ from atlassian import Confluence # type:ignore from requests import HTTPError -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/confluence/utils.py b/backend/onyx/connectors/confluence/utils.py similarity index 96% rename from backend/danswer/connectors/confluence/utils.py rename to backend/onyx/connectors/confluence/utils.py index 991d03e6571..fcb9474c704 100644 --- a/backend/danswer/connectors/confluence/utils.py +++ b/backend/onyx/connectors/confluence/utils.py @@ -6,16 +6,16 @@ import bs4 -from danswer.configs.app_configs import ( +from onyx.configs.app_configs import ( CONFLUENCE_CONNECTOR_ATTACHMENT_CHAR_COUNT_THRESHOLD, ) -from danswer.configs.app_configs import CONFLUENCE_CONNECTOR_ATTACHMENT_SIZE_THRESHOLD -from danswer.connectors.confluence.onyx_confluence import ( +from onyx.configs.app_configs import CONFLUENCE_CONNECTOR_ATTACHMENT_SIZE_THRESHOLD +from onyx.connectors.confluence.onyx_confluence import ( OnyxConfluence, ) -from danswer.file_processing.extract_file_text import extract_file_text -from danswer.file_processing.html_utils import format_document_soup -from danswer.utils.logger import setup_logger +from onyx.file_processing.extract_file_text import extract_file_text +from onyx.file_processing.html_utils import format_document_soup +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/connector_runner.py b/backend/onyx/connectors/connector_runner.py similarity index 88% rename from backend/danswer/connectors/connector_runner.py rename to backend/onyx/connectors/connector_runner.py index e5ad478fb7f..650aa76b127 100644 --- a/backend/danswer/connectors/connector_runner.py +++ b/backend/onyx/connectors/connector_runner.py @@ -1,11 +1,11 @@ import sys from datetime import datetime -from danswer.connectors.interfaces import BaseConnector -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.utils.logger import setup_logger +from onyx.connectors.interfaces import BaseConnector +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/google_site/__init__.py b/backend/onyx/connectors/cross_connector_utils/__init__.py similarity index 100% rename from backend/danswer/connectors/google_site/__init__.py rename to backend/onyx/connectors/cross_connector_utils/__init__.py diff --git a/backend/danswer/connectors/cross_connector_utils/miscellaneous_utils.py b/backend/onyx/connectors/cross_connector_utils/miscellaneous_utils.py similarity index 92% rename from backend/danswer/connectors/cross_connector_utils/miscellaneous_utils.py rename to backend/onyx/connectors/cross_connector_utils/miscellaneous_utils.py index 8e8ea8d7d65..2170ea7ba2c 100644 --- a/backend/danswer/connectors/cross_connector_utils/miscellaneous_utils.py +++ b/backend/onyx/connectors/cross_connector_utils/miscellaneous_utils.py @@ -6,9 +6,9 @@ from dateutil.parser import parse -from danswer.configs.constants import IGNORE_FOR_QA -from danswer.connectors.models import BasicExpertInfo -from danswer.utils.text_processing import is_valid_email +from onyx.configs.constants import IGNORE_FOR_QA +from onyx.connectors.models import BasicExpertInfo +from onyx.utils.text_processing import is_valid_email T = TypeVar("T") diff --git a/backend/danswer/connectors/cross_connector_utils/rate_limit_wrapper.py b/backend/onyx/connectors/cross_connector_utils/rate_limit_wrapper.py similarity index 98% rename from backend/danswer/connectors/cross_connector_utils/rate_limit_wrapper.py rename to backend/onyx/connectors/cross_connector_utils/rate_limit_wrapper.py index e3eeaaf617d..a93bf312057 100644 --- a/backend/danswer/connectors/cross_connector_utils/rate_limit_wrapper.py +++ b/backend/onyx/connectors/cross_connector_utils/rate_limit_wrapper.py @@ -7,7 +7,7 @@ import requests -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/google_utils/__init__.py b/backend/onyx/connectors/discourse/__init__.py similarity index 100% rename from backend/danswer/connectors/google_utils/__init__.py rename to backend/onyx/connectors/discourse/__init__.py diff --git a/backend/danswer/connectors/discourse/connector.py b/backend/onyx/connectors/discourse/connector.py similarity index 90% rename from backend/danswer/connectors/discourse/connector.py rename to backend/onyx/connectors/discourse/connector.py index d1b6395a189..fe03e9f82f4 100644 --- a/backend/danswer/connectors/discourse/connector.py +++ b/backend/onyx/connectors/discourse/connector.py @@ -8,22 +8,22 @@ from pydantic import BaseModel from requests import Response -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.cross_connector_utils.rate_limit_wrapper import ( +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.cross_connector_utils.rate_limit_wrapper import ( rate_limit_builder, ) -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.html_utils import parse_html_page_basic -from danswer.utils.logger import setup_logger -from danswer.utils.retry_wrapper import retry_builder +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.html_utils import parse_html_page_basic +from onyx.utils.logger import setup_logger +from onyx.utils.retry_wrapper import retry_builder logger = setup_logger() diff --git a/backend/danswer/connectors/guru/__init__.py b/backend/onyx/connectors/document360/__init__.py similarity index 100% rename from backend/danswer/connectors/guru/__init__.py rename to backend/onyx/connectors/document360/__init__.py diff --git a/backend/danswer/connectors/document360/connector.py b/backend/onyx/connectors/document360/connector.py similarity index 89% rename from backend/danswer/connectors/document360/connector.py rename to backend/onyx/connectors/document360/connector.py index 7ccf3c92e62..dbd287ae9a5 100644 --- a/backend/danswer/connectors/document360/connector.py +++ b/backend/onyx/connectors/document360/connector.py @@ -6,22 +6,22 @@ import requests -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.rate_limit_wrapper import ( +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.rate_limit_wrapper import ( rate_limit_builder, ) -from danswer.connectors.document360.utils import flatten_child_categories -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.html_utils import parse_html_page_basic -from danswer.utils.retry_wrapper import retry_builder +from onyx.connectors.document360.utils import flatten_child_categories +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.html_utils import parse_html_page_basic +from onyx.utils.retry_wrapper import retry_builder # Limitations and Potential Improvements # 1. The "Categories themselves contain potentially relevant information" but they're not pulled in diff --git a/backend/danswer/connectors/document360/utils.py b/backend/onyx/connectors/document360/utils.py similarity index 100% rename from backend/danswer/connectors/document360/utils.py rename to backend/onyx/connectors/document360/utils.py diff --git a/backend/danswer/connectors/hubspot/__init__.py b/backend/onyx/connectors/dropbox/__init__.py similarity index 100% rename from backend/danswer/connectors/hubspot/__init__.py rename to backend/onyx/connectors/dropbox/__init__.py diff --git a/backend/danswer/connectors/dropbox/connector.py b/backend/onyx/connectors/dropbox/connector.py similarity index 89% rename from backend/danswer/connectors/dropbox/connector.py rename to backend/onyx/connectors/dropbox/connector.py index 7d2eb0166c7..1a206068ab7 100644 --- a/backend/danswer/connectors/dropbox/connector.py +++ b/backend/onyx/connectors/dropbox/connector.py @@ -7,17 +7,17 @@ from dropbox.files import FileMetadata # type:ignore from dropbox.files import FolderMetadata # type:ignore -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.extract_file_text import extract_file_text -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.extract_file_text import extract_file_text +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/egnyte/connector.py b/backend/onyx/connectors/egnyte/connector.py similarity index 89% rename from backend/danswer/connectors/egnyte/connector.py rename to backend/onyx/connectors/egnyte/connector.py index 35e7c80e9d6..352a417eea2 100644 --- a/backend/danswer/connectors/egnyte/connector.py +++ b/backend/onyx/connectors/egnyte/connector.py @@ -11,28 +11,28 @@ import requests from retry import retry -from danswer.configs.app_configs import EGNYTE_BASE_DOMAIN -from danswer.configs.app_configs import EGNYTE_CLIENT_ID -from danswer.configs.app_configs import EGNYTE_CLIENT_SECRET -from danswer.configs.app_configs import EGNYTE_LOCALHOST_OVERRIDE -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import OAuthConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.extract_file_text import detect_encoding -from danswer.file_processing.extract_file_text import extract_file_text -from danswer.file_processing.extract_file_text import get_file_ext -from danswer.file_processing.extract_file_text import is_text_file_extension -from danswer.file_processing.extract_file_text import is_valid_file_ext -from danswer.file_processing.extract_file_text import read_text_file -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import EGNYTE_BASE_DOMAIN +from onyx.configs.app_configs import EGNYTE_CLIENT_ID +from onyx.configs.app_configs import EGNYTE_CLIENT_SECRET +from onyx.configs.app_configs import EGNYTE_LOCALHOST_OVERRIDE +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import OAuthConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.extract_file_text import detect_encoding +from onyx.file_processing.extract_file_text import extract_file_text +from onyx.file_processing.extract_file_text import get_file_ext +from onyx.file_processing.extract_file_text import is_text_file_extension +from onyx.file_processing.extract_file_text import is_valid_file_ext +from onyx.file_processing.extract_file_text import read_text_file +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -118,7 +118,7 @@ def _process_egnyte_file( if is_text_file_extension(file_name): encoding = detect_encoding(file_content) file_content_raw, file_metadata = read_text_file( - file_content, encoding=encoding, ignore_danswer_metadata=False + file_content, encoding=encoding, ignore_onyx_metadata=False ) else: file_content_raw = extract_file_text( diff --git a/backend/danswer/connectors/factory.py b/backend/onyx/connectors/factory.py similarity index 58% rename from backend/danswer/connectors/factory.py rename to backend/onyx/connectors/factory.py index 241d5ed81ce..5da314d58a2 100644 --- a/backend/danswer/connectors/factory.py +++ b/backend/onyx/connectors/factory.py @@ -3,52 +3,52 @@ from sqlalchemy.orm import Session -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import DocumentSourceRequiringTenantContext -from danswer.connectors.asana.connector import AsanaConnector -from danswer.connectors.axero.connector import AxeroConnector -from danswer.connectors.blob.connector import BlobStorageConnector -from danswer.connectors.bookstack.connector import BookstackConnector -from danswer.connectors.clickup.connector import ClickupConnector -from danswer.connectors.confluence.connector import ConfluenceConnector -from danswer.connectors.danswer_jira.connector import JiraConnector -from danswer.connectors.discourse.connector import DiscourseConnector -from danswer.connectors.document360.connector import Document360Connector -from danswer.connectors.dropbox.connector import DropboxConnector -from danswer.connectors.egnyte.connector import EgnyteConnector -from danswer.connectors.file.connector import LocalFileConnector -from danswer.connectors.fireflies.connector import FirefliesConnector -from danswer.connectors.freshdesk.connector import FreshdeskConnector -from danswer.connectors.github.connector import GithubConnector -from danswer.connectors.gitlab.connector import GitlabConnector -from danswer.connectors.gmail.connector import GmailConnector -from danswer.connectors.gong.connector import GongConnector -from danswer.connectors.google_drive.connector import GoogleDriveConnector -from danswer.connectors.google_site.connector import GoogleSitesConnector -from danswer.connectors.guru.connector import GuruConnector -from danswer.connectors.hubspot.connector import HubSpotConnector -from danswer.connectors.interfaces import BaseConnector -from danswer.connectors.interfaces import EventConnector -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.linear.connector import LinearConnector -from danswer.connectors.loopio.connector import LoopioConnector -from danswer.connectors.mediawiki.wiki import MediaWikiConnector -from danswer.connectors.models import InputType -from danswer.connectors.notion.connector import NotionConnector -from danswer.connectors.productboard.connector import ProductboardConnector -from danswer.connectors.salesforce.connector import SalesforceConnector -from danswer.connectors.sharepoint.connector import SharepointConnector -from danswer.connectors.slab.connector import SlabConnector -from danswer.connectors.slack.connector import SlackPollConnector -from danswer.connectors.teams.connector import TeamsConnector -from danswer.connectors.web.connector import WebConnector -from danswer.connectors.wikipedia.connector import WikipediaConnector -from danswer.connectors.xenforo.connector import XenforoConnector -from danswer.connectors.zendesk.connector import ZendeskConnector -from danswer.connectors.zulip.connector import ZulipConnector -from danswer.db.credentials import backend_update_credential_json -from danswer.db.models import Credential +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import DocumentSourceRequiringTenantContext +from onyx.connectors.asana.connector import AsanaConnector +from onyx.connectors.axero.connector import AxeroConnector +from onyx.connectors.blob.connector import BlobStorageConnector +from onyx.connectors.bookstack.connector import BookstackConnector +from onyx.connectors.clickup.connector import ClickupConnector +from onyx.connectors.confluence.connector import ConfluenceConnector +from onyx.connectors.discourse.connector import DiscourseConnector +from onyx.connectors.document360.connector import Document360Connector +from onyx.connectors.dropbox.connector import DropboxConnector +from onyx.connectors.egnyte.connector import EgnyteConnector +from onyx.connectors.file.connector import LocalFileConnector +from onyx.connectors.fireflies.connector import FirefliesConnector +from onyx.connectors.freshdesk.connector import FreshdeskConnector +from onyx.connectors.github.connector import GithubConnector +from onyx.connectors.gitlab.connector import GitlabConnector +from onyx.connectors.gmail.connector import GmailConnector +from onyx.connectors.gong.connector import GongConnector +from onyx.connectors.google_drive.connector import GoogleDriveConnector +from onyx.connectors.google_site.connector import GoogleSitesConnector +from onyx.connectors.guru.connector import GuruConnector +from onyx.connectors.hubspot.connector import HubSpotConnector +from onyx.connectors.interfaces import BaseConnector +from onyx.connectors.interfaces import EventConnector +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.linear.connector import LinearConnector +from onyx.connectors.loopio.connector import LoopioConnector +from onyx.connectors.mediawiki.wiki import MediaWikiConnector +from onyx.connectors.models import InputType +from onyx.connectors.notion.connector import NotionConnector +from onyx.connectors.onyx_jira.connector import JiraConnector +from onyx.connectors.productboard.connector import ProductboardConnector +from onyx.connectors.salesforce.connector import SalesforceConnector +from onyx.connectors.sharepoint.connector import SharepointConnector +from onyx.connectors.slab.connector import SlabConnector +from onyx.connectors.slack.connector import SlackPollConnector +from onyx.connectors.teams.connector import TeamsConnector +from onyx.connectors.web.connector import WebConnector +from onyx.connectors.wikipedia.connector import WikipediaConnector +from onyx.connectors.xenforo.connector import XenforoConnector +from onyx.connectors.zendesk.connector import ZendeskConnector +from onyx.connectors.zulip.connector import ZulipConnector +from onyx.db.credentials import backend_update_credential_json +from onyx.db.models import Credential class ConnectorMissingException(Exception): diff --git a/backend/danswer/connectors/linear/__init__.py b/backend/onyx/connectors/file/__init__.py similarity index 100% rename from backend/danswer/connectors/linear/__init__.py rename to backend/onyx/connectors/file/__init__.py diff --git a/backend/danswer/connectors/file/connector.py b/backend/onyx/connectors/file/connector.py similarity index 82% rename from backend/danswer/connectors/file/connector.py rename to backend/onyx/connectors/file/connector.py index 70b7219f65a..a32b3add470 100644 --- a/backend/danswer/connectors/file/connector.py +++ b/backend/onyx/connectors/file/connector.py @@ -8,25 +8,25 @@ from sqlalchemy.orm import Session -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.db.engine import get_session_with_tenant -from danswer.file_processing.extract_file_text import detect_encoding -from danswer.file_processing.extract_file_text import extract_file_text -from danswer.file_processing.extract_file_text import get_file_ext -from danswer.file_processing.extract_file_text import is_text_file_extension -from danswer.file_processing.extract_file_text import is_valid_file_ext -from danswer.file_processing.extract_file_text import load_files_from_zip -from danswer.file_processing.extract_file_text import read_pdf_file -from danswer.file_processing.extract_file_text import read_text_file -from danswer.file_store.file_store import get_default_file_store -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.db.engine import get_session_with_tenant +from onyx.file_processing.extract_file_text import detect_encoding +from onyx.file_processing.extract_file_text import extract_file_text +from onyx.file_processing.extract_file_text import get_file_ext +from onyx.file_processing.extract_file_text import is_text_file_extension +from onyx.file_processing.extract_file_text import is_valid_file_ext +from onyx.file_processing.extract_file_text import load_files_from_zip +from onyx.file_processing.extract_file_text import read_pdf_file +from onyx.file_processing.extract_file_text import read_text_file +from onyx.file_store.file_store import get_default_file_store +from onyx.utils.logger import setup_logger from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR @@ -72,7 +72,7 @@ def _process_file( if is_text_file_extension(file_name): encoding = detect_encoding(file) file_content_raw, file_metadata = read_text_file( - file, encoding=encoding, ignore_danswer_metadata=False + file, encoding=encoding, ignore_onyx_metadata=False ) # Using the PDF reader function directly to pass in password cleanly @@ -108,7 +108,7 @@ def _process_file( dt_str = all_metadata.get("doc_updated_at") final_time_updated = time_str_to_utc(dt_str) if dt_str else time_updated - # Metadata tags separate from the Danswer specific fields + # Metadata tags separate from the Onyx specific fields metadata_tags = { k: v for k, v in all_metadata.items() diff --git a/backend/danswer/connectors/loopio/__init__.py b/backend/onyx/connectors/fireflies/__init__.py similarity index 100% rename from backend/danswer/connectors/loopio/__init__.py rename to backend/onyx/connectors/fireflies/__init__.py diff --git a/backend/danswer/connectors/fireflies/connector.py b/backend/onyx/connectors/fireflies/connector.py similarity index 89% rename from backend/danswer/connectors/fireflies/connector.py rename to backend/onyx/connectors/fireflies/connector.py index 16ed7b2ede1..a9a02a54c41 100644 --- a/backend/danswer/connectors/fireflies/connector.py +++ b/backend/onyx/connectors/fireflies/connector.py @@ -5,17 +5,17 @@ import requests -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/freshdesk/__init__,py b/backend/onyx/connectors/freshdesk/__init__,py similarity index 100% rename from backend/danswer/connectors/freshdesk/__init__,py rename to backend/onyx/connectors/freshdesk/__init__,py diff --git a/backend/danswer/connectors/freshdesk/connector.py b/backend/onyx/connectors/freshdesk/connector.py similarity index 91% rename from backend/danswer/connectors/freshdesk/connector.py rename to backend/onyx/connectors/freshdesk/connector.py index db2a293e95f..96ea5abbe0d 100644 --- a/backend/danswer/connectors/freshdesk/connector.py +++ b/backend/onyx/connectors/freshdesk/connector.py @@ -6,17 +6,17 @@ import requests -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.html_utils import parse_html_page_basic -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.html_utils import parse_html_page_basic +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/mediawiki/__init__.py b/backend/onyx/connectors/github/__init__.py similarity index 100% rename from backend/danswer/connectors/mediawiki/__init__.py rename to backend/onyx/connectors/github/__init__.py diff --git a/backend/danswer/connectors/github/connector.py b/backend/onyx/connectors/github/connector.py similarity index 92% rename from backend/danswer/connectors/github/connector.py rename to backend/onyx/connectors/github/connector.py index aa72a3bef6e..d466e9de14f 100644 --- a/backend/danswer/connectors/github/connector.py +++ b/backend/onyx/connectors/github/connector.py @@ -13,18 +13,18 @@ from github.PaginatedList import PaginatedList from github.PullRequest import PullRequest -from danswer.configs.app_configs import GITHUB_CONNECTOR_BASE_URL -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.batching import batch_generator -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import GITHUB_CONNECTOR_BASE_URL +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.batching import batch_generator +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/notion/__init__.py b/backend/onyx/connectors/gitlab/__init__.py similarity index 100% rename from backend/danswer/connectors/notion/__init__.py rename to backend/onyx/connectors/gitlab/__init__.py diff --git a/backend/danswer/connectors/gitlab/connector.py b/backend/onyx/connectors/gitlab/connector.py similarity index 92% rename from backend/danswer/connectors/gitlab/connector.py rename to backend/onyx/connectors/gitlab/connector.py index 39ec443e709..ffd01805b94 100644 --- a/backend/danswer/connectors/gitlab/connector.py +++ b/backend/onyx/connectors/gitlab/connector.py @@ -11,18 +11,18 @@ import pytz from gitlab.v4.objects import Project -from danswer.configs.app_configs import GITLAB_CONNECTOR_INCLUDE_CODE_FILES -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import GITLAB_CONNECTOR_INCLUDE_CODE_FILES +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/productboard/__init__.py b/backend/onyx/connectors/gmail/__init__.py similarity index 100% rename from backend/danswer/connectors/productboard/__init__.py rename to backend/onyx/connectors/gmail/__init__.py diff --git a/backend/danswer/connectors/gmail/connector.py b/backend/onyx/connectors/gmail/connector.py similarity index 88% rename from backend/danswer/connectors/gmail/connector.py rename to backend/onyx/connectors/gmail/connector.py index 170e1219e11..aa87b803222 100644 --- a/backend/danswer/connectors/gmail/connector.py +++ b/backend/onyx/connectors/gmail/connector.py @@ -5,32 +5,32 @@ from google.oauth2.credentials import Credentials as OAuthCredentials # type: ignore from google.oauth2.service_account import Credentials as ServiceAccountCredentials # type: ignore -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.google_utils.google_auth import get_google_creds -from danswer.connectors.google_utils.google_utils import execute_paginated_retrieval -from danswer.connectors.google_utils.resources import get_admin_service -from danswer.connectors.google_utils.resources import get_gmail_service -from danswer.connectors.google_utils.shared_constants import ( +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.google_utils.google_auth import get_google_creds +from onyx.connectors.google_utils.google_utils import execute_paginated_retrieval +from onyx.connectors.google_utils.resources import get_admin_service +from onyx.connectors.google_utils.resources import get_gmail_service +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_PRIMARY_ADMIN_KEY, ) -from danswer.connectors.google_utils.shared_constants import MISSING_SCOPES_ERROR_STR -from danswer.connectors.google_utils.shared_constants import ONYX_SCOPE_INSTRUCTIONS -from danswer.connectors.google_utils.shared_constants import SLIM_BATCH_SIZE -from danswer.connectors.google_utils.shared_constants import USER_FIELDS -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import GenerateSlimDocumentOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.interfaces import SlimConnector -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.connectors.models import SlimDocument -from danswer.utils.logger import setup_logger -from danswer.utils.retry_wrapper import retry_builder +from onyx.connectors.google_utils.shared_constants import MISSING_SCOPES_ERROR_STR +from onyx.connectors.google_utils.shared_constants import ONYX_SCOPE_INSTRUCTIONS +from onyx.connectors.google_utils.shared_constants import SLIM_BATCH_SIZE +from onyx.connectors.google_utils.shared_constants import USER_FIELDS +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import GenerateSlimDocumentOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.interfaces import SlimConnector +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.connectors.models import SlimDocument +from onyx.utils.logger import setup_logger +from onyx.utils.retry_wrapper import retry_builder logger = setup_logger() diff --git a/backend/danswer/connectors/requesttracker/__init__.py b/backend/onyx/connectors/gong/__init__.py similarity index 100% rename from backend/danswer/connectors/requesttracker/__init__.py rename to backend/onyx/connectors/gong/__init__.py diff --git a/backend/danswer/connectors/gong/connector.py b/backend/onyx/connectors/gong/connector.py similarity index 94% rename from backend/danswer/connectors/gong/connector.py rename to backend/onyx/connectors/gong/connector.py index 56c93f57d50..16bc5c2a667 100644 --- a/backend/danswer/connectors/gong/connector.py +++ b/backend/onyx/connectors/gong/connector.py @@ -8,18 +8,18 @@ import requests -from danswer.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE -from danswer.configs.app_configs import GONG_CONNECTOR_START_TIME -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE +from onyx.configs.app_configs import GONG_CONNECTOR_START_TIME +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/salesforce/__init__.py b/backend/onyx/connectors/google_drive/__init__.py similarity index 100% rename from backend/danswer/connectors/salesforce/__init__.py rename to backend/onyx/connectors/google_drive/__init__.py diff --git a/backend/danswer/connectors/google_drive/connector.py b/backend/onyx/connectors/google_drive/connector.py similarity index 90% rename from backend/danswer/connectors/google_drive/connector.py rename to backend/onyx/connectors/google_drive/connector.py index 771f9239e98..cc999c01d63 100644 --- a/backend/danswer/connectors/google_drive/connector.py +++ b/backend/onyx/connectors/google_drive/connector.py @@ -9,38 +9,38 @@ from google.oauth2.credentials import Credentials as OAuthCredentials # type: ignore from google.oauth2.service_account import Credentials as ServiceAccountCredentials # type: ignore -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.app_configs import MAX_FILE_SIZE_BYTES -from danswer.configs.constants import DocumentSource -from danswer.connectors.google_drive.doc_conversion import build_slim_document -from danswer.connectors.google_drive.doc_conversion import ( +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.app_configs import MAX_FILE_SIZE_BYTES +from onyx.configs.constants import DocumentSource +from onyx.connectors.google_drive.doc_conversion import build_slim_document +from onyx.connectors.google_drive.doc_conversion import ( convert_drive_item_to_document, ) -from danswer.connectors.google_drive.file_retrieval import crawl_folders_for_files -from danswer.connectors.google_drive.file_retrieval import get_all_files_for_oauth -from danswer.connectors.google_drive.file_retrieval import get_all_files_in_my_drive -from danswer.connectors.google_drive.file_retrieval import get_files_in_shared_drive -from danswer.connectors.google_drive.models import GoogleDriveFileType -from danswer.connectors.google_utils.google_auth import get_google_creds -from danswer.connectors.google_utils.google_utils import execute_paginated_retrieval -from danswer.connectors.google_utils.resources import get_admin_service -from danswer.connectors.google_utils.resources import get_drive_service -from danswer.connectors.google_utils.resources import get_google_docs_service -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_drive.file_retrieval import crawl_folders_for_files +from onyx.connectors.google_drive.file_retrieval import get_all_files_for_oauth +from onyx.connectors.google_drive.file_retrieval import get_all_files_in_my_drive +from onyx.connectors.google_drive.file_retrieval import get_files_in_shared_drive +from onyx.connectors.google_drive.models import GoogleDriveFileType +from onyx.connectors.google_utils.google_auth import get_google_creds +from onyx.connectors.google_utils.google_utils import execute_paginated_retrieval +from onyx.connectors.google_utils.resources import get_admin_service +from onyx.connectors.google_utils.resources import get_drive_service +from onyx.connectors.google_utils.resources import get_google_docs_service +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_PRIMARY_ADMIN_KEY, ) -from danswer.connectors.google_utils.shared_constants import MISSING_SCOPES_ERROR_STR -from danswer.connectors.google_utils.shared_constants import ONYX_SCOPE_INSTRUCTIONS -from danswer.connectors.google_utils.shared_constants import SCOPE_DOC_URL -from danswer.connectors.google_utils.shared_constants import SLIM_BATCH_SIZE -from danswer.connectors.google_utils.shared_constants import USER_FIELDS -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import GenerateSlimDocumentOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.interfaces import SlimConnector -from danswer.utils.logger import setup_logger +from onyx.connectors.google_utils.shared_constants import MISSING_SCOPES_ERROR_STR +from onyx.connectors.google_utils.shared_constants import ONYX_SCOPE_INSTRUCTIONS +from onyx.connectors.google_utils.shared_constants import SCOPE_DOC_URL +from onyx.connectors.google_utils.shared_constants import SLIM_BATCH_SIZE +from onyx.connectors.google_utils.shared_constants import USER_FIELDS +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import GenerateSlimDocumentOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.interfaces import SlimConnector +from onyx.utils.logger import setup_logger logger = setup_logger() # TODO: Improve this by using the batch utility: https://googleapis.github.io/google-api-python-client/docs/batch.html diff --git a/backend/danswer/connectors/google_drive/constants.py b/backend/onyx/connectors/google_drive/constants.py similarity index 100% rename from backend/danswer/connectors/google_drive/constants.py rename to backend/onyx/connectors/google_drive/constants.py diff --git a/backend/danswer/connectors/google_drive/doc_conversion.py b/backend/onyx/connectors/google_drive/doc_conversion.py similarity index 87% rename from backend/danswer/connectors/google_drive/doc_conversion.py rename to backend/onyx/connectors/google_drive/doc_conversion.py index a3febd9d172..440e576e0d3 100644 --- a/backend/danswer/connectors/google_drive/doc_conversion.py +++ b/backend/onyx/connectors/google_drive/doc_conversion.py @@ -5,26 +5,26 @@ from googleapiclient.discovery import build # type: ignore from googleapiclient.errors import HttpError # type: ignore -from danswer.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import IGNORE_FOR_QA -from danswer.connectors.google_drive.constants import DRIVE_FOLDER_TYPE -from danswer.connectors.google_drive.constants import DRIVE_SHORTCUT_TYPE -from danswer.connectors.google_drive.constants import UNSUPPORTED_FILE_TYPE_CONTENT -from danswer.connectors.google_drive.models import GDriveMimeType -from danswer.connectors.google_drive.models import GoogleDriveFileType -from danswer.connectors.google_drive.section_extraction import get_document_sections -from danswer.connectors.google_utils.resources import GoogleDocsService -from danswer.connectors.google_utils.resources import GoogleDriveService -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.connectors.models import SlimDocument -from danswer.file_processing.extract_file_text import docx_to_text -from danswer.file_processing.extract_file_text import pptx_to_text -from danswer.file_processing.extract_file_text import read_pdf_file -from danswer.file_processing.unstructured import get_unstructured_api_key -from danswer.file_processing.unstructured import unstructured_to_text -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import IGNORE_FOR_QA +from onyx.connectors.google_drive.constants import DRIVE_FOLDER_TYPE +from onyx.connectors.google_drive.constants import DRIVE_SHORTCUT_TYPE +from onyx.connectors.google_drive.constants import UNSUPPORTED_FILE_TYPE_CONTENT +from onyx.connectors.google_drive.models import GDriveMimeType +from onyx.connectors.google_drive.models import GoogleDriveFileType +from onyx.connectors.google_drive.section_extraction import get_document_sections +from onyx.connectors.google_utils.resources import GoogleDocsService +from onyx.connectors.google_utils.resources import GoogleDriveService +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.connectors.models import SlimDocument +from onyx.file_processing.extract_file_text import docx_to_text +from onyx.file_processing.extract_file_text import pptx_to_text +from onyx.file_processing.extract_file_text import read_pdf_file +from onyx.file_processing.unstructured import get_unstructured_api_key +from onyx.file_processing.unstructured import unstructured_to_text +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/google_drive/file_retrieval.py b/backend/onyx/connectors/google_drive/file_retrieval.py similarity index 95% rename from backend/danswer/connectors/google_drive/file_retrieval.py rename to backend/onyx/connectors/google_drive/file_retrieval.py index 9b9b17a8c27..da5a4bf8d07 100644 --- a/backend/danswer/connectors/google_drive/file_retrieval.py +++ b/backend/onyx/connectors/google_drive/file_retrieval.py @@ -5,12 +5,12 @@ from googleapiclient.discovery import Resource # type: ignore -from danswer.connectors.google_drive.constants import DRIVE_FOLDER_TYPE -from danswer.connectors.google_drive.constants import DRIVE_SHORTCUT_TYPE -from danswer.connectors.google_drive.models import GoogleDriveFileType -from danswer.connectors.google_utils.google_utils import execute_paginated_retrieval -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.utils.logger import setup_logger +from onyx.connectors.google_drive.constants import DRIVE_FOLDER_TYPE +from onyx.connectors.google_drive.constants import DRIVE_SHORTCUT_TYPE +from onyx.connectors.google_drive.models import GoogleDriveFileType +from onyx.connectors.google_utils.google_utils import execute_paginated_retrieval +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/google_drive/models.py b/backend/onyx/connectors/google_drive/models.py similarity index 100% rename from backend/danswer/connectors/google_drive/models.py rename to backend/onyx/connectors/google_drive/models.py diff --git a/backend/danswer/connectors/google_drive/section_extraction.py b/backend/onyx/connectors/google_drive/section_extraction.py similarity index 96% rename from backend/danswer/connectors/google_drive/section_extraction.py rename to backend/onyx/connectors/google_drive/section_extraction.py index b5809204893..136a05eafd1 100644 --- a/backend/danswer/connectors/google_drive/section_extraction.py +++ b/backend/onyx/connectors/google_drive/section_extraction.py @@ -2,8 +2,8 @@ from pydantic import BaseModel -from danswer.connectors.google_utils.resources import GoogleDocsService -from danswer.connectors.models import Section +from onyx.connectors.google_utils.resources import GoogleDocsService +from onyx.connectors.models import Section class CurrentHeading(BaseModel): diff --git a/backend/danswer/connectors/sharepoint/__init__.py b/backend/onyx/connectors/google_site/__init__.py similarity index 100% rename from backend/danswer/connectors/sharepoint/__init__.py rename to backend/onyx/connectors/google_site/__init__.py diff --git a/backend/danswer/connectors/google_site/connector.py b/backend/onyx/connectors/google_site/connector.py similarity index 86% rename from backend/danswer/connectors/google_site/connector.py rename to backend/onyx/connectors/google_site/connector.py index 9cfcf224e3f..d38fee6ea6f 100644 --- a/backend/danswer/connectors/google_site/connector.py +++ b/backend/onyx/connectors/google_site/connector.py @@ -7,18 +7,18 @@ from bs4 import Tag from sqlalchemy.orm import Session -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.db.engine import get_sqlalchemy_engine -from danswer.file_processing.extract_file_text import load_files_from_zip -from danswer.file_processing.extract_file_text import read_text_file -from danswer.file_processing.html_utils import web_html_cleanup -from danswer.file_store.file_store import get_default_file_store -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.db.engine import get_sqlalchemy_engine +from onyx.file_processing.extract_file_text import load_files_from_zip +from onyx.file_processing.extract_file_text import read_text_file +from onyx.file_processing.html_utils import web_html_cleanup +from onyx.file_store.file_store import get_default_file_store +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/slab/__init__.py b/backend/onyx/connectors/google_utils/__init__.py similarity index 100% rename from backend/danswer/connectors/slab/__init__.py rename to backend/onyx/connectors/google_utils/__init__.py diff --git a/backend/danswer/connectors/google_utils/google_auth.py b/backend/onyx/connectors/google_utils/google_auth.py similarity index 91% rename from backend/danswer/connectors/google_utils/google_auth.py rename to backend/onyx/connectors/google_utils/google_auth.py index 6db789a0b1c..40210e6f332 100644 --- a/backend/danswer/connectors/google_utils/google_auth.py +++ b/backend/onyx/connectors/google_utils/google_auth.py @@ -5,28 +5,28 @@ from google.oauth2.credentials import Credentials as OAuthCredentials # type: ignore from google.oauth2.service_account import Credentials as ServiceAccountCredentials # type: ignore -from danswer.configs.constants import DocumentSource -from danswer.connectors.google_utils.shared_constants import ( +from ee.onyx.configs.app_configs import OAUTH_GOOGLE_DRIVE_CLIENT_ID +from ee.onyx.configs.app_configs import OAUTH_GOOGLE_DRIVE_CLIENT_SECRET +from onyx.configs.constants import DocumentSource +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_AUTHENTICATION_METHOD, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_TOKEN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_PRIMARY_ADMIN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( GOOGLE_SCOPES, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( GoogleOAuthAuthenticationMethod, ) -from danswer.utils.logger import setup_logger -from ee.danswer.configs.app_configs import OAUTH_GOOGLE_DRIVE_CLIENT_ID -from ee.danswer.configs.app_configs import OAUTH_GOOGLE_DRIVE_CLIENT_SECRET +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/google_utils/google_kv.py b/backend/onyx/connectors/google_utils/google_kv.py similarity index 79% rename from backend/danswer/connectors/google_utils/google_kv.py rename to backend/onyx/connectors/google_utils/google_kv.py index 8478deef4a8..96785e32544 100644 --- a/backend/danswer/connectors/google_utils/google_kv.py +++ b/backend/onyx/connectors/google_utils/google_kv.py @@ -8,46 +8,40 @@ from google_auth_oauthlib.flow import InstalledAppFlow # type: ignore from sqlalchemy.orm import Session -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import KV_CRED_KEY -from danswer.configs.constants import KV_GMAIL_CRED_KEY -from danswer.configs.constants import KV_GMAIL_SERVICE_ACCOUNT_KEY -from danswer.configs.constants import KV_GOOGLE_DRIVE_CRED_KEY -from danswer.configs.constants import KV_GOOGLE_DRIVE_SERVICE_ACCOUNT_KEY -from danswer.connectors.google_utils.resources import get_drive_service -from danswer.connectors.google_utils.resources import get_gmail_service -from danswer.connectors.google_utils.shared_constants import ( - DB_CREDENTIALS_AUTHENTICATION_METHOD, -) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import KV_CRED_KEY +from onyx.configs.constants import KV_GMAIL_CRED_KEY +from onyx.configs.constants import KV_GMAIL_SERVICE_ACCOUNT_KEY +from onyx.configs.constants import KV_GOOGLE_DRIVE_CRED_KEY +from onyx.configs.constants import KV_GOOGLE_DRIVE_SERVICE_ACCOUNT_KEY +from onyx.connectors.google_utils.resources import get_drive_service +from onyx.connectors.google_utils.resources import get_gmail_service +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_TOKEN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_PRIMARY_ADMIN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( GOOGLE_SCOPES, ) -from danswer.connectors.google_utils.shared_constants import ( - GoogleOAuthAuthenticationMethod, -) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( MISSING_SCOPES_ERROR_STR, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( ONYX_SCOPE_INSTRUCTIONS, ) -from danswer.db.credentials import update_credential_json -from danswer.db.models import User -from danswer.key_value_store.factory import get_kv_store -from danswer.server.documents.models import CredentialBase -from danswer.server.documents.models import GoogleAppCredentials -from danswer.server.documents.models import GoogleServiceAccountKey -from danswer.utils.logger import setup_logger +from onyx.db.credentials import update_credential_json +from onyx.db.models import User +from onyx.key_value_store.factory import get_kv_store +from onyx.server.documents.models import CredentialBase +from onyx.server.documents.models import GoogleAppCredentials +from onyx.server.documents.models import GoogleServiceAccountKey +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -102,7 +96,6 @@ def update_credential_access_tokens( user: User, db_session: Session, source: DocumentSource, - auth_method: GoogleOAuthAuthenticationMethod, ) -> OAuthCredentials | None: app_credentials = get_google_app_cred(source) flow = InstalledAppFlow.from_client_config( @@ -126,7 +119,6 @@ def update_credential_access_tokens( new_creds_dict = { DB_CREDENTIALS_DICT_TOKEN_KEY: token_json_str, DB_CREDENTIALS_PRIMARY_ADMIN_KEY: email, - DB_CREDENTIALS_AUTHENTICATION_METHOD: auth_method.value, } if not update_credential_json(credential_id, new_creds_dict, user, db_session): @@ -137,7 +129,6 @@ def update_credential_access_tokens( def build_service_account_creds( source: DocumentSource, primary_admin_email: str | None = None, - name: str | None = None, ) -> CredentialBase: service_account_key = get_service_account_key(source=source) @@ -147,15 +138,10 @@ def build_service_account_creds( if primary_admin_email: credential_dict[DB_CREDENTIALS_PRIMARY_ADMIN_KEY] = primary_admin_email - credential_dict[ - DB_CREDENTIALS_AUTHENTICATION_METHOD - ] = GoogleOAuthAuthenticationMethod.UPLOADED.value - return CredentialBase( credential_json=credential_dict, admin_public=True, source=source, - name=name, ) diff --git a/backend/danswer/connectors/google_utils/google_utils.py b/backend/onyx/connectors/google_utils/google_utils.py similarity index 96% rename from backend/danswer/connectors/google_utils/google_utils.py rename to backend/onyx/connectors/google_utils/google_utils.py index 59a56c8db80..f17ebe6ad58 100644 --- a/backend/danswer/connectors/google_utils/google_utils.py +++ b/backend/onyx/connectors/google_utils/google_utils.py @@ -8,9 +8,9 @@ from googleapiclient.errors import HttpError # type: ignore -from danswer.connectors.google_drive.models import GoogleDriveFileType -from danswer.utils.logger import setup_logger -from danswer.utils.retry_wrapper import retry_builder +from onyx.connectors.google_drive.models import GoogleDriveFileType +from onyx.utils.logger import setup_logger +from onyx.utils.retry_wrapper import retry_builder logger = setup_logger() diff --git a/backend/danswer/connectors/google_utils/resources.py b/backend/onyx/connectors/google_utils/resources.py similarity index 100% rename from backend/danswer/connectors/google_utils/resources.py rename to backend/onyx/connectors/google_utils/resources.py diff --git a/backend/danswer/connectors/google_utils/shared_constants.py b/backend/onyx/connectors/google_utils/shared_constants.py similarity index 94% rename from backend/danswer/connectors/google_utils/shared_constants.py rename to backend/onyx/connectors/google_utils/shared_constants.py index aebbab45142..9e1a7553692 100644 --- a/backend/danswer/connectors/google_utils/shared_constants.py +++ b/backend/onyx/connectors/google_utils/shared_constants.py @@ -1,6 +1,6 @@ from enum import Enum as PyEnum -from danswer.configs.constants import DocumentSource +from onyx.configs.constants import DocumentSource # NOTE: do not need https://www.googleapis.com/auth/documents.readonly # this is counted under `/auth/drive.readonly` @@ -12,7 +12,7 @@ "https://www.googleapis.com/auth/admin.directory.user.readonly", ], DocumentSource.GMAIL: [ - "https://www.googleapis.com/auth/gmail.readonly", + "https://www.googleapis.com/auth/gmail.readonfromly", "https://www.googleapis.com/auth/admin.directory.user.readonly", "https://www.googleapis.com/auth/admin.directory.group.readonly", ], diff --git a/backend/danswer/connectors/slack/__init__.py b/backend/onyx/connectors/guru/__init__.py similarity index 100% rename from backend/danswer/connectors/slack/__init__.py rename to backend/onyx/connectors/guru/__init__.py diff --git a/backend/danswer/connectors/guru/connector.py b/backend/onyx/connectors/guru/connector.py similarity index 86% rename from backend/danswer/connectors/guru/connector.py rename to backend/onyx/connectors/guru/connector.py index 510105b872f..b9f3bf597b9 100644 --- a/backend/danswer/connectors/guru/connector.py +++ b/backend/onyx/connectors/guru/connector.py @@ -5,19 +5,19 @@ import requests -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.html_utils import parse_html_page_basic -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.html_utils import parse_html_page_basic +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -88,7 +88,7 @@ def _process_cards( else None ) - # For Danswer, we decay document score overtime, either last_updated or + # For Onyx, we decay document score overtime, either last_updated or # last_verified is a good enough signal for the document's recency latest_time = ( max(last_verified, last_updated) if last_verified else last_updated diff --git a/backend/danswer/connectors/teams/__init__.py b/backend/onyx/connectors/hubspot/__init__.py similarity index 100% rename from backend/danswer/connectors/teams/__init__.py rename to backend/onyx/connectors/hubspot/__init__.py diff --git a/backend/danswer/connectors/hubspot/connector.py b/backend/onyx/connectors/hubspot/connector.py similarity index 89% rename from backend/danswer/connectors/hubspot/connector.py rename to backend/onyx/connectors/hubspot/connector.py index bd13c1e75b7..d769795598d 100644 --- a/backend/danswer/connectors/hubspot/connector.py +++ b/backend/onyx/connectors/hubspot/connector.py @@ -5,16 +5,16 @@ import requests from hubspot import HubSpot # type: ignore -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.logger import setup_logger HUBSPOT_BASE_URL = "https://app.hubspot.com/contacts/" HUBSPOT_API_URL = "https://api.hubapi.com/integrations/v1/me" diff --git a/backend/danswer/connectors/interfaces.py b/backend/onyx/connectors/interfaces.py similarity index 94% rename from backend/danswer/connectors/interfaces.py rename to backend/onyx/connectors/interfaces.py index 09884deb12d..e2726ee667e 100644 --- a/backend/danswer/connectors/interfaces.py +++ b/backend/onyx/connectors/interfaces.py @@ -2,9 +2,9 @@ from collections.abc import Iterator from typing import Any -from danswer.configs.constants import DocumentSource -from danswer.connectors.models import Document -from danswer.connectors.models import SlimDocument +from onyx.configs.constants import DocumentSource +from onyx.connectors.models import Document +from onyx.connectors.models import SlimDocument SecondsSinceUnixEpoch = float diff --git a/backend/danswer/connectors/web/__init__.py b/backend/onyx/connectors/linear/__init__.py similarity index 100% rename from backend/danswer/connectors/web/__init__.py rename to backend/onyx/connectors/linear/__init__.py diff --git a/backend/danswer/connectors/linear/connector.py b/backend/onyx/connectors/linear/connector.py similarity index 91% rename from backend/danswer/connectors/linear/connector.py rename to backend/onyx/connectors/linear/connector.py index c6da61555bd..b356026e0f5 100644 --- a/backend/danswer/connectors/linear/connector.py +++ b/backend/onyx/connectors/linear/connector.py @@ -6,17 +6,17 @@ import requests -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/wikipedia/__init__.py b/backend/onyx/connectors/loopio/__init__.py similarity index 100% rename from backend/danswer/connectors/wikipedia/__init__.py rename to backend/onyx/connectors/loopio/__init__.py diff --git a/backend/danswer/connectors/loopio/connector.py b/backend/onyx/connectors/loopio/connector.py similarity index 89% rename from backend/danswer/connectors/loopio/connector.py rename to backend/onyx/connectors/loopio/connector.py index d3bdfe503f7..acf8c9123cc 100644 --- a/backend/danswer/connectors/loopio/connector.py +++ b/backend/onyx/connectors/loopio/connector.py @@ -7,20 +7,20 @@ from oauthlib.oauth2 import BackendApplicationClient from requests_oauthlib import OAuth2Session # type: ignore -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.html_utils import parse_html_page_basic -from danswer.file_processing.html_utils import strip_excessive_newlines_and_spaces -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.html_utils import parse_html_page_basic +from onyx.file_processing.html_utils import strip_excessive_newlines_and_spaces +from onyx.utils.logger import setup_logger LOOPIO_API_BASE = "https://api.loopio.com/" LOOPIO_AUTH_URL = LOOPIO_API_BASE + "oauth2/access_token" @@ -140,7 +140,7 @@ def _process_entries( else None ) - # For Danswer, we decay document score overtime, either last_updated or + # For Onyx, we decay document score overtime, either last_updated or # last_reviewed is a good enough signal for the document's recency latest_time = ( max(last_reviewed, last_updated) if last_reviewed else last_updated diff --git a/backend/danswer/connectors/xenforo/__init__.py b/backend/onyx/connectors/mediawiki/__init__.py similarity index 100% rename from backend/danswer/connectors/xenforo/__init__.py rename to backend/onyx/connectors/mediawiki/__init__.py diff --git a/backend/danswer/connectors/mediawiki/family.py b/backend/onyx/connectors/mediawiki/family.py similarity index 99% rename from backend/danswer/connectors/mediawiki/family.py rename to backend/onyx/connectors/mediawiki/family.py index 7554dd0f3cd..a98bfe2d07c 100644 --- a/backend/danswer/connectors/mediawiki/family.py +++ b/backend/onyx/connectors/mediawiki/family.py @@ -14,7 +14,7 @@ from pywikibot.scripts import generate_family_file # type: ignore[import-untyped] from pywikibot.scripts.generate_user_files import pywikibot # type: ignore[import-untyped] -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/mediawiki/wiki.py b/backend/onyx/connectors/mediawiki/wiki.py similarity index 92% rename from backend/danswer/connectors/mediawiki/wiki.py rename to backend/onyx/connectors/mediawiki/wiki.py index 27edea871dc..5e11d438ad4 100644 --- a/backend/danswer/connectors/mediawiki/wiki.py +++ b/backend/onyx/connectors/mediawiki/wiki.py @@ -12,16 +12,16 @@ from pywikibot import pagegenerators # type: ignore[import-untyped] from pywikibot import textlib # type: ignore[import-untyped] -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.mediawiki.family import family_class_dispatch -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.mediawiki.family import family_class_dispatch +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -46,7 +46,7 @@ def pywikibot_timestamp_to_utc_datetime( def get_doc_from_page( page: pywikibot.Page, site: pywikibot.Site | None, source_type: DocumentSource ) -> Document: - """Generate Danswer Document from a MediaWiki page object. + """Generate Onyx Document from a MediaWiki page object. Args: page: Page from a MediaWiki site. diff --git a/backend/danswer/connectors/models.py b/backend/onyx/connectors/models.py similarity index 95% rename from backend/danswer/connectors/models.py rename to backend/onyx/connectors/models.py index ba1368dc944..474b8a186db 100644 --- a/backend/danswer/connectors/models.py +++ b/backend/onyx/connectors/models.py @@ -4,10 +4,10 @@ from pydantic import BaseModel -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import INDEX_SEPARATOR -from danswer.configs.constants import RETURN_SEPARATOR -from danswer.utils.text_processing import make_url_compatible +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import INDEX_SEPARATOR +from onyx.configs.constants import RETURN_SEPARATOR +from onyx.utils.text_processing import make_url_compatible class InputType(str, Enum): @@ -94,7 +94,7 @@ def __hash__(self) -> int: class DocumentBase(BaseModel): - """Used for Danswer ingestion api, the ID is inferred before use if not provided""" + """Used for Onyx ingestion api, the ID is inferred before use if not provided""" id: str | None = None sections: list[Section] diff --git a/backend/danswer/connectors/zendesk/__init__.py b/backend/onyx/connectors/notion/__init__.py similarity index 100% rename from backend/danswer/connectors/zendesk/__init__.py rename to backend/onyx/connectors/notion/__init__.py diff --git a/backend/danswer/connectors/notion/connector.py b/backend/onyx/connectors/notion/connector.py similarity index 95% rename from backend/danswer/connectors/notion/connector.py rename to backend/onyx/connectors/notion/connector.py index 4680c3d044b..ed753486f4e 100644 --- a/backend/danswer/connectors/notion/connector.py +++ b/backend/onyx/connectors/notion/connector.py @@ -9,20 +9,20 @@ from retry import retry -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.app_configs import NOTION_CONNECTOR_ENABLE_RECURSIVE_PAGE_LOOKUP -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.rate_limit_wrapper import ( +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.app_configs import NOTION_CONNECTOR_ENABLE_RECURSIVE_PAGE_LOOKUP +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.rate_limit_wrapper import ( rl_requests, ) -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.batching import batch_generator -from danswer.utils.logger import setup_logger +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.batching import batch_generator +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -132,7 +132,7 @@ def _fetch_child_blocks( logger.error( f"Unable to access block with ID '{block_id}'. " f"This is likely due to the block not being shared " - f"with the Danswer integration. Exact exception:\n\n{e}" + f"with the Onyx integration. Exact exception:\n\n{e}" ) else: logger.exception( @@ -210,7 +210,7 @@ def _fetch_database( logger.error( f"Unable to access database with ID '{database_id}'. " f"This is likely due to the database not being shared " - f"with the Danswer integration. Exact exception:\n{e}" + f"with the Onyx integration. Exact exception:\n{e}" ) return {"results": [], "next_cursor": None} logger.exception(f"Error fetching database - {res.json()}") @@ -354,7 +354,7 @@ def _read_blocks(self, base_block_id: str) -> tuple[list[NotionBlock], list[str] logger.warning( f"Skipping 'ai_block' ('{result_block_id}') for base block '{base_block_id}': " f"Notion API does not currently support reading AI blocks (as of 24/02/09) " - f"(discussion: https://github.com/danswer-ai/danswer/issues/1053)" + f"(discussion: https://github.com/onyx-dot-app/onyx/issues/1053)" ) continue @@ -362,7 +362,7 @@ def _read_blocks(self, base_block_id: str) -> tuple[list[NotionBlock], list[str] logger.warning( f"Skipping unsupported block type '{result_type}' " f"('{result_block_id}') for base block '{base_block_id}': " - f"(discussion: https://github.com/danswer-ai/danswer/issues/1230)" + f"(discussion: https://github.com/onyx-dot-app/onyx/issues/1230)" ) continue @@ -370,7 +370,7 @@ def _read_blocks(self, base_block_id: str) -> tuple[list[NotionBlock], list[str] logger.warning( f"Skipping 'external_object_instance_page' ('{result_block_id}') for base block '{base_block_id}': " f"Notion API does not currently support reading external blocks (as of 24/07/03) " - f"(discussion: https://github.com/danswer-ai/danswer/issues/1761)" + f"(discussion: https://github.com/onyx-dot-app/onyx/issues/1761)" ) continue diff --git a/backend/danswer/connectors/zulip/__init__.py b/backend/onyx/connectors/onyx_jira/__init__.py similarity index 100% rename from backend/danswer/connectors/zulip/__init__.py rename to backend/onyx/connectors/onyx_jira/__init__.py diff --git a/backend/danswer/connectors/danswer_jira/connector.py b/backend/onyx/connectors/onyx_jira/connector.py similarity index 85% rename from backend/danswer/connectors/danswer_jira/connector.py rename to backend/onyx/connectors/onyx_jira/connector.py index 1d20c608f89..c306649a51a 100644 --- a/backend/danswer/connectors/danswer_jira/connector.py +++ b/backend/onyx/connectors/onyx_jira/connector.py @@ -7,29 +7,29 @@ from jira import JIRA from jira.resources import Issue -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.app_configs import JIRA_CONNECTOR_LABELS_TO_SKIP -from danswer.configs.app_configs import JIRA_CONNECTOR_MAX_TICKET_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.danswer_jira.utils import best_effort_basic_expert_info -from danswer.connectors.danswer_jira.utils import best_effort_get_field_from_issue -from danswer.connectors.danswer_jira.utils import build_jira_client -from danswer.connectors.danswer_jira.utils import build_jira_url -from danswer.connectors.danswer_jira.utils import extract_jira_project -from danswer.connectors.danswer_jira.utils import extract_text_from_adf -from danswer.connectors.danswer_jira.utils import get_comment_strs -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import GenerateSlimDocumentOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.interfaces import SlimConnector -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.connectors.models import SlimDocument -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.app_configs import JIRA_CONNECTOR_LABELS_TO_SKIP +from onyx.configs.app_configs import JIRA_CONNECTOR_MAX_TICKET_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import GenerateSlimDocumentOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.interfaces import SlimConnector +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.connectors.models import SlimDocument +from onyx.connectors.onyx_jira.utils import best_effort_basic_expert_info +from onyx.connectors.onyx_jira.utils import best_effort_get_field_from_issue +from onyx.connectors.onyx_jira.utils import build_jira_client +from onyx.connectors.onyx_jira.utils import build_jira_url +from onyx.connectors.onyx_jira.utils import extract_jira_project +from onyx.connectors.onyx_jira.utils import extract_text_from_adf +from onyx.connectors.onyx_jira.utils import get_comment_strs +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/danswer_jira/utils.py b/backend/onyx/connectors/onyx_jira/utils.py similarity index 98% rename from backend/danswer/connectors/danswer_jira/utils.py rename to backend/onyx/connectors/onyx_jira/utils.py index 7fc3642b3a5..640ab7e5323 100644 --- a/backend/danswer/connectors/danswer_jira/utils.py +++ b/backend/onyx/connectors/onyx_jira/utils.py @@ -9,8 +9,8 @@ from jira.resources import Issue from jira.resources import User -from danswer.connectors.models import BasicExpertInfo -from danswer.utils.logger import setup_logger +from onyx.connectors.models import BasicExpertInfo +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/context/search/__init__.py b/backend/onyx/connectors/productboard/__init__.py similarity index 100% rename from backend/danswer/context/search/__init__.py rename to backend/onyx/connectors/productboard/__init__.py diff --git a/backend/danswer/connectors/productboard/connector.py b/backend/onyx/connectors/productboard/connector.py similarity index 94% rename from backend/danswer/connectors/productboard/connector.py rename to backend/onyx/connectors/productboard/connector.py index c7a2d45cae8..1f8e8adaf3a 100644 --- a/backend/danswer/connectors/productboard/connector.py +++ b/backend/onyx/connectors/productboard/connector.py @@ -8,16 +8,16 @@ from dateutil import parser from retry import retry -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/connectors/requesttracker/.gitignore b/backend/onyx/connectors/requesttracker/.gitignore similarity index 100% rename from backend/danswer/connectors/requesttracker/.gitignore rename to backend/onyx/connectors/requesttracker/.gitignore diff --git a/backend/danswer/danswerbot/slack/handlers/__init__.py b/backend/onyx/connectors/requesttracker/__init__.py similarity index 100% rename from backend/danswer/danswerbot/slack/handlers/__init__.py rename to backend/onyx/connectors/requesttracker/__init__.py diff --git a/backend/danswer/connectors/requesttracker/connector.py b/backend/onyx/connectors/requesttracker/connector.py similarity index 90% rename from backend/danswer/connectors/requesttracker/connector.py rename to backend/onyx/connectors/requesttracker/connector.py index b520d0d7acf..f35d48b296a 100644 --- a/backend/danswer/connectors/requesttracker/connector.py +++ b/backend/onyx/connectors/requesttracker/connector.py @@ -6,15 +6,15 @@ # from typing import Optional # from rt.rest1 import ALL_QUEUES # from rt.rest1 import Rt -# from danswer.configs.app_configs import INDEX_BATCH_SIZE -# from danswer.configs.constants import DocumentSource -# from danswer.connectors.interfaces import GenerateDocumentsOutput -# from danswer.connectors.interfaces import PollConnector -# from danswer.connectors.interfaces import SecondsSinceUnixEpoch -# from danswer.connectors.models import ConnectorMissingCredentialError -# from danswer.connectors.models import Document -# from danswer.connectors.models import Section -# from danswer.utils.logger import setup_logger +# from onyx.configs.app_configs import INDEX_BATCH_SIZE +# from onyx.configs.constants import DocumentSource +# from onyx.connectors.interfaces import GenerateDocumentsOutput +# from onyx.connectors.interfaces import PollConnector +# from onyx.connectors.interfaces import SecondsSinceUnixEpoch +# from onyx.connectors.models import ConnectorMissingCredentialError +# from onyx.connectors.models import Document +# from onyx.connectors.models import Section +# from onyx.utils.logger import setup_logger # logger = setup_logger() # class RequestTrackerError(Exception): # pass diff --git a/backend/danswer/db/__init__.py b/backend/onyx/connectors/salesforce/__init__.py similarity index 100% rename from backend/danswer/db/__init__.py rename to backend/onyx/connectors/salesforce/__init__.py diff --git a/backend/danswer/connectors/salesforce/connector.py b/backend/onyx/connectors/salesforce/connector.py similarity index 90% rename from backend/danswer/connectors/salesforce/connector.py rename to backend/onyx/connectors/salesforce/connector.py index 1e0fe9e1d3a..9f4ccdcb692 100644 --- a/backend/danswer/connectors/salesforce/connector.py +++ b/backend/onyx/connectors/salesforce/connector.py @@ -7,22 +7,22 @@ from simple_salesforce import Salesforce from simple_salesforce import SFType -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import GenerateSlimDocumentOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.interfaces import SlimConnector -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.connectors.models import SlimDocument -from danswer.connectors.salesforce.utils import extract_dict_text -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import GenerateSlimDocumentOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.interfaces import SlimConnector +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.connectors.models import SlimDocument +from onyx.connectors.salesforce.utils import extract_dict_text +from onyx.utils.logger import setup_logger # TODO: this connector does not work well at large scales @@ -88,7 +88,7 @@ def _convert_object_instance_to_document( raise ConnectorMissingCredentialError("Salesforce") salesforce_id = object_dict["Id"] - danswer_salesforce_id = f"{ID_PREFIX}{salesforce_id}" + onyx_salesforce_id = f"{ID_PREFIX}{salesforce_id}" extracted_link = f"https://{self.sf_client.sf_instance}/{salesforce_id}" extracted_doc_updated_at = time_str_to_utc(object_dict["LastModifiedDate"]) extracted_object_text = extract_dict_text(object_dict) @@ -100,7 +100,7 @@ def _convert_object_instance_to_document( ] doc = Document( - id=danswer_salesforce_id, + id=onyx_salesforce_id, sections=[Section(link=extracted_link, text=extracted_object_text)], source=DocumentSource.SALESFORCE, semantic_identifier=extracted_semantic_identifier, diff --git a/backend/danswer/connectors/salesforce/utils.py b/backend/onyx/connectors/salesforce/utils.py similarity index 100% rename from backend/danswer/connectors/salesforce/utils.py rename to backend/onyx/connectors/salesforce/utils.py diff --git a/backend/danswer/document_index/__init__.py b/backend/onyx/connectors/sharepoint/__init__.py similarity index 100% rename from backend/danswer/document_index/__init__.py rename to backend/onyx/connectors/sharepoint/__init__.py diff --git a/backend/danswer/connectors/sharepoint/connector.py b/backend/onyx/connectors/sharepoint/connector.py similarity index 91% rename from backend/danswer/connectors/sharepoint/connector.py rename to backend/onyx/connectors/sharepoint/connector.py index 8d99baffe33..b6912960a7b 100644 --- a/backend/danswer/connectors/sharepoint/connector.py +++ b/backend/onyx/connectors/sharepoint/connector.py @@ -12,18 +12,18 @@ from office365.onedrive.driveitems.driveItem import DriveItem # type: ignore from office365.onedrive.sites.site import Site # type: ignore -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.extract_file_text import extract_file_text -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.extract_file_text import extract_file_text +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/document_index/vespa/__init__.py b/backend/onyx/connectors/slab/__init__.py similarity index 100% rename from backend/danswer/document_index/vespa/__init__.py rename to backend/onyx/connectors/slab/__init__.py diff --git a/backend/danswer/connectors/slab/connector.py b/backend/onyx/connectors/slab/connector.py similarity index 91% rename from backend/danswer/connectors/slab/connector.py rename to backend/onyx/connectors/slab/connector.py index f60fb8cb6ed..d5a2c13c2be 100644 --- a/backend/danswer/connectors/slab/connector.py +++ b/backend/onyx/connectors/slab/connector.py @@ -9,19 +9,19 @@ import requests from dateutil import parser -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import GenerateSlimDocumentOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.interfaces import SlimConnector -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.connectors.models import SlimDocument -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import GenerateSlimDocumentOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.interfaces import SlimConnector +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.connectors.models import SlimDocument +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/file_processing/__init__.py b/backend/onyx/connectors/slack/__init__.py similarity index 100% rename from backend/danswer/file_processing/__init__.py rename to backend/onyx/connectors/slack/__init__.py diff --git a/backend/danswer/connectors/slack/connector.py b/backend/onyx/connectors/slack/connector.py similarity index 91% rename from backend/danswer/connectors/slack/connector.py rename to backend/onyx/connectors/slack/connector.py index 9135be77758..1a3885aa39f 100644 --- a/backend/danswer/connectors/slack/connector.py +++ b/backend/onyx/connectors/slack/connector.py @@ -9,25 +9,25 @@ from slack_sdk import WebClient from slack_sdk.errors import SlackApiError -from danswer.configs.app_configs import ENABLE_EXPENSIVE_EXPERT_CALLS -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import GenerateSlimDocumentOutput -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.interfaces import SlimConnector -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.connectors.models import SlimDocument -from danswer.connectors.slack.utils import expert_info_from_slack_id -from danswer.connectors.slack.utils import get_message_link -from danswer.connectors.slack.utils import make_paginated_slack_api_call_w_retries -from danswer.connectors.slack.utils import make_slack_api_call_w_retries -from danswer.connectors.slack.utils import SlackTextCleaner -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import ENABLE_EXPENSIVE_EXPERT_CALLS +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import GenerateSlimDocumentOutput +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.interfaces import SlimConnector +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.connectors.models import SlimDocument +from onyx.connectors.slack.utils import expert_info_from_slack_id +from onyx.connectors.slack.utils import get_message_link +from onyx.connectors.slack.utils import make_paginated_slack_api_call_w_retries +from onyx.connectors.slack.utils import make_slack_api_call_w_retries +from onyx.connectors.slack.utils import SlackTextCleaner +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -215,7 +215,7 @@ def thread_to_doc( def default_msg_filter(message: MessageType) -> bool: # Don't keep messages from bots if message.get("bot_id") or message.get("app_id"): - if message.get("bot_profile", {}).get("name") == "DanswerConnector": + if message.get("bot_profile", {}).get("name") == "OnyxConnector": return False return True diff --git a/backend/danswer/connectors/slack/utils.py b/backend/onyx/connectors/slack/utils.py similarity index 98% rename from backend/danswer/connectors/slack/utils.py rename to backend/onyx/connectors/slack/utils.py index 62ac749c166..e3e130165c0 100644 --- a/backend/danswer/connectors/slack/utils.py +++ b/backend/onyx/connectors/slack/utils.py @@ -11,9 +11,9 @@ from slack_sdk.errors import SlackApiError from slack_sdk.web import SlackResponse -from danswer.connectors.models import BasicExpertInfo -from danswer.utils.logger import setup_logger -from danswer.utils.retry_wrapper import retry_builder +from onyx.connectors.models import BasicExpertInfo +from onyx.utils.logger import setup_logger +from onyx.utils.retry_wrapper import retry_builder logger = setup_logger() diff --git a/backend/danswer/indexing/__init__.py b/backend/onyx/connectors/teams/__init__.py similarity index 100% rename from backend/danswer/indexing/__init__.py rename to backend/onyx/connectors/teams/__init__.py diff --git a/backend/danswer/connectors/teams/connector.py b/backend/onyx/connectors/teams/connector.py similarity index 92% rename from backend/danswer/connectors/teams/connector.py rename to backend/onyx/connectors/teams/connector.py index 847eb059205..166c43e42a4 100644 --- a/backend/danswer/connectors/teams/connector.py +++ b/backend/onyx/connectors/teams/connector.py @@ -9,19 +9,19 @@ from office365.teams.chats.messages.message import ChatMessage # type: ignore from office365.teams.team import Team # type: ignore -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.html_utils import parse_html_page_basic -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.html_utils import parse_html_page_basic +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/key_value_store/__init__.py b/backend/onyx/connectors/web/__init__.py similarity index 100% rename from backend/danswer/key_value_store/__init__.py rename to backend/onyx/connectors/web/__init__.py diff --git a/backend/danswer/connectors/web/connector.py b/backend/onyx/connectors/web/connector.py similarity index 91% rename from backend/danswer/connectors/web/connector.py rename to backend/onyx/connectors/web/connector.py index 3fdb5e2aa04..276ccdaf9af 100644 --- a/backend/danswer/connectors/web/connector.py +++ b/backend/onyx/connectors/web/connector.py @@ -19,21 +19,20 @@ from requests_oauthlib import OAuth2Session # type:ignore from urllib3.exceptions import MaxRetryError -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.app_configs import WEB_CONNECTOR_OAUTH_CLIENT_ID -from danswer.configs.app_configs import WEB_CONNECTOR_OAUTH_CLIENT_SECRET -from danswer.configs.app_configs import WEB_CONNECTOR_OAUTH_TOKEN_URL -from danswer.configs.app_configs import WEB_CONNECTOR_VALIDATE_URLS -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.extract_file_text import read_pdf_file -from danswer.file_processing.html_utils import web_html_cleanup -from danswer.utils.logger import setup_logger -from danswer.utils.sitemap import list_pages_for_site -from shared_configs.configs import MULTI_TENANT +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.app_configs import WEB_CONNECTOR_OAUTH_CLIENT_ID +from onyx.configs.app_configs import WEB_CONNECTOR_OAUTH_CLIENT_SECRET +from onyx.configs.app_configs import WEB_CONNECTOR_OAUTH_TOKEN_URL +from onyx.configs.app_configs import WEB_CONNECTOR_VALIDATE_URLS +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.extract_file_text import read_pdf_file +from onyx.file_processing.html_utils import web_html_cleanup +from onyx.utils.logger import setup_logger +from onyx.utils.sitemap import list_pages_for_site logger = setup_logger() @@ -242,12 +241,6 @@ def __init__( self.to_visit_list = extract_urls_from_sitemap(_ensure_valid_url(base_url)) elif web_connector_type == WEB_CONNECTOR_VALID_SETTINGS.UPLOAD: - # Explicitly check if running in multi-tenant mode to prevent potential security risks - if MULTI_TENANT: - raise ValueError( - "Upload input for web connector is not supported in cloud environments" - ) - logger.warning( "This is not a UI supported Web Connector flow, " "are you sure you want to do this?" @@ -404,6 +397,6 @@ def load_from_state(self) -> GenerateDocumentsOutput: if __name__ == "__main__": - connector = WebConnector("https://docs.danswer.dev/") + connector = WebConnector("https://docs.onyx.app/") document_batches = connector.load_from_state() print(next(document_batches)) diff --git a/backend/danswer/llm/__init__.py b/backend/onyx/connectors/wikipedia/__init__.py similarity index 100% rename from backend/danswer/llm/__init__.py rename to backend/onyx/connectors/wikipedia/__init__.py diff --git a/backend/danswer/connectors/wikipedia/connector.py b/backend/onyx/connectors/wikipedia/connector.py similarity index 80% rename from backend/danswer/connectors/wikipedia/connector.py rename to backend/onyx/connectors/wikipedia/connector.py index 109e647f113..ce0930a82de 100644 --- a/backend/danswer/connectors/wikipedia/connector.py +++ b/backend/onyx/connectors/wikipedia/connector.py @@ -1,8 +1,8 @@ from typing import ClassVar -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.mediawiki import wiki +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.mediawiki import wiki class WikipediaConnector(wiki.MediaWikiConnector): diff --git a/backend/danswer/natural_language_processing/__init__.py b/backend/onyx/connectors/xenforo/__init__.py similarity index 100% rename from backend/danswer/natural_language_processing/__init__.py rename to backend/onyx/connectors/xenforo/__init__.py diff --git a/backend/danswer/connectors/xenforo/connector.py b/backend/onyx/connectors/xenforo/connector.py similarity index 95% rename from backend/danswer/connectors/xenforo/connector.py rename to backend/onyx/connectors/xenforo/connector.py index 7f5221543f1..f460ab958fc 100644 --- a/backend/danswer/connectors/xenforo/connector.py +++ b/backend/onyx/connectors/xenforo/connector.py @@ -22,14 +22,14 @@ from bs4 import BeautifulSoup from bs4 import Tag -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import datetime_to_utc -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.utils.logger import setup_logger +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import datetime_to_utc +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/prompts/__init__.py b/backend/onyx/connectors/zendesk/__init__.py similarity index 100% rename from backend/danswer/prompts/__init__.py rename to backend/onyx/connectors/zendesk/__init__.py diff --git a/backend/danswer/connectors/zendesk/connector.py b/backend/onyx/connectors/zendesk/connector.py similarity index 94% rename from backend/danswer/connectors/zendesk/connector.py rename to backend/onyx/connectors/zendesk/connector.py index 170da788a76..05ab979862f 100644 --- a/backend/danswer/connectors/zendesk/connector.py +++ b/backend/onyx/connectors/zendesk/connector.py @@ -3,21 +3,21 @@ import requests -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.app_configs import ZENDESK_CONNECTOR_SKIP_ARTICLE_LABELS -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import ( +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.app_configs import ZENDESK_CONNECTOR_SKIP_ARTICLE_LABELS +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import ( time_str_to_utc, ) -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import BasicExpertInfo -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.file_processing.html_utils import parse_html_page_basic -from danswer.utils.retry_wrapper import retry_builder +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import BasicExpertInfo +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.file_processing.html_utils import parse_html_page_basic +from onyx.utils.retry_wrapper import retry_builder MAX_PAGE_SIZE = 30 # Zendesk API maximum diff --git a/backend/danswer/secondary_llm_flows/__init__.py b/backend/onyx/connectors/zulip/__init__.py similarity index 100% rename from backend/danswer/secondary_llm_flows/__init__.py rename to backend/onyx/connectors/zulip/__init__.py diff --git a/backend/danswer/connectors/zulip/connector.py b/backend/onyx/connectors/zulip/connector.py similarity index 84% rename from backend/danswer/connectors/zulip/connector.py rename to backend/onyx/connectors/zulip/connector.py index f1d47c57e1a..8c586fc647f 100644 --- a/backend/danswer/connectors/zulip/connector.py +++ b/backend/onyx/connectors/zulip/connector.py @@ -7,21 +7,21 @@ from zulip import Client -from danswer.configs.app_configs import INDEX_BATCH_SIZE -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import GenerateDocumentsOutput -from danswer.connectors.interfaces import LoadConnector -from danswer.connectors.interfaces import PollConnector -from danswer.connectors.interfaces import SecondsSinceUnixEpoch -from danswer.connectors.models import ConnectorMissingCredentialError -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.connectors.zulip.schemas import GetMessagesResponse -from danswer.connectors.zulip.schemas import Message -from danswer.connectors.zulip.utils import build_search_narrow -from danswer.connectors.zulip.utils import call_api -from danswer.connectors.zulip.utils import encode_zulip_narrow_operand -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import INDEX_BATCH_SIZE +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import GenerateDocumentsOutput +from onyx.connectors.interfaces import LoadConnector +from onyx.connectors.interfaces import PollConnector +from onyx.connectors.interfaces import SecondsSinceUnixEpoch +from onyx.connectors.models import ConnectorMissingCredentialError +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.connectors.zulip.schemas import GetMessagesResponse +from onyx.connectors.zulip.schemas import Message +from onyx.connectors.zulip.utils import build_search_narrow +from onyx.connectors.zulip.utils import call_api +from onyx.connectors.zulip.utils import encode_zulip_narrow_operand +from onyx.utils.logger import setup_logger # Potential improvements # 1. Group documents messages into topics, make 1 document per topic per week diff --git a/backend/danswer/connectors/zulip/schemas.py b/backend/onyx/connectors/zulip/schemas.py similarity index 100% rename from backend/danswer/connectors/zulip/schemas.py rename to backend/onyx/connectors/zulip/schemas.py diff --git a/backend/danswer/connectors/zulip/utils.py b/backend/onyx/connectors/zulip/utils.py similarity index 98% rename from backend/danswer/connectors/zulip/utils.py rename to backend/onyx/connectors/zulip/utils.py index ffb3894e8ad..b484f66c723 100644 --- a/backend/danswer/connectors/zulip/utils.py +++ b/backend/onyx/connectors/zulip/utils.py @@ -5,7 +5,7 @@ from typing import Optional from urllib.parse import quote -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/seeding/__init__.py b/backend/onyx/context/search/__init__.py similarity index 100% rename from backend/danswer/seeding/__init__.py rename to backend/onyx/context/search/__init__.py diff --git a/backend/danswer/context/search/enums.py b/backend/onyx/context/search/enums.py similarity index 100% rename from backend/danswer/context/search/enums.py rename to backend/onyx/context/search/enums.py diff --git a/backend/danswer/context/search/models.py b/backend/onyx/context/search/models.py similarity index 95% rename from backend/danswer/context/search/models.py rename to backend/onyx/context/search/models.py index 73ef28dc3b6..7eeb3568695 100644 --- a/backend/danswer/context/search/models.py +++ b/backend/onyx/context/search/models.py @@ -6,15 +6,15 @@ from pydantic import Field from pydantic import field_validator -from danswer.configs.chat_configs import NUM_RETURNED_HITS -from danswer.configs.constants import DocumentSource -from danswer.context.search.enums import LLMEvaluationType -from danswer.context.search.enums import OptionalSearchSetting -from danswer.context.search.enums import SearchType -from danswer.db.models import Persona -from danswer.db.models import SearchSettings -from danswer.indexing.models import BaseChunk -from danswer.indexing.models import IndexingSetting +from onyx.configs.chat_configs import NUM_RETURNED_HITS +from onyx.configs.constants import DocumentSource +from onyx.context.search.enums import LLMEvaluationType +from onyx.context.search.enums import OptionalSearchSetting +from onyx.context.search.enums import SearchType +from onyx.db.models import Persona +from onyx.db.models import SearchSettings +from onyx.indexing.models import BaseChunk +from onyx.indexing.models import IndexingSetting from shared_configs.enums import RerankerProvider @@ -177,7 +177,7 @@ class RetrievalDetails(ChunkContext): # If the Persona is configured to not run search (0 chunks), this is bypassed # If no Prompt is configured, the only search results are shown, this is bypassed run_search: OptionalSearchSetting = OptionalSearchSetting.ALWAYS - # Is this a real-time/streaming call or a question where Danswer can take more time? + # Is this a real-time/streaming call or a question where Onyx can take more time? # Used to determine reranking flow real_time: bool = True # The following have defaults in the Persona settings which can be overridden via diff --git a/backend/danswer/context/search/pipeline.py b/backend/onyx/context/search/pipeline.py similarity index 88% rename from backend/danswer/context/search/pipeline.py rename to backend/onyx/context/search/pipeline.py index 52748514003..be7e288799a 100644 --- a/backend/danswer/context/search/pipeline.py +++ b/backend/onyx/context/search/pipeline.py @@ -5,38 +5,38 @@ from sqlalchemy.orm import Session -from danswer.chat.models import PromptConfig -from danswer.chat.models import SectionRelevancePiece -from danswer.chat.prune_and_merge import _merge_sections -from danswer.chat.prune_and_merge import ChunkRange -from danswer.chat.prune_and_merge import merge_chunk_intervals -from danswer.configs.chat_configs import DISABLE_LLM_DOC_RELEVANCE -from danswer.context.search.enums import LLMEvaluationType -from danswer.context.search.enums import QueryFlow -from danswer.context.search.enums import SearchType -from danswer.context.search.models import IndexFilters -from danswer.context.search.models import InferenceChunk -from danswer.context.search.models import InferenceSection -from danswer.context.search.models import RerankMetricsContainer -from danswer.context.search.models import RetrievalMetricsContainer -from danswer.context.search.models import SearchQuery -from danswer.context.search.models import SearchRequest -from danswer.context.search.postprocessing.postprocessing import cleanup_chunks -from danswer.context.search.postprocessing.postprocessing import search_postprocessing -from danswer.context.search.preprocessing.preprocessing import retrieval_preprocessing -from danswer.context.search.retrieval.search_runner import retrieve_chunks -from danswer.context.search.utils import inference_section_from_chunks -from danswer.context.search.utils import relevant_sections_to_indices -from danswer.db.models import User -from danswer.db.search_settings import get_current_search_settings -from danswer.document_index.factory import get_default_document_index -from danswer.document_index.interfaces import VespaChunkRequest -from danswer.llm.interfaces import LLM -from danswer.secondary_llm_flows.agentic_evaluation import evaluate_inference_section -from danswer.utils.logger import setup_logger -from danswer.utils.threadpool_concurrency import FunctionCall -from danswer.utils.threadpool_concurrency import run_functions_in_parallel -from danswer.utils.timing import log_function_time +from onyx.chat.models import PromptConfig +from onyx.chat.models import SectionRelevancePiece +from onyx.chat.prune_and_merge import _merge_sections +from onyx.chat.prune_and_merge import ChunkRange +from onyx.chat.prune_and_merge import merge_chunk_intervals +from onyx.configs.chat_configs import DISABLE_LLM_DOC_RELEVANCE +from onyx.context.search.enums import LLMEvaluationType +from onyx.context.search.enums import QueryFlow +from onyx.context.search.enums import SearchType +from onyx.context.search.models import IndexFilters +from onyx.context.search.models import InferenceChunk +from onyx.context.search.models import InferenceSection +from onyx.context.search.models import RerankMetricsContainer +from onyx.context.search.models import RetrievalMetricsContainer +from onyx.context.search.models import SearchQuery +from onyx.context.search.models import SearchRequest +from onyx.context.search.postprocessing.postprocessing import cleanup_chunks +from onyx.context.search.postprocessing.postprocessing import search_postprocessing +from onyx.context.search.preprocessing.preprocessing import retrieval_preprocessing +from onyx.context.search.retrieval.search_runner import retrieve_chunks +from onyx.context.search.utils import inference_section_from_chunks +from onyx.context.search.utils import relevant_sections_to_indices +from onyx.db.models import User +from onyx.db.search_settings import get_current_search_settings +from onyx.document_index.factory import get_default_document_index +from onyx.document_index.interfaces import VespaChunkRequest +from onyx.llm.interfaces import LLM +from onyx.secondary_llm_flows.agentic_evaluation import evaluate_inference_section +from onyx.utils.logger import setup_logger +from onyx.utils.threadpool_concurrency import FunctionCall +from onyx.utils.threadpool_concurrency import run_functions_in_parallel +from onyx.utils.timing import log_function_time logger = setup_logger() diff --git a/backend/danswer/context/search/postprocessing/postprocessing.py b/backend/onyx/context/search/postprocessing/postprocessing.py similarity index 90% rename from backend/danswer/context/search/postprocessing/postprocessing.py rename to backend/onyx/context/search/postprocessing/postprocessing.py index a32abca9c43..41951405478 100644 --- a/backend/danswer/context/search/postprocessing/postprocessing.py +++ b/backend/onyx/context/search/postprocessing/postprocessing.py @@ -4,29 +4,29 @@ import numpy -from danswer.chat.models import SectionRelevancePiece -from danswer.configs.app_configs import BLURB_SIZE -from danswer.configs.constants import RETURN_SEPARATOR -from danswer.configs.model_configs import CROSS_ENCODER_RANGE_MAX -from danswer.configs.model_configs import CROSS_ENCODER_RANGE_MIN -from danswer.context.search.enums import LLMEvaluationType -from danswer.context.search.models import ChunkMetric -from danswer.context.search.models import InferenceChunk -from danswer.context.search.models import InferenceChunkUncleaned -from danswer.context.search.models import InferenceSection -from danswer.context.search.models import MAX_METRICS_CONTENT -from danswer.context.search.models import RerankMetricsContainer -from danswer.context.search.models import SearchQuery -from danswer.document_index.document_index_utils import ( +from onyx.chat.models import SectionRelevancePiece +from onyx.configs.app_configs import BLURB_SIZE +from onyx.configs.constants import RETURN_SEPARATOR +from onyx.configs.model_configs import CROSS_ENCODER_RANGE_MAX +from onyx.configs.model_configs import CROSS_ENCODER_RANGE_MIN +from onyx.context.search.enums import LLMEvaluationType +from onyx.context.search.models import ChunkMetric +from onyx.context.search.models import InferenceChunk +from onyx.context.search.models import InferenceChunkUncleaned +from onyx.context.search.models import InferenceSection +from onyx.context.search.models import MAX_METRICS_CONTENT +from onyx.context.search.models import RerankMetricsContainer +from onyx.context.search.models import SearchQuery +from onyx.document_index.document_index_utils import ( translate_boost_count_to_multiplier, ) -from danswer.llm.interfaces import LLM -from danswer.natural_language_processing.search_nlp_models import RerankingModel -from danswer.secondary_llm_flows.chunk_usefulness import llm_batch_eval_sections -from danswer.utils.logger import setup_logger -from danswer.utils.threadpool_concurrency import FunctionCall -from danswer.utils.threadpool_concurrency import run_functions_in_parallel -from danswer.utils.timing import log_function_time +from onyx.llm.interfaces import LLM +from onyx.natural_language_processing.search_nlp_models import RerankingModel +from onyx.secondary_llm_flows.chunk_usefulness import llm_batch_eval_sections +from onyx.utils.logger import setup_logger +from onyx.utils.threadpool_concurrency import FunctionCall +from onyx.utils.threadpool_concurrency import run_functions_in_parallel +from onyx.utils.timing import log_function_time logger = setup_logger() diff --git a/backend/danswer/context/search/preprocessing/access_filters.py b/backend/onyx/context/search/preprocessing/access_filters.py similarity index 78% rename from backend/danswer/context/search/preprocessing/access_filters.py rename to backend/onyx/context/search/preprocessing/access_filters.py index d4e0c6033bf..c9fb83bf195 100644 --- a/backend/danswer/context/search/preprocessing/access_filters.py +++ b/backend/onyx/context/search/preprocessing/access_filters.py @@ -1,8 +1,8 @@ from sqlalchemy.orm import Session -from danswer.access.access import get_acl_for_user -from danswer.context.search.models import IndexFilters -from danswer.db.models import User +from onyx.access.access import get_acl_for_user +from onyx.context.search.models import IndexFilters +from onyx.db.models import User def build_access_filters_for_user(user: User | None, session: Session) -> list[str]: diff --git a/backend/danswer/context/search/preprocessing/preprocessing.py b/backend/onyx/context/search/preprocessing/preprocessing.py similarity index 82% rename from backend/danswer/context/search/preprocessing/preprocessing.py rename to backend/onyx/context/search/preprocessing/preprocessing.py index fe886ccd9e0..da228f5f1fb 100644 --- a/backend/danswer/context/search/preprocessing/preprocessing.py +++ b/backend/onyx/context/search/preprocessing/preprocessing.py @@ -1,39 +1,39 @@ from sqlalchemy.orm import Session -from danswer.configs.chat_configs import BASE_RECENCY_DECAY -from danswer.configs.chat_configs import CONTEXT_CHUNKS_ABOVE -from danswer.configs.chat_configs import CONTEXT_CHUNKS_BELOW -from danswer.configs.chat_configs import DISABLE_LLM_DOC_RELEVANCE -from danswer.configs.chat_configs import FAVOR_RECENT_DECAY_MULTIPLIER -from danswer.configs.chat_configs import HYBRID_ALPHA -from danswer.configs.chat_configs import HYBRID_ALPHA_KEYWORD -from danswer.configs.chat_configs import NUM_POSTPROCESSED_RESULTS -from danswer.configs.chat_configs import NUM_RETURNED_HITS -from danswer.context.search.enums import LLMEvaluationType -from danswer.context.search.enums import RecencyBiasSetting -from danswer.context.search.enums import SearchType -from danswer.context.search.models import BaseFilters -from danswer.context.search.models import IndexFilters -from danswer.context.search.models import RerankingDetails -from danswer.context.search.models import SearchQuery -from danswer.context.search.models import SearchRequest -from danswer.context.search.preprocessing.access_filters import ( +from onyx.configs.chat_configs import BASE_RECENCY_DECAY +from onyx.configs.chat_configs import CONTEXT_CHUNKS_ABOVE +from onyx.configs.chat_configs import CONTEXT_CHUNKS_BELOW +from onyx.configs.chat_configs import DISABLE_LLM_DOC_RELEVANCE +from onyx.configs.chat_configs import FAVOR_RECENT_DECAY_MULTIPLIER +from onyx.configs.chat_configs import HYBRID_ALPHA +from onyx.configs.chat_configs import HYBRID_ALPHA_KEYWORD +from onyx.configs.chat_configs import NUM_POSTPROCESSED_RESULTS +from onyx.configs.chat_configs import NUM_RETURNED_HITS +from onyx.context.search.enums import LLMEvaluationType +from onyx.context.search.enums import RecencyBiasSetting +from onyx.context.search.enums import SearchType +from onyx.context.search.models import BaseFilters +from onyx.context.search.models import IndexFilters +from onyx.context.search.models import RerankingDetails +from onyx.context.search.models import SearchQuery +from onyx.context.search.models import SearchRequest +from onyx.context.search.preprocessing.access_filters import ( build_access_filters_for_user, ) -from danswer.context.search.retrieval.search_runner import ( +from onyx.context.search.retrieval.search_runner import ( remove_stop_words_and_punctuation, ) -from danswer.db.engine import CURRENT_TENANT_ID_CONTEXTVAR -from danswer.db.models import User -from danswer.db.search_settings import get_current_search_settings -from danswer.llm.interfaces import LLM -from danswer.natural_language_processing.search_nlp_models import QueryAnalysisModel -from danswer.secondary_llm_flows.source_filter import extract_source_filter -from danswer.secondary_llm_flows.time_filter import extract_time_filter -from danswer.utils.logger import setup_logger -from danswer.utils.threadpool_concurrency import FunctionCall -from danswer.utils.threadpool_concurrency import run_functions_in_parallel -from danswer.utils.timing import log_function_time +from onyx.db.engine import CURRENT_TENANT_ID_CONTEXTVAR +from onyx.db.models import User +from onyx.db.search_settings import get_current_search_settings +from onyx.llm.interfaces import LLM +from onyx.natural_language_processing.search_nlp_models import QueryAnalysisModel +from onyx.secondary_llm_flows.source_filter import extract_source_filter +from onyx.secondary_llm_flows.time_filter import extract_time_filter +from onyx.utils.logger import setup_logger +from onyx.utils.threadpool_concurrency import FunctionCall +from onyx.utils.threadpool_concurrency import run_functions_in_parallel +from onyx.utils.timing import log_function_time from shared_configs.configs import MULTI_TENANT diff --git a/backend/danswer/context/search/retrieval/search_runner.py b/backend/onyx/context/search/retrieval/search_runner.py similarity index 89% rename from backend/danswer/context/search/retrieval/search_runner.py rename to backend/onyx/context/search/retrieval/search_runner.py index 770a19900f2..64491a20a02 100644 --- a/backend/danswer/context/search/retrieval/search_runner.py +++ b/backend/onyx/context/search/retrieval/search_runner.py @@ -6,28 +6,28 @@ from nltk.tokenize import word_tokenize # type:ignore from sqlalchemy.orm import Session -from danswer.context.search.models import ChunkMetric -from danswer.context.search.models import IndexFilters -from danswer.context.search.models import InferenceChunk -from danswer.context.search.models import InferenceChunkUncleaned -from danswer.context.search.models import InferenceSection -from danswer.context.search.models import MAX_METRICS_CONTENT -from danswer.context.search.models import RetrievalMetricsContainer -from danswer.context.search.models import SearchQuery -from danswer.context.search.postprocessing.postprocessing import cleanup_chunks -from danswer.context.search.utils import inference_section_from_chunks -from danswer.db.search_settings import get_current_search_settings -from danswer.db.search_settings import get_multilingual_expansion -from danswer.document_index.interfaces import DocumentIndex -from danswer.document_index.interfaces import VespaChunkRequest -from danswer.document_index.vespa.shared_utils.utils import ( +from onyx.context.search.models import ChunkMetric +from onyx.context.search.models import IndexFilters +from onyx.context.search.models import InferenceChunk +from onyx.context.search.models import InferenceChunkUncleaned +from onyx.context.search.models import InferenceSection +from onyx.context.search.models import MAX_METRICS_CONTENT +from onyx.context.search.models import RetrievalMetricsContainer +from onyx.context.search.models import SearchQuery +from onyx.context.search.postprocessing.postprocessing import cleanup_chunks +from onyx.context.search.utils import inference_section_from_chunks +from onyx.db.search_settings import get_current_search_settings +from onyx.db.search_settings import get_multilingual_expansion +from onyx.document_index.interfaces import DocumentIndex +from onyx.document_index.interfaces import VespaChunkRequest +from onyx.document_index.vespa.shared_utils.utils import ( replace_invalid_doc_id_characters, ) -from danswer.natural_language_processing.search_nlp_models import EmbeddingModel -from danswer.secondary_llm_flows.query_expansion import multilingual_query_expansion -from danswer.utils.logger import setup_logger -from danswer.utils.threadpool_concurrency import run_functions_tuples_in_parallel -from danswer.utils.timing import log_function_time +from onyx.natural_language_processing.search_nlp_models import EmbeddingModel +from onyx.secondary_llm_flows.query_expansion import multilingual_query_expansion +from onyx.utils.logger import setup_logger +from onyx.utils.threadpool_concurrency import run_functions_tuples_in_parallel +from onyx.utils.timing import log_function_time from shared_configs.configs import MODEL_SERVER_HOST from shared_configs.configs import MODEL_SERVER_PORT from shared_configs.enums import EmbedTextType diff --git a/backend/danswer/context/search/search_settings.py b/backend/onyx/context/search/search_settings.py similarity index 79% rename from backend/danswer/context/search/search_settings.py rename to backend/onyx/context/search/search_settings.py index 917b2c9f532..f419b7d29a9 100644 --- a/backend/danswer/context/search/search_settings.py +++ b/backend/onyx/context/search/search_settings.py @@ -1,10 +1,10 @@ from typing import cast -from danswer.configs.constants import KV_SEARCH_SETTINGS -from danswer.context.search.models import SavedSearchSettings -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.utils.logger import setup_logger +from onyx.configs.constants import KV_SEARCH_SETTINGS +from onyx.context.search.models import SavedSearchSettings +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/context/search/utils.py b/backend/onyx/context/search/utils.py similarity index 89% rename from backend/danswer/context/search/utils.py rename to backend/onyx/context/search/utils.py index ecbdaf35ffb..8a25ad1b783 100644 --- a/backend/danswer/context/search/utils.py +++ b/backend/onyx/context/search/utils.py @@ -1,13 +1,13 @@ from collections.abc import Sequence from typing import TypeVar -from danswer.chat.models import SectionRelevancePiece -from danswer.context.search.models import InferenceChunk -from danswer.context.search.models import InferenceSection -from danswer.context.search.models import SavedSearchDoc -from danswer.context.search.models import SavedSearchDocWithContent -from danswer.context.search.models import SearchDoc -from danswer.db.models import SearchDoc as DBSearchDoc +from onyx.chat.models import SectionRelevancePiece +from onyx.context.search.models import InferenceChunk +from onyx.context.search.models import InferenceSection +from onyx.context.search.models import SavedSearchDoc +from onyx.context.search.models import SavedSearchDocWithContent +from onyx.context.search.models import SearchDoc +from onyx.db.models import SearchDoc as DBSearchDoc T = TypeVar( diff --git a/backend/danswer/server/__init__.py b/backend/onyx/db/__init__.py similarity index 100% rename from backend/danswer/server/__init__.py rename to backend/onyx/db/__init__.py diff --git a/backend/danswer/db/api_key.py b/backend/onyx/db/api_key.py similarity index 91% rename from backend/danswer/db/api_key.py rename to backend/onyx/db/api_key.py index b4a56f3f23f..f0f364ab990 100644 --- a/backend/danswer/db/api_key.py +++ b/backend/onyx/db/api_key.py @@ -6,16 +6,16 @@ from sqlalchemy.orm import joinedload from sqlalchemy.orm import Session -from danswer.auth.api_key import ApiKeyDescriptor -from danswer.auth.api_key import build_displayable_api_key -from danswer.auth.api_key import generate_api_key -from danswer.auth.api_key import hash_api_key -from danswer.configs.constants import DANSWER_API_KEY_DUMMY_EMAIL_DOMAIN -from danswer.configs.constants import DANSWER_API_KEY_PREFIX -from danswer.configs.constants import UNNAMED_KEY_PLACEHOLDER -from danswer.db.models import ApiKey -from danswer.db.models import User -from danswer.server.api_key.models import APIKeyArgs +from onyx.auth.api_key import ApiKeyDescriptor +from onyx.auth.api_key import build_displayable_api_key +from onyx.auth.api_key import generate_api_key +from onyx.auth.api_key import hash_api_key +from onyx.configs.constants import DANSWER_API_KEY_DUMMY_EMAIL_DOMAIN +from onyx.configs.constants import DANSWER_API_KEY_PREFIX +from onyx.configs.constants import UNNAMED_KEY_PLACEHOLDER +from onyx.db.models import ApiKey +from onyx.db.models import User +from onyx.server.api_key.models import APIKeyArgs from shared_configs.configs import MULTI_TENANT from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR diff --git a/backend/danswer/db/auth.py b/backend/onyx/db/auth.py similarity index 84% rename from backend/danswer/db/auth.py rename to backend/onyx/db/auth.py index bc4047109fa..c4a5a93816b 100644 --- a/backend/danswer/db/auth.py +++ b/backend/onyx/db/auth.py @@ -13,15 +13,15 @@ from sqlalchemy.future import select from sqlalchemy.orm import Session -from danswer.auth.invited_users import get_invited_users -from danswer.auth.schemas import UserRole -from danswer.db.api_key import get_api_key_email_pattern -from danswer.db.engine import get_async_session -from danswer.db.engine import get_async_session_with_tenant -from danswer.db.models import AccessToken -from danswer.db.models import OAuthAccount -from danswer.db.models import User -from danswer.utils.variable_functionality import ( +from onyx.auth.invited_users import get_invited_users +from onyx.auth.schemas import UserRole +from onyx.db.api_key import get_api_key_email_pattern +from onyx.db.engine import get_async_session +from onyx.db.engine import get_async_session_with_tenant +from onyx.db.models import AccessToken +from onyx.db.models import OAuthAccount +from onyx.db.models import User +from onyx.utils.variable_functionality import ( fetch_versioned_implementation_with_fallback, ) @@ -32,7 +32,7 @@ def get_default_admin_user_emails() -> list[str]: get_default_admin_user_emails_fn: Callable[ [], list[str] ] = fetch_versioned_implementation_with_fallback( - "danswer.auth.users", "get_default_admin_user_emails_", lambda: list[str]() + "onyx.auth.users", "get_default_admin_user_emails_", lambda: list[str]() ) return get_default_admin_user_emails_fn() diff --git a/backend/danswer/db/chat.py b/backend/onyx/db/chat.py similarity index 95% rename from backend/danswer/db/chat.py rename to backend/onyx/db/chat.py index f0849645fe4..70ee80bacd1 100644 --- a/backend/danswer/db/chat.py +++ b/backend/onyx/db/chat.py @@ -15,30 +15,30 @@ from sqlalchemy.orm import joinedload from sqlalchemy.orm import Session -from danswer.auth.schemas import UserRole -from danswer.chat.models import DocumentRelevance -from danswer.configs.chat_configs import HARD_DELETE_CHATS -from danswer.configs.constants import MessageType -from danswer.context.search.models import RetrievalDocs -from danswer.context.search.models import SavedSearchDoc -from danswer.context.search.models import SearchDoc as ServerSearchDoc -from danswer.db.models import ChatMessage -from danswer.db.models import ChatMessage__SearchDoc -from danswer.db.models import ChatSession -from danswer.db.models import ChatSessionSharedStatus -from danswer.db.models import Prompt -from danswer.db.models import SearchDoc -from danswer.db.models import SearchDoc as DBSearchDoc -from danswer.db.models import ToolCall -from danswer.db.models import User -from danswer.db.persona import get_best_persona_id_for_user -from danswer.db.pg_file_store import delete_lobj_by_name -from danswer.file_store.models import FileDescriptor -from danswer.llm.override_models import LLMOverride -from danswer.llm.override_models import PromptOverride -from danswer.server.query_and_chat.models import ChatMessageDetail -from danswer.tools.tool_runner import ToolCallFinalResult -from danswer.utils.logger import setup_logger +from onyx.auth.schemas import UserRole +from onyx.chat.models import DocumentRelevance +from onyx.configs.chat_configs import HARD_DELETE_CHATS +from onyx.configs.constants import MessageType +from onyx.context.search.models import RetrievalDocs +from onyx.context.search.models import SavedSearchDoc +from onyx.context.search.models import SearchDoc as ServerSearchDoc +from onyx.db.models import ChatMessage +from onyx.db.models import ChatMessage__SearchDoc +from onyx.db.models import ChatSession +from onyx.db.models import ChatSessionSharedStatus +from onyx.db.models import Prompt +from onyx.db.models import SearchDoc +from onyx.db.models import SearchDoc as DBSearchDoc +from onyx.db.models import ToolCall +from onyx.db.models import User +from onyx.db.persona import get_best_persona_id_for_user +from onyx.db.pg_file_store import delete_lobj_by_name +from onyx.file_store.models import FileDescriptor +from onyx.llm.override_models import LLMOverride +from onyx.llm.override_models import PromptOverride +from onyx.server.query_and_chat.models import ChatMessageDetail +from onyx.tools.tool_runner import ToolCallFinalResult +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -225,7 +225,7 @@ def create_chat_session( persona_id: int | None, # Can be none if temporary persona is used llm_override: LLMOverride | None = None, prompt_override: PromptOverride | None = None, - danswerbot_flow: bool = False, + onyxbot_flow: bool = False, slack_thread_id: str | None = None, ) -> ChatSession: chat_session = ChatSession( @@ -234,7 +234,7 @@ def create_chat_session( description=description, llm_override=llm_override, prompt_override=prompt_override, - danswerbot_flow=danswerbot_flow, + onyxbot_flow=onyxbot_flow, slack_thread_id=slack_thread_id, ) @@ -280,7 +280,7 @@ def duplicate_chat_session_for_user_from_slack( llm_override=chat_session.llm_override, prompt_override=chat_session.prompt_override, # Chat is in UI now so this is false - danswerbot_flow=False, + onyxbot_flow=False, # Maybe we want this in the future to track if it was created from Slack slack_thread_id=None, ) diff --git a/backend/danswer/db/connector.py b/backend/onyx/db/connector.py similarity index 94% rename from backend/danswer/db/connector.py rename to backend/onyx/db/connector.py index 1bcfe75e4c1..5663c336b21 100644 --- a/backend/danswer/db/connector.py +++ b/backend/onyx/db/connector.py @@ -9,17 +9,17 @@ from sqlalchemy.orm import aliased from sqlalchemy.orm import Session -from danswer.configs.app_configs import DEFAULT_PRUNING_FREQ -from danswer.configs.constants import DocumentSource -from danswer.connectors.models import InputType -from danswer.db.enums import IndexingMode -from danswer.db.models import Connector -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import IndexAttempt -from danswer.server.documents.models import ConnectorBase -from danswer.server.documents.models import ObjectCreationIdResponse -from danswer.server.models import StatusResponse -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import DEFAULT_PRUNING_FREQ +from onyx.configs.constants import DocumentSource +from onyx.connectors.models import InputType +from onyx.db.enums import IndexingMode +from onyx.db.models import Connector +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import IndexAttempt +from onyx.server.documents.models import ConnectorBase +from onyx.server.documents.models import ObjectCreationIdResponse +from onyx.server.models import StatusResponse +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/db/connector_credential_pair.py b/backend/onyx/db/connector_credential_pair.py similarity index 94% rename from backend/danswer/db/connector_credential_pair.py rename to backend/onyx/db/connector_credential_pair.py index 26730d1178f..46545c5ae18 100644 --- a/backend/danswer/db/connector_credential_pair.py +++ b/backend/onyx/db/connector_credential_pair.py @@ -9,23 +9,23 @@ from sqlalchemy.orm import aliased from sqlalchemy.orm import Session -from danswer.configs.constants import DocumentSource -from danswer.db.connector import fetch_connector_by_id -from danswer.db.credentials import fetch_credential_by_id -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import IndexAttempt -from danswer.db.models import IndexingStatus -from danswer.db.models import IndexModelStatus -from danswer.db.models import SearchSettings -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.db.models import UserGroup__ConnectorCredentialPair -from danswer.db.models import UserRole -from danswer.server.models import StatusResponse -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_ee_implementation_or_noop +from onyx.configs.constants import DocumentSource +from onyx.db.connector import fetch_connector_by_id +from onyx.db.credentials import fetch_credential_by_id +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import IndexAttempt +from onyx.db.models import IndexingStatus +from onyx.db.models import IndexModelStatus +from onyx.db.models import SearchSettings +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.db.models import UserGroup__ConnectorCredentialPair +from onyx.db.models import UserRole +from onyx.server.models import StatusResponse +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_ee_implementation_or_noop logger = setup_logger() @@ -357,7 +357,7 @@ def add_credential_to_connector( if access_type == AccessType.SYNC: if not fetch_ee_implementation_or_noop( - "danswer.external_permissions.sync_params", + "onyx.external_permissions.sync_params", "check_if_valid_sync_source", noop_return_value=True, )(connector.source): @@ -448,7 +448,7 @@ def remove_credential_from_connector( if association is not None: fetch_ee_implementation_or_noop( - "danswer.db.external_perm", + "onyx.db.external_perm", "delete_user__ext_group_for_cc_pair__no_commit", )( db_session=db_session, diff --git a/backend/danswer/db/constants.py b/backend/onyx/db/constants.py similarity index 100% rename from backend/danswer/db/constants.py rename to backend/onyx/db/constants.py diff --git a/backend/danswer/db/credentials.py b/backend/onyx/db/credentials.py similarity index 96% rename from backend/danswer/db/credentials.py rename to backend/onyx/db/credentials.py index 3ee165b34d0..3cae5d0a3ba 100644 --- a/backend/danswer/db/credentials.py +++ b/backend/onyx/db/credentials.py @@ -8,19 +8,19 @@ from sqlalchemy.sql.expression import and_ from sqlalchemy.sql.expression import or_ -from danswer.auth.schemas import UserRole -from danswer.configs.constants import DocumentSource -from danswer.connectors.google_utils.shared_constants import ( +from onyx.auth.schemas import UserRole +from onyx.configs.constants import DocumentSource +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY, ) -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import Credential -from danswer.db.models import Credential__UserGroup -from danswer.db.models import DocumentByConnectorCredentialPair -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.server.documents.models import CredentialBase -from danswer.utils.logger import setup_logger +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import Credential +from onyx.db.models import Credential__UserGroup +from onyx.db.models import DocumentByConnectorCredentialPair +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.server.documents.models import CredentialBase +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/db/deletion_attempt.py b/backend/onyx/db/deletion_attempt.py similarity index 87% rename from backend/danswer/db/deletion_attempt.py rename to backend/onyx/db/deletion_attempt.py index 0312047250b..8cda15db342 100644 --- a/backend/danswer/db/deletion_attempt.py +++ b/backend/onyx/db/deletion_attempt.py @@ -1,9 +1,9 @@ from sqlalchemy.orm import Session -from danswer.db.index_attempt import get_last_attempt -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import IndexingStatus -from danswer.db.search_settings import get_current_search_settings +from onyx.db.index_attempt import get_last_attempt +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import IndexingStatus +from onyx.db.search_settings import get_current_search_settings def check_deletion_attempt_is_allowed( diff --git a/backend/danswer/db/document.py b/backend/onyx/db/document.py similarity index 95% rename from backend/danswer/db/document.py rename to backend/onyx/db/document.py index 8f0bfa2cac2..decf10813d0 100644 --- a/backend/danswer/db/document.py +++ b/backend/onyx/db/document.py @@ -18,21 +18,21 @@ from sqlalchemy.orm import Session from sqlalchemy.sql.expression import null -from danswer.configs.constants import DEFAULT_BOOST -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.feedback import delete_document_feedback_for_documents__no_commit -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import Credential -from danswer.db.models import Document as DbDocument -from danswer.db.models import DocumentByConnectorCredentialPair -from danswer.db.models import User -from danswer.db.tag import delete_document_tags_for_documents__no_commit -from danswer.db.utils import model_to_dict -from danswer.document_index.interfaces import DocumentMetadata -from danswer.server.documents.models import ConnectorCredentialPairIdentifier -from danswer.utils.logger import setup_logger +from onyx.configs.constants import DEFAULT_BOOST +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.feedback import delete_document_feedback_for_documents__no_commit +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import Credential +from onyx.db.models import Document as DbDocument +from onyx.db.models import DocumentByConnectorCredentialPair +from onyx.db.models import User +from onyx.db.tag import delete_document_tags_for_documents__no_commit +from onyx.db.utils import model_to_dict +from onyx.document_index.interfaces import DocumentMetadata +from onyx.server.documents.models import ConnectorCredentialPairIdentifier +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -267,7 +267,7 @@ def get_access_info_for_documents( of the associated cc pairs are intending to make the document globally public. Returns the list where each element contains: - Document ID (which is also the ID of the DocumentByConnectorCredentialPair) - - List of emails of Danswer users with direct access to the doc (includes a "None" element if + - List of emails of Onyx users with direct access to the doc (includes a "None" element if the connector was set up by an admin when auth was off - bool for whether the document is public (the document later can also be marked public by automatic permission sync step) diff --git a/backend/danswer/db/document_set.py b/backend/onyx/db/document_set.py similarity index 94% rename from backend/danswer/db/document_set.py rename to backend/onyx/db/document_set.py index b5af99b22d4..b5f0dd365aa 100644 --- a/backend/danswer/db/document_set.py +++ b/backend/onyx/db/document_set.py @@ -12,23 +12,23 @@ from sqlalchemy.orm import aliased from sqlalchemy.orm import Session -from danswer.db.connector_credential_pair import get_cc_pair_groups_for_ids -from danswer.db.connector_credential_pair import get_connector_credential_pairs -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import Document -from danswer.db.models import DocumentByConnectorCredentialPair -from danswer.db.models import DocumentSet as DocumentSetDBModel -from danswer.db.models import DocumentSet__ConnectorCredentialPair -from danswer.db.models import DocumentSet__UserGroup -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.db.models import UserRole -from danswer.server.features.document_set.models import DocumentSetCreationRequest -from danswer.server.features.document_set.models import DocumentSetUpdateRequest -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_versioned_implementation +from onyx.db.connector_credential_pair import get_cc_pair_groups_for_ids +from onyx.db.connector_credential_pair import get_connector_credential_pairs +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import Document +from onyx.db.models import DocumentByConnectorCredentialPair +from onyx.db.models import DocumentSet as DocumentSetDBModel +from onyx.db.models import DocumentSet__ConnectorCredentialPair +from onyx.db.models import DocumentSet__UserGroup +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.db.models import UserRole +from onyx.server.features.document_set.models import DocumentSetCreationRequest +from onyx.server.features.document_set.models import DocumentSetUpdateRequest +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_versioned_implementation logger = setup_logger() @@ -105,7 +105,7 @@ def _mark_document_set_cc_pairs_as_outdated__no_commit( def delete_document_set_privacy__no_commit( document_set_id: int, db_session: Session ) -> None: - """No private document sets in Danswer MIT""" + """No private document sets in Onyx MIT""" def get_document_set_by_id( @@ -146,7 +146,7 @@ def make_doc_set_private( ) -> None: # May cause error if someone switches down to MIT from EE if user_ids or group_ids: - raise NotImplementedError("Danswer MIT does not support private Document Sets") + raise NotImplementedError("Onyx MIT does not support private Document Sets") def _check_if_cc_pairs_are_owned_by_groups( @@ -225,7 +225,7 @@ def insert_document_set( db_session.add_all(ds_cc_pairs) versioned_private_doc_set_fn = fetch_versioned_implementation( - "danswer.db.document_set", "make_doc_set_private" + "onyx.db.document_set", "make_doc_set_private" ) # Private Document Sets @@ -287,7 +287,7 @@ def update_document_set( document_set_row.is_public = document_set_update_request.is_public versioned_private_doc_set_fn = fetch_versioned_implementation( - "danswer.db.document_set", "make_doc_set_private" + "onyx.db.document_set", "make_doc_set_private" ) # Private Document Sets @@ -381,7 +381,7 @@ def mark_document_set_as_to_be_deleted( # delete all private document set information versioned_delete_private_fn = fetch_versioned_implementation( - "danswer.db.document_set", "delete_document_set_privacy__no_commit" + "onyx.db.document_set", "delete_document_set_privacy__no_commit" ) versioned_delete_private_fn( document_set_id=document_set_id, db_session=db_session diff --git a/backend/danswer/db/engine.py b/backend/onyx/db/engine.py similarity index 94% rename from backend/danswer/db/engine.py rename to backend/onyx/db/engine.py index 8ad8eca7a0f..e0d1f536f6c 100644 --- a/backend/danswer/db/engine.py +++ b/backend/onyx/db/engine.py @@ -23,22 +23,22 @@ from sqlalchemy.orm import Session from sqlalchemy.orm import sessionmaker -from danswer.configs.app_configs import LOG_POSTGRES_CONN_COUNTS -from danswer.configs.app_configs import LOG_POSTGRES_LATENCY -from danswer.configs.app_configs import POSTGRES_API_SERVER_POOL_OVERFLOW -from danswer.configs.app_configs import POSTGRES_API_SERVER_POOL_SIZE -from danswer.configs.app_configs import POSTGRES_DB -from danswer.configs.app_configs import POSTGRES_HOST -from danswer.configs.app_configs import POSTGRES_IDLE_SESSIONS_TIMEOUT -from danswer.configs.app_configs import POSTGRES_PASSWORD -from danswer.configs.app_configs import POSTGRES_POOL_PRE_PING -from danswer.configs.app_configs import POSTGRES_POOL_RECYCLE -from danswer.configs.app_configs import POSTGRES_PORT -from danswer.configs.app_configs import POSTGRES_USER -from danswer.configs.app_configs import USER_AUTH_SECRET -from danswer.configs.constants import POSTGRES_UNKNOWN_APP_NAME -from danswer.server.utils import BasicAuthenticationError -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import LOG_POSTGRES_CONN_COUNTS +from onyx.configs.app_configs import LOG_POSTGRES_LATENCY +from onyx.configs.app_configs import POSTGRES_API_SERVER_POOL_OVERFLOW +from onyx.configs.app_configs import POSTGRES_API_SERVER_POOL_SIZE +from onyx.configs.app_configs import POSTGRES_DB +from onyx.configs.app_configs import POSTGRES_HOST +from onyx.configs.app_configs import POSTGRES_IDLE_SESSIONS_TIMEOUT +from onyx.configs.app_configs import POSTGRES_PASSWORD +from onyx.configs.app_configs import POSTGRES_POOL_PRE_PING +from onyx.configs.app_configs import POSTGRES_POOL_RECYCLE +from onyx.configs.app_configs import POSTGRES_PORT +from onyx.configs.app_configs import POSTGRES_USER +from onyx.configs.app_configs import USER_AUTH_SECRET +from onyx.configs.constants import POSTGRES_UNKNOWN_APP_NAME +from onyx.server.utils import BasicAuthenticationError +from onyx.utils.logger import setup_logger from shared_configs.configs import MULTI_TENANT from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA from shared_configs.configs import TENANT_ID_PREFIX diff --git a/backend/danswer/db/enums.py b/backend/onyx/db/enums.py similarity index 100% rename from backend/danswer/db/enums.py rename to backend/onyx/db/enums.py diff --git a/backend/danswer/db/feedback.py b/backend/onyx/db/feedback.py similarity index 91% rename from backend/danswer/db/feedback.py rename to backend/onyx/db/feedback.py index 219e2474729..f01d8151228 100644 --- a/backend/danswer/db/feedback.py +++ b/backend/onyx/db/feedback.py @@ -13,21 +13,21 @@ from sqlalchemy.orm import aliased from sqlalchemy.orm import Session -from danswer.configs.constants import MessageType -from danswer.configs.constants import SearchFeedbackType -from danswer.db.chat import get_chat_message -from danswer.db.enums import AccessType -from danswer.db.models import ChatMessageFeedback -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import Document as DbDocument -from danswer.db.models import DocumentByConnectorCredentialPair -from danswer.db.models import DocumentRetrievalFeedback -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.db.models import UserGroup__ConnectorCredentialPair -from danswer.db.models import UserRole -from danswer.document_index.interfaces import DocumentIndex -from danswer.utils.logger import setup_logger +from onyx.configs.constants import MessageType +from onyx.configs.constants import SearchFeedbackType +from onyx.db.chat import get_chat_message +from onyx.db.enums import AccessType +from onyx.db.models import ChatMessageFeedback +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import Document as DbDocument +from onyx.db.models import DocumentByConnectorCredentialPair +from onyx.db.models import DocumentRetrievalFeedback +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.db.models import UserGroup__ConnectorCredentialPair +from onyx.db.models import UserRole +from onyx.document_index.interfaces import DocumentIndex +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/db/folder.py b/backend/onyx/db/folder.py similarity index 95% rename from backend/danswer/db/folder.py rename to backend/onyx/db/folder.py index 77e543a8dc8..3b7453e428c 100644 --- a/backend/danswer/db/folder.py +++ b/backend/onyx/db/folder.py @@ -2,10 +2,10 @@ from sqlalchemy.orm import Session -from danswer.db.chat import delete_chat_session -from danswer.db.models import ChatFolder -from danswer.db.models import ChatSession -from danswer.utils.logger import setup_logger +from onyx.db.chat import delete_chat_session +from onyx.db.models import ChatFolder +from onyx.db.models import ChatSession +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/db/index_attempt.py b/backend/onyx/db/index_attempt.py similarity index 97% rename from backend/danswer/db/index_attempt.py rename to backend/onyx/db/index_attempt.py index 2c8ccd99aa0..20e8521d207 100644 --- a/backend/danswer/db/index_attempt.py +++ b/backend/onyx/db/index_attempt.py @@ -12,16 +12,16 @@ from sqlalchemy.orm import joinedload from sqlalchemy.orm import Session -from danswer.connectors.models import Document -from danswer.connectors.models import DocumentErrorSummary -from danswer.db.models import IndexAttempt -from danswer.db.models import IndexAttemptError -from danswer.db.models import IndexingStatus -from danswer.db.models import IndexModelStatus -from danswer.db.models import SearchSettings -from danswer.server.documents.models import ConnectorCredentialPair -from danswer.server.documents.models import ConnectorCredentialPairIdentifier -from danswer.utils.logger import setup_logger +from onyx.connectors.models import Document +from onyx.connectors.models import DocumentErrorSummary +from onyx.db.models import IndexAttempt +from onyx.db.models import IndexAttemptError +from onyx.db.models import IndexingStatus +from onyx.db.models import IndexModelStatus +from onyx.db.models import SearchSettings +from onyx.server.documents.models import ConnectorCredentialPair +from onyx.server.documents.models import ConnectorCredentialPairIdentifier +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/db/llm.py b/backend/onyx/db/llm.py similarity index 91% rename from backend/danswer/db/llm.py rename to backend/onyx/db/llm.py index b01fd81079c..b5eb23428c2 100644 --- a/backend/danswer/db/llm.py +++ b/backend/onyx/db/llm.py @@ -3,18 +3,18 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.db.models import CloudEmbeddingProvider as CloudEmbeddingProviderModel -from danswer.db.models import DocumentSet -from danswer.db.models import LLMProvider as LLMProviderModel -from danswer.db.models import LLMProvider__UserGroup -from danswer.db.models import SearchSettings -from danswer.db.models import Tool as ToolModel -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.server.manage.embedding.models import CloudEmbeddingProvider -from danswer.server.manage.embedding.models import CloudEmbeddingProviderCreationRequest -from danswer.server.manage.llm.models import FullLLMProvider -from danswer.server.manage.llm.models import LLMProviderUpsertRequest +from onyx.db.models import CloudEmbeddingProvider as CloudEmbeddingProviderModel +from onyx.db.models import DocumentSet +from onyx.db.models import LLMProvider as LLMProviderModel +from onyx.db.models import LLMProvider__UserGroup +from onyx.db.models import SearchSettings +from onyx.db.models import Tool as ToolModel +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.server.manage.embedding.models import CloudEmbeddingProvider +from onyx.server.manage.embedding.models import CloudEmbeddingProviderCreationRequest +from onyx.server.manage.llm.models import FullLLMProvider +from onyx.server.manage.llm.models import LLMProviderUpsertRequest from shared_configs.enums import EmbeddingProvider diff --git a/backend/danswer/db/models.py b/backend/onyx/db/models.py similarity index 97% rename from backend/danswer/db/models.py rename to backend/onyx/db/models.py index 7cd8af803fc..7fff9c151be 100644 --- a/backend/danswer/db/models.py +++ b/backend/onyx/db/models.py @@ -35,31 +35,31 @@ from sqlalchemy.types import LargeBinary from sqlalchemy.types import TypeDecorator -from danswer.auth.schemas import UserRole -from danswer.configs.chat_configs import NUM_POSTPROCESSED_RESULTS -from danswer.configs.constants import DEFAULT_BOOST -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import FileOrigin -from danswer.configs.constants import MessageType -from danswer.db.enums import AccessType, IndexingMode -from danswer.configs.constants import NotificationType -from danswer.configs.constants import SearchFeedbackType -from danswer.configs.constants import TokenRateLimitScope -from danswer.connectors.models import InputType -from danswer.db.enums import ChatSessionSharedStatus -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.enums import IndexingStatus -from danswer.db.enums import IndexModelStatus -from danswer.db.enums import TaskStatus -from danswer.db.pydantic_type import PydanticType -from danswer.utils.special_types import JSON_ro -from danswer.file_store.models import FileDescriptor -from danswer.llm.override_models import LLMOverride -from danswer.llm.override_models import PromptOverride -from danswer.context.search.enums import RecencyBiasSetting -from danswer.utils.encryption import decrypt_bytes_to_string -from danswer.utils.encryption import encrypt_string_to_bytes -from danswer.utils.headers import HeaderItemDict +from onyx.auth.schemas import UserRole +from onyx.configs.chat_configs import NUM_POSTPROCESSED_RESULTS +from onyx.configs.constants import DEFAULT_BOOST +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import FileOrigin +from onyx.configs.constants import MessageType +from onyx.db.enums import AccessType, IndexingMode +from onyx.configs.constants import NotificationType +from onyx.configs.constants import SearchFeedbackType +from onyx.configs.constants import TokenRateLimitScope +from onyx.connectors.models import InputType +from onyx.db.enums import ChatSessionSharedStatus +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.enums import IndexingStatus +from onyx.db.enums import IndexModelStatus +from onyx.db.enums import TaskStatus +from onyx.db.pydantic_type import PydanticType +from onyx.utils.special_types import JSON_ro +from onyx.file_store.models import FileDescriptor +from onyx.llm.override_models import LLMOverride +from onyx.llm.override_models import PromptOverride +from onyx.context.search.enums import RecencyBiasSetting +from onyx.utils.encryption import decrypt_bytes_to_string +from onyx.utils.encryption import encrypt_string_to_bytes +from onyx.utils.headers import HeaderItemDict from shared_configs.enums import EmbeddingProvider from shared_configs.enums import RerankerProvider @@ -388,7 +388,7 @@ class ConnectorCredentialPair(Base): # source type (defined in the connector's `source` field) # E.g. for google_drive perm sync: - # {"customer_id": "123567", "company_domain": "@danswer.ai"} + # {"customer_id": "123567", "company_domain": "@onyx.app"} auto_sync_options: Mapped[dict[str, Any] | None] = mapped_column( postgresql.JSONB(), nullable=True ) @@ -448,7 +448,7 @@ class Document(Base): # NOTE: if more sensitive data is added here for display, make sure to add user/group permission # this should correspond to the ID of the document - # (as is passed around in Danswer) + # (as is passed around in Onyx) id: Mapped[str] = mapped_column(String, primary_key=True) from_ingestion_api: Mapped[bool] = mapped_column( Boolean, default=False, nullable=True @@ -481,7 +481,7 @@ class Document(Base): DateTime(timezone=True), nullable=True, index=True ) # The following are not attached to User because the account/email may not be known - # within Danswer + # within Onyx # Something like the document creator primary_owners: Mapped[list[str] | None] = mapped_column( postgresql.ARRAY(String), nullable=True @@ -955,8 +955,8 @@ class ChatSession(Base): ForeignKey("persona.id"), nullable=True ) description: Mapped[str | None] = mapped_column(Text, nullable=True) - # This chat created by DanswerBot - danswerbot_flow: Mapped[bool] = mapped_column(Boolean, default=False) + # This chat created by OnyxBot + onyxbot_flow: Mapped[bool] = mapped_column(Boolean, default=False) # Only ever set to True if system is set to not hard-delete chats deleted: Mapped[bool] = mapped_column(Boolean, default=False) # controls whether or not this conversation is viewable by others @@ -1568,11 +1568,11 @@ class PGFileStore(Base): Enterprise Edition Models ************************************************************************ -These models are only used in Enterprise Edition only features in Danswer. +These models are only used in Enterprise Edition only features in Onyx. They are kept here to simplify the codebase and avoid having different assumptions -on the shape of data being passed around between the MIT and EE versions of Danswer. +on the shape of data being passed around between the MIT and EE versions of Onyx. -In the MIT version of Danswer, assume these tables are always empty. +In the MIT version of Onyx, assume these tables are always empty. """ @@ -1806,7 +1806,7 @@ class User__ExternalUserGroupId(Base): """Maps user info both internal and external to the name of the external group This maps the user to all of their external groups so that the external group name can be attached to the ACL list matching during query time. User level permissions can be handled by - directly adding the Danswer user to the doc ACL list""" + directly adding the Onyx user to the doc ACL list""" __tablename__ = "user__external_user_group_id" diff --git a/backend/danswer/db/notification.py b/backend/onyx/db/notification.py similarity index 94% rename from backend/danswer/db/notification.py rename to backend/onyx/db/notification.py index a6cdf989177..490d39be518 100644 --- a/backend/danswer/db/notification.py +++ b/backend/onyx/db/notification.py @@ -4,10 +4,10 @@ from sqlalchemy.orm import Session from sqlalchemy.sql import func -from danswer.auth.schemas import UserRole -from danswer.configs.constants import NotificationType -from danswer.db.models import Notification -from danswer.db.models import User +from onyx.auth.schemas import UserRole +from onyx.configs.constants import NotificationType +from onyx.db.models import Notification +from onyx.db.models import User def create_notification( diff --git a/backend/danswer/db/persona.py b/backend/onyx/db/persona.py similarity index 95% rename from backend/danswer/db/persona.py rename to backend/onyx/db/persona.py index ee97885b376..20b721ec4f3 100644 --- a/backend/danswer/db/persona.py +++ b/backend/onyx/db/persona.py @@ -16,28 +16,28 @@ from sqlalchemy.orm import joinedload from sqlalchemy.orm import Session -from danswer.auth.schemas import UserRole -from danswer.configs.chat_configs import BING_API_KEY -from danswer.configs.chat_configs import CONTEXT_CHUNKS_ABOVE -from danswer.configs.chat_configs import CONTEXT_CHUNKS_BELOW -from danswer.context.search.enums import RecencyBiasSetting -from danswer.db.constants import SLACK_BOT_PERSONA_PREFIX -from danswer.db.engine import get_sqlalchemy_engine -from danswer.db.models import DocumentSet -from danswer.db.models import Persona -from danswer.db.models import Persona__User -from danswer.db.models import Persona__UserGroup -from danswer.db.models import PersonaCategory -from danswer.db.models import Prompt -from danswer.db.models import StarterMessage -from danswer.db.models import Tool -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.db.models import UserGroup -from danswer.server.features.persona.models import CreatePersonaRequest -from danswer.server.features.persona.models import PersonaSnapshot -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_versioned_implementation +from onyx.auth.schemas import UserRole +from onyx.configs.chat_configs import BING_API_KEY +from onyx.configs.chat_configs import CONTEXT_CHUNKS_ABOVE +from onyx.configs.chat_configs import CONTEXT_CHUNKS_BELOW +from onyx.context.search.enums import RecencyBiasSetting +from onyx.db.constants import SLACK_BOT_PERSONA_PREFIX +from onyx.db.engine import get_sqlalchemy_engine +from onyx.db.models import DocumentSet +from onyx.db.models import Persona +from onyx.db.models import Persona__User +from onyx.db.models import Persona__UserGroup +from onyx.db.models import PersonaCategory +from onyx.db.models import Prompt +from onyx.db.models import StarterMessage +from onyx.db.models import Tool +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.db.models import UserGroup +from onyx.server.features.persona.models import CreatePersonaRequest +from onyx.server.features.persona.models import PersonaSnapshot +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_versioned_implementation logger = setup_logger() @@ -168,7 +168,7 @@ def make_persona_private( # May cause error if someone switches down to MIT from EE if group_ids: - raise NotImplementedError("Danswer MIT does not support private Personas") + raise NotImplementedError("Onyx MIT does not support private Personas") def create_update_persona( @@ -191,7 +191,7 @@ def create_update_persona( persona = upsert_persona(**persona_data) versioned_make_persona_private = fetch_versioned_implementation( - "danswer.db.persona", "make_persona_private" + "onyx.db.persona", "make_persona_private" ) # Privatize Persona @@ -226,7 +226,7 @@ def update_persona_shared_users( raise HTTPException(status_code=400, detail="Cannot share public persona") versioned_make_persona_private = fetch_versioned_implementation( - "danswer.db.persona", "make_persona_private" + "onyx.db.persona", "make_persona_private" ) # Privatize Persona @@ -634,7 +634,7 @@ def validate_persona_tools(tools: list[Tool]) -> None: for tool in tools: if tool.name == "InternetSearchTool" and not BING_API_KEY: raise ValueError( - "Bing API key not found, please contact your Danswer admin to get it added!" + "Bing API key not found, please contact your Onyx admin to get it added!" ) diff --git a/backend/danswer/db/pg_file_store.py b/backend/onyx/db/pg_file_store.py similarity index 93% rename from backend/danswer/db/pg_file_store.py rename to backend/onyx/db/pg_file_store.py index 1333dcd6cee..469379cbe24 100644 --- a/backend/danswer/db/pg_file_store.py +++ b/backend/onyx/db/pg_file_store.py @@ -5,11 +5,11 @@ from psycopg2.extensions import connection from sqlalchemy.orm import Session -from danswer.configs.constants import FileOrigin -from danswer.db.models import PGFileStore -from danswer.file_store.constants import MAX_IN_MEMORY_SIZE -from danswer.file_store.constants import STANDARD_CHUNK_SIZE -from danswer.utils.logger import setup_logger +from onyx.configs.constants import FileOrigin +from onyx.db.models import PGFileStore +from onyx.file_store.constants import MAX_IN_MEMORY_SIZE +from onyx.file_store.constants import STANDARD_CHUNK_SIZE +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/db/pydantic_type.py b/backend/onyx/db/pydantic_type.py similarity index 100% rename from backend/danswer/db/pydantic_type.py rename to backend/onyx/db/pydantic_type.py diff --git a/backend/danswer/db/search_settings.py b/backend/onyx/db/search_settings.py similarity index 88% rename from backend/danswer/db/search_settings.py rename to backend/onyx/db/search_settings.py index 1134b326a76..d7324de3530 100644 --- a/backend/danswer/db/search_settings.py +++ b/backend/onyx/db/search_settings.py @@ -3,29 +3,29 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.configs.model_configs import ASYM_PASSAGE_PREFIX -from danswer.configs.model_configs import ASYM_QUERY_PREFIX -from danswer.configs.model_configs import DEFAULT_DOCUMENT_ENCODER_MODEL -from danswer.configs.model_configs import DOC_EMBEDDING_DIM -from danswer.configs.model_configs import DOCUMENT_ENCODER_MODEL -from danswer.configs.model_configs import NORMALIZE_EMBEDDINGS -from danswer.configs.model_configs import OLD_DEFAULT_DOCUMENT_ENCODER_MODEL -from danswer.configs.model_configs import OLD_DEFAULT_MODEL_DOC_EMBEDDING_DIM -from danswer.configs.model_configs import OLD_DEFAULT_MODEL_NORMALIZE_EMBEDDINGS -from danswer.context.search.models import SavedSearchSettings -from danswer.db.engine import get_session_with_default_tenant -from danswer.db.llm import fetch_embedding_provider -from danswer.db.models import CloudEmbeddingProvider -from danswer.db.models import IndexAttempt -from danswer.db.models import IndexModelStatus -from danswer.db.models import SearchSettings -from danswer.indexing.models import IndexingSetting -from danswer.natural_language_processing.search_nlp_models import clean_model_name -from danswer.natural_language_processing.search_nlp_models import warm_up_cross_encoder -from danswer.server.manage.embedding.models import ( +from onyx.configs.model_configs import ASYM_PASSAGE_PREFIX +from onyx.configs.model_configs import ASYM_QUERY_PREFIX +from onyx.configs.model_configs import DEFAULT_DOCUMENT_ENCODER_MODEL +from onyx.configs.model_configs import DOC_EMBEDDING_DIM +from onyx.configs.model_configs import DOCUMENT_ENCODER_MODEL +from onyx.configs.model_configs import NORMALIZE_EMBEDDINGS +from onyx.configs.model_configs import OLD_DEFAULT_DOCUMENT_ENCODER_MODEL +from onyx.configs.model_configs import OLD_DEFAULT_MODEL_DOC_EMBEDDING_DIM +from onyx.configs.model_configs import OLD_DEFAULT_MODEL_NORMALIZE_EMBEDDINGS +from onyx.context.search.models import SavedSearchSettings +from onyx.db.engine import get_session_with_default_tenant +from onyx.db.llm import fetch_embedding_provider +from onyx.db.models import CloudEmbeddingProvider +from onyx.db.models import IndexAttempt +from onyx.db.models import IndexModelStatus +from onyx.db.models import SearchSettings +from onyx.indexing.models import IndexingSetting +from onyx.natural_language_processing.search_nlp_models import clean_model_name +from onyx.natural_language_processing.search_nlp_models import warm_up_cross_encoder +from onyx.server.manage.embedding.models import ( CloudEmbeddingProvider as ServerCloudEmbeddingProvider, ) -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger from shared_configs.configs import PRESERVED_SEARCH_FIELDS from shared_configs.enums import EmbeddingProvider diff --git a/backend/danswer/db/slack_bot.py b/backend/onyx/db/slack_bot.py similarity index 97% rename from backend/danswer/db/slack_bot.py rename to backend/onyx/db/slack_bot.py index c3d7559b996..db50287aa02 100644 --- a/backend/danswer/db/slack_bot.py +++ b/backend/onyx/db/slack_bot.py @@ -3,7 +3,7 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.db.models import SlackBot +from onyx.db.models import SlackBot def insert_slack_bot( diff --git a/backend/danswer/db/slack_channel_config.py b/backend/onyx/db/slack_channel_config.py similarity index 91% rename from backend/danswer/db/slack_channel_config.py rename to backend/onyx/db/slack_channel_config.py index d41d74c31c6..ee6dcc2767a 100644 --- a/backend/danswer/db/slack_channel_config.py +++ b/backend/onyx/db/slack_channel_config.py @@ -4,19 +4,19 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.configs.chat_configs import MAX_CHUNKS_FED_TO_CHAT -from danswer.context.search.enums import RecencyBiasSetting -from danswer.db.constants import SLACK_BOT_PERSONA_PREFIX -from danswer.db.models import ChannelConfig -from danswer.db.models import Persona -from danswer.db.models import Persona__DocumentSet -from danswer.db.models import SlackChannelConfig -from danswer.db.models import User -from danswer.db.persona import get_default_prompt -from danswer.db.persona import mark_persona_as_deleted -from danswer.db.persona import upsert_persona -from danswer.utils.errors import EERequiredError -from danswer.utils.variable_functionality import ( +from onyx.configs.chat_configs import MAX_CHUNKS_FED_TO_CHAT +from onyx.context.search.enums import RecencyBiasSetting +from onyx.db.constants import SLACK_BOT_PERSONA_PREFIX +from onyx.db.models import ChannelConfig +from onyx.db.models import Persona +from onyx.db.models import Persona__DocumentSet +from onyx.db.models import SlackChannelConfig +from onyx.db.models import User +from onyx.db.persona import get_default_prompt +from onyx.db.persona import mark_persona_as_deleted +from onyx.db.persona import upsert_persona +from onyx.utils.errors import EERequiredError +from onyx.utils.variable_functionality import ( fetch_versioned_implementation_with_fallback, ) @@ -87,7 +87,7 @@ def insert_slack_channel_config( ) -> SlackChannelConfig: versioned_fetch_standard_answer_categories_by_ids = ( fetch_versioned_implementation_with_fallback( - "danswer.db.standard_answer", + "onyx.db.standard_answer", "fetch_standard_answer_categories_by_ids", _no_ee_standard_answer_categories, ) @@ -142,7 +142,7 @@ def update_slack_channel_config( versioned_fetch_standard_answer_categories_by_ids = ( fetch_versioned_implementation_with_fallback( - "danswer.db.standard_answer", + "onyx.db.standard_answer", "fetch_standard_answer_categories_by_ids", _no_ee_standard_answer_categories, ) diff --git a/backend/danswer/db/swap_index.py b/backend/onyx/db/swap_index.py similarity index 76% rename from backend/danswer/db/swap_index.py rename to backend/onyx/db/swap_index.py index 8b583bd2e4b..abe7bdaf591 100644 --- a/backend/danswer/db/swap_index.py +++ b/backend/onyx/db/swap_index.py @@ -1,19 +1,19 @@ from sqlalchemy.orm import Session -from danswer.configs.constants import KV_REINDEX_KEY -from danswer.db.connector_credential_pair import get_connector_credential_pairs -from danswer.db.connector_credential_pair import resync_cc_pair -from danswer.db.enums import IndexModelStatus -from danswer.db.index_attempt import cancel_indexing_attempts_past_model -from danswer.db.index_attempt import ( +from onyx.configs.constants import KV_REINDEX_KEY +from onyx.db.connector_credential_pair import get_connector_credential_pairs +from onyx.db.connector_credential_pair import resync_cc_pair +from onyx.db.enums import IndexModelStatus +from onyx.db.index_attempt import cancel_indexing_attempts_past_model +from onyx.db.index_attempt import ( count_unique_cc_pairs_with_successful_index_attempts, ) -from danswer.db.models import SearchSettings -from danswer.db.search_settings import get_current_search_settings -from danswer.db.search_settings import get_secondary_search_settings -from danswer.db.search_settings import update_search_settings_status -from danswer.key_value_store.factory import get_kv_store -from danswer.utils.logger import setup_logger +from onyx.db.models import SearchSettings +from onyx.db.search_settings import get_current_search_settings +from onyx.db.search_settings import get_secondary_search_settings +from onyx.db.search_settings import update_search_settings_status +from onyx.key_value_store.factory import get_kv_store +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/db/tag.py b/backend/onyx/db/tag.py similarity index 95% rename from backend/danswer/db/tag.py rename to backend/onyx/db/tag.py index 6f19859087f..1d5b553f864 100644 --- a/backend/danswer/db/tag.py +++ b/backend/onyx/db/tag.py @@ -5,11 +5,11 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.configs.constants import DocumentSource -from danswer.db.models import Document -from danswer.db.models import Document__Tag -from danswer.db.models import Tag -from danswer.utils.logger import setup_logger +from onyx.configs.constants import DocumentSource +from onyx.db.models import Document +from onyx.db.models import Document__Tag +from onyx.db.models import Tag +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/db/tasks.py b/backend/onyx/db/tasks.py similarity index 92% rename from backend/danswer/db/tasks.py rename to backend/onyx/db/tasks.py index a7aec90d260..0cdd0b5aea6 100644 --- a/backend/danswer/db/tasks.py +++ b/backend/onyx/db/tasks.py @@ -3,10 +3,10 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.configs.app_configs import JOB_TIMEOUT -from danswer.db.engine import get_db_current_time -from danswer.db.models import TaskQueueState -from danswer.db.models import TaskStatus +from onyx.configs.app_configs import JOB_TIMEOUT +from onyx.db.engine import get_db_current_time +from onyx.db.models import TaskQueueState +from onyx.db.models import TaskStatus def get_latest_task( diff --git a/backend/danswer/db/token_limit.py b/backend/onyx/db/token_limit.py similarity index 93% rename from backend/danswer/db/token_limit.py rename to backend/onyx/db/token_limit.py index 24b2433cc1a..b8414cbe3fc 100644 --- a/backend/danswer/db/token_limit.py +++ b/backend/onyx/db/token_limit.py @@ -3,10 +3,10 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.configs.constants import TokenRateLimitScope -from danswer.db.models import TokenRateLimit -from danswer.db.models import TokenRateLimit__UserGroup -from danswer.server.token_rate_limits.models import TokenRateLimitArgs +from onyx.configs.constants import TokenRateLimitScope +from onyx.db.models import TokenRateLimit +from onyx.db.models import TokenRateLimit__UserGroup +from onyx.server.token_rate_limits.models import TokenRateLimitArgs def fetch_all_user_token_rate_limits( diff --git a/backend/danswer/db/tools.py b/backend/onyx/db/tools.py similarity index 92% rename from backend/danswer/db/tools.py rename to backend/onyx/db/tools.py index a89dafef385..6ecb6f2fe49 100644 --- a/backend/danswer/db/tools.py +++ b/backend/onyx/db/tools.py @@ -5,10 +5,10 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.db.models import Tool -from danswer.server.features.tool.models import Header -from danswer.utils.headers import HeaderItemDict -from danswer.utils.logger import setup_logger +from onyx.db.models import Tool +from onyx.server.features.tool.models import Header +from onyx.utils.headers import HeaderItemDict +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/db/users.py b/backend/onyx/db/users.py similarity index 96% rename from backend/danswer/db/users.py rename to backend/onyx/db/users.py index 5014c35cbec..7263e48b54f 100644 --- a/backend/danswer/db/users.py +++ b/backend/onyx/db/users.py @@ -7,8 +7,8 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.auth.schemas import UserRole -from danswer.db.models import User +from onyx.auth.schemas import UserRole +from onyx.db.models import User def validate_user_role_update(requested_role: UserRole, current_role: UserRole) -> None: @@ -28,20 +28,20 @@ def validate_user_role_update(requested_role: UserRole, current_role: UserRole) if current_role == UserRole.SLACK_USER: raise HTTPException( status_code=400, - detail="To change a Slack User's role, they must first login to Danswer via the web app.", + detail="To change a Slack User's role, they must first login to Onyx via the web app.", ) if current_role == UserRole.EXT_PERM_USER: # This shouldn't happen, but just in case raise HTTPException( status_code=400, - detail="To change an External Permissioned User's role, they must first login to Danswer via the web app.", + detail="To change an External Permissioned User's role, they must first login to Onyx via the web app.", ) if current_role == UserRole.LIMITED: raise HTTPException( status_code=400, - detail="To change a Limited User's role, they must first login to Danswer via the web app.", + detail="To change a Limited User's role, they must first login to Onyx via the web app.", ) if requested_role == UserRole.CURATOR: @@ -67,7 +67,7 @@ def validate_user_role_update(requested_role: UserRole, current_role: UserRole) status_code=400, detail=( "A user cannot be set to a Slack User role. " - "This role is automatically assigned to users who only use Danswer via Slack." + "This role is automatically assigned to users who only use Onyx via Slack." ), ) diff --git a/backend/danswer/db/utils.py b/backend/onyx/db/utils.py similarity index 85% rename from backend/danswer/db/utils.py rename to backend/onyx/db/utils.py index c188543c46a..4582c0148ee 100644 --- a/backend/danswer/db/utils.py +++ b/backend/onyx/db/utils.py @@ -2,7 +2,7 @@ from sqlalchemy import inspect -from danswer.db.models import Base +from onyx.db.models import Base def model_to_dict(model: Base) -> dict[str, Any]: diff --git a/backend/danswer/server/danswer_api/__init__.py b/backend/onyx/document_index/__init__.py similarity index 100% rename from backend/danswer/server/danswer_api/__init__.py rename to backend/onyx/document_index/__init__.py diff --git a/backend/danswer/document_index/document_index_utils.py b/backend/onyx/document_index/document_index_utils.py similarity index 88% rename from backend/danswer/document_index/document_index_utils.py rename to backend/onyx/document_index/document_index_utils.py index c6f48d1b40d..2589ecd035d 100644 --- a/backend/danswer/document_index/document_index_utils.py +++ b/backend/onyx/document_index/document_index_utils.py @@ -3,10 +3,10 @@ from sqlalchemy.orm import Session -from danswer.context.search.models import InferenceChunk -from danswer.db.search_settings import get_current_search_settings -from danswer.db.search_settings import get_secondary_search_settings -from danswer.indexing.models import IndexChunk +from onyx.context.search.models import InferenceChunk +from onyx.db.search_settings import get_current_search_settings +from onyx.db.search_settings import get_secondary_search_settings +from onyx.indexing.models import IndexChunk DEFAULT_BATCH_SIZE = 30 diff --git a/backend/danswer/document_index/factory.py b/backend/onyx/document_index/factory.py similarity index 83% rename from backend/danswer/document_index/factory.py rename to backend/onyx/document_index/factory.py index 92dde3dda43..1949daf754d 100644 --- a/backend/danswer/document_index/factory.py +++ b/backend/onyx/document_index/factory.py @@ -1,8 +1,8 @@ from sqlalchemy.orm import Session -from danswer.db.search_settings import get_current_search_settings -from danswer.document_index.interfaces import DocumentIndex -from danswer.document_index.vespa.index import VespaIndex +from onyx.db.search_settings import get_current_search_settings +from onyx.document_index.interfaces import DocumentIndex +from onyx.document_index.vespa.index import VespaIndex from shared_configs.configs import MULTI_TENANT diff --git a/backend/danswer/document_index/interfaces.py b/backend/onyx/document_index/interfaces.py similarity index 97% rename from backend/danswer/document_index/interfaces.py rename to backend/onyx/document_index/interfaces.py index 5a8c2dda29f..725af0bdcff 100644 --- a/backend/danswer/document_index/interfaces.py +++ b/backend/onyx/document_index/interfaces.py @@ -3,10 +3,10 @@ from datetime import datetime from typing import Any -from danswer.access.models import DocumentAccess -from danswer.context.search.models import IndexFilters -from danswer.context.search.models import InferenceChunkUncleaned -from danswer.indexing.models import DocMetadataAwareIndexChunk +from onyx.access.models import DocumentAccess +from onyx.context.search.models import IndexFilters +from onyx.context.search.models import InferenceChunkUncleaned +from onyx.indexing.models import DocMetadataAwareIndexChunk from shared_configs.model_server_models import Embedding @@ -49,7 +49,7 @@ class DocumentMetadata: first_link: str doc_updated_at: datetime | None = None # Emails, not necessarily attached to users - # Users may not be in Danswer + # Users may not be in Onyx primary_owners: list[str] | None = None secondary_owners: list[str] | None = None from_ingestion_api: bool = False @@ -393,7 +393,7 @@ class BaseIndex( class DocumentIndex(HybridCapable, BaseIndex, abc.ABC): """ - A valid document index that can plug into all Danswer flows must implement all of these + A valid document index that can plug into all Onyx flows must implement all of these functionalities, though "technically" it does not need to be keyword or vector capable as currently all default search flows use Hybrid Search. """ diff --git a/backend/danswer/server/documents/__init__.py b/backend/onyx/document_index/vespa/__init__.py similarity index 100% rename from backend/danswer/server/documents/__init__.py rename to backend/onyx/document_index/vespa/__init__.py diff --git a/backend/danswer/document_index/vespa/app_config/schemas/danswer_chunk.sd b/backend/onyx/document_index/vespa/app_config/schemas/danswer_chunk.sd similarity index 100% rename from backend/danswer/document_index/vespa/app_config/schemas/danswer_chunk.sd rename to backend/onyx/document_index/vespa/app_config/schemas/danswer_chunk.sd diff --git a/backend/danswer/document_index/vespa/app_config/services.xml b/backend/onyx/document_index/vespa/app_config/services.xml similarity index 100% rename from backend/danswer/document_index/vespa/app_config/services.xml rename to backend/onyx/document_index/vespa/app_config/services.xml diff --git a/backend/danswer/document_index/vespa/app_config/validation-overrides.xml b/backend/onyx/document_index/vespa/app_config/validation-overrides.xml similarity index 85% rename from backend/danswer/document_index/vespa/app_config/validation-overrides.xml rename to backend/onyx/document_index/vespa/app_config/validation-overrides.xml index d1ac1c119e5..c5d1598bfc1 100644 --- a/backend/danswer/document_index/vespa/app_config/validation-overrides.xml +++ b/backend/onyx/document_index/vespa/app_config/validation-overrides.xml @@ -4,5 +4,5 @@ comment="We need to be able to create/delete indices for swapping models">schema-removal indexing-change + comment="We need to be able to update the schema for updates to the Onyx schema">indexing-change diff --git a/backend/danswer/document_index/vespa/chunk_retrieval.py b/backend/onyx/document_index/vespa/chunk_retrieval.py similarity index 86% rename from backend/danswer/document_index/vespa/chunk_retrieval.py rename to backend/onyx/document_index/vespa/chunk_retrieval.py index 6715dc76ae1..c5b34950ee6 100644 --- a/backend/danswer/document_index/vespa/chunk_retrieval.py +++ b/backend/onyx/document_index/vespa/chunk_retrieval.py @@ -10,44 +10,44 @@ import httpx from retry import retry -from danswer.configs.app_configs import LOG_VESPA_TIMING_INFORMATION -from danswer.context.search.models import IndexFilters -from danswer.context.search.models import InferenceChunkUncleaned -from danswer.document_index.interfaces import VespaChunkRequest -from danswer.document_index.vespa.shared_utils.utils import get_vespa_http_client -from danswer.document_index.vespa.shared_utils.vespa_request_builders import ( +from onyx.configs.app_configs import LOG_VESPA_TIMING_INFORMATION +from onyx.context.search.models import IndexFilters +from onyx.context.search.models import InferenceChunkUncleaned +from onyx.document_index.interfaces import VespaChunkRequest +from onyx.document_index.vespa.shared_utils.utils import get_vespa_http_client +from onyx.document_index.vespa.shared_utils.vespa_request_builders import ( build_vespa_filters, ) -from danswer.document_index.vespa.shared_utils.vespa_request_builders import ( +from onyx.document_index.vespa.shared_utils.vespa_request_builders import ( build_vespa_id_based_retrieval_yql, ) -from danswer.document_index.vespa_constants import ACCESS_CONTROL_LIST -from danswer.document_index.vespa_constants import BLURB -from danswer.document_index.vespa_constants import BOOST -from danswer.document_index.vespa_constants import CHUNK_ID -from danswer.document_index.vespa_constants import CONTENT -from danswer.document_index.vespa_constants import CONTENT_SUMMARY -from danswer.document_index.vespa_constants import DOC_UPDATED_AT -from danswer.document_index.vespa_constants import DOCUMENT_ID -from danswer.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT -from danswer.document_index.vespa_constants import HIDDEN -from danswer.document_index.vespa_constants import LARGE_CHUNK_REFERENCE_IDS -from danswer.document_index.vespa_constants import MAX_ID_SEARCH_QUERY_SIZE -from danswer.document_index.vespa_constants import MAX_OR_CONDITIONS -from danswer.document_index.vespa_constants import METADATA -from danswer.document_index.vespa_constants import METADATA_SUFFIX -from danswer.document_index.vespa_constants import PRIMARY_OWNERS -from danswer.document_index.vespa_constants import RECENCY_BIAS -from danswer.document_index.vespa_constants import SEARCH_ENDPOINT -from danswer.document_index.vespa_constants import SECONDARY_OWNERS -from danswer.document_index.vespa_constants import SECTION_CONTINUATION -from danswer.document_index.vespa_constants import SEMANTIC_IDENTIFIER -from danswer.document_index.vespa_constants import SOURCE_LINKS -from danswer.document_index.vespa_constants import SOURCE_TYPE -from danswer.document_index.vespa_constants import TITLE -from danswer.document_index.vespa_constants import YQL_BASE -from danswer.utils.logger import setup_logger -from danswer.utils.threadpool_concurrency import run_functions_tuples_in_parallel +from onyx.document_index.vespa_constants import ACCESS_CONTROL_LIST +from onyx.document_index.vespa_constants import BLURB +from onyx.document_index.vespa_constants import BOOST +from onyx.document_index.vespa_constants import CHUNK_ID +from onyx.document_index.vespa_constants import CONTENT +from onyx.document_index.vespa_constants import CONTENT_SUMMARY +from onyx.document_index.vespa_constants import DOC_UPDATED_AT +from onyx.document_index.vespa_constants import DOCUMENT_ID +from onyx.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT +from onyx.document_index.vespa_constants import HIDDEN +from onyx.document_index.vespa_constants import LARGE_CHUNK_REFERENCE_IDS +from onyx.document_index.vespa_constants import MAX_ID_SEARCH_QUERY_SIZE +from onyx.document_index.vespa_constants import MAX_OR_CONDITIONS +from onyx.document_index.vespa_constants import METADATA +from onyx.document_index.vespa_constants import METADATA_SUFFIX +from onyx.document_index.vespa_constants import PRIMARY_OWNERS +from onyx.document_index.vespa_constants import RECENCY_BIAS +from onyx.document_index.vespa_constants import SEARCH_ENDPOINT +from onyx.document_index.vespa_constants import SECONDARY_OWNERS +from onyx.document_index.vespa_constants import SECTION_CONTINUATION +from onyx.document_index.vespa_constants import SEMANTIC_IDENTIFIER +from onyx.document_index.vespa_constants import SOURCE_LINKS +from onyx.document_index.vespa_constants import SOURCE_TYPE +from onyx.document_index.vespa_constants import TITLE +from onyx.document_index.vespa_constants import YQL_BASE +from onyx.utils.logger import setup_logger +from onyx.utils.threadpool_concurrency import run_functions_tuples_in_parallel logger = setup_logger() diff --git a/backend/danswer/document_index/vespa/deletion.py b/backend/onyx/document_index/vespa/deletion.py similarity index 87% rename from backend/danswer/document_index/vespa/deletion.py rename to backend/onyx/document_index/vespa/deletion.py index 3c8b7b97f15..a87733dadbe 100644 --- a/backend/danswer/document_index/vespa/deletion.py +++ b/backend/onyx/document_index/vespa/deletion.py @@ -3,12 +3,12 @@ import httpx from retry import retry -from danswer.document_index.vespa.chunk_retrieval import ( +from onyx.document_index.vespa.chunk_retrieval import ( get_all_vespa_ids_for_document_id, ) -from danswer.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT -from danswer.document_index.vespa_constants import NUM_THREADS -from danswer.utils.logger import setup_logger +from onyx.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT +from onyx.document_index.vespa_constants import NUM_THREADS +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/document_index/vespa/index.py b/backend/onyx/document_index/vespa/index.py similarity index 90% rename from backend/danswer/document_index/vespa/index.py rename to backend/onyx/document_index/vespa/index.py index 87b99cda894..f3639948b5a 100644 --- a/backend/danswer/document_index/vespa/index.py +++ b/backend/onyx/document_index/vespa/index.py @@ -16,62 +16,62 @@ import httpx # type: ignore import requests # type: ignore -from danswer.configs.app_configs import DOCUMENT_INDEX_NAME -from danswer.configs.chat_configs import DOC_TIME_DECAY -from danswer.configs.chat_configs import NUM_RETURNED_HITS -from danswer.configs.chat_configs import TITLE_CONTENT_RATIO -from danswer.configs.chat_configs import VESPA_SEARCHER_THREADS -from danswer.configs.constants import KV_REINDEX_KEY -from danswer.context.search.models import IndexFilters -from danswer.context.search.models import InferenceChunkUncleaned -from danswer.document_index.interfaces import DocumentIndex -from danswer.document_index.interfaces import DocumentInsertionRecord -from danswer.document_index.interfaces import UpdateRequest -from danswer.document_index.interfaces import VespaChunkRequest -from danswer.document_index.interfaces import VespaDocumentFields -from danswer.document_index.vespa.chunk_retrieval import batch_search_api_retrieval -from danswer.document_index.vespa.chunk_retrieval import ( +from onyx.configs.app_configs import DOCUMENT_INDEX_NAME +from onyx.configs.chat_configs import DOC_TIME_DECAY +from onyx.configs.chat_configs import NUM_RETURNED_HITS +from onyx.configs.chat_configs import TITLE_CONTENT_RATIO +from onyx.configs.chat_configs import VESPA_SEARCHER_THREADS +from onyx.configs.constants import KV_REINDEX_KEY +from onyx.context.search.models import IndexFilters +from onyx.context.search.models import InferenceChunkUncleaned +from onyx.document_index.interfaces import DocumentIndex +from onyx.document_index.interfaces import DocumentInsertionRecord +from onyx.document_index.interfaces import UpdateRequest +from onyx.document_index.interfaces import VespaChunkRequest +from onyx.document_index.interfaces import VespaDocumentFields +from onyx.document_index.vespa.chunk_retrieval import batch_search_api_retrieval +from onyx.document_index.vespa.chunk_retrieval import ( get_all_vespa_ids_for_document_id, ) -from danswer.document_index.vespa.chunk_retrieval import ( +from onyx.document_index.vespa.chunk_retrieval import ( parallel_visit_api_retrieval, ) -from danswer.document_index.vespa.chunk_retrieval import query_vespa -from danswer.document_index.vespa.deletion import delete_vespa_docs -from danswer.document_index.vespa.indexing_utils import batch_index_vespa_chunks -from danswer.document_index.vespa.indexing_utils import clean_chunk_id_copy -from danswer.document_index.vespa.indexing_utils import ( +from onyx.document_index.vespa.chunk_retrieval import query_vespa +from onyx.document_index.vespa.deletion import delete_vespa_docs +from onyx.document_index.vespa.indexing_utils import batch_index_vespa_chunks +from onyx.document_index.vespa.indexing_utils import clean_chunk_id_copy +from onyx.document_index.vespa.indexing_utils import ( get_existing_documents_from_chunks, ) -from danswer.document_index.vespa.shared_utils.utils import get_vespa_http_client -from danswer.document_index.vespa.shared_utils.utils import ( +from onyx.document_index.vespa.shared_utils.utils import get_vespa_http_client +from onyx.document_index.vespa.shared_utils.utils import ( replace_invalid_doc_id_characters, ) -from danswer.document_index.vespa.shared_utils.vespa_request_builders import ( +from onyx.document_index.vespa.shared_utils.vespa_request_builders import ( build_vespa_filters, ) -from danswer.document_index.vespa_constants import ACCESS_CONTROL_LIST -from danswer.document_index.vespa_constants import BATCH_SIZE -from danswer.document_index.vespa_constants import BOOST -from danswer.document_index.vespa_constants import CONTENT_SUMMARY -from danswer.document_index.vespa_constants import DANSWER_CHUNK_REPLACEMENT_PAT -from danswer.document_index.vespa_constants import DATE_REPLACEMENT -from danswer.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT -from danswer.document_index.vespa_constants import DOCUMENT_REPLACEMENT_PAT -from danswer.document_index.vespa_constants import DOCUMENT_SETS -from danswer.document_index.vespa_constants import HIDDEN -from danswer.document_index.vespa_constants import NUM_THREADS -from danswer.document_index.vespa_constants import SEARCH_THREAD_NUMBER_PAT -from danswer.document_index.vespa_constants import TENANT_ID_PAT -from danswer.document_index.vespa_constants import TENANT_ID_REPLACEMENT -from danswer.document_index.vespa_constants import VESPA_APPLICATION_ENDPOINT -from danswer.document_index.vespa_constants import VESPA_DIM_REPLACEMENT_PAT -from danswer.document_index.vespa_constants import VESPA_TIMEOUT -from danswer.document_index.vespa_constants import YQL_BASE -from danswer.indexing.models import DocMetadataAwareIndexChunk -from danswer.key_value_store.factory import get_kv_store -from danswer.utils.batching import batch_generator -from danswer.utils.logger import setup_logger +from onyx.document_index.vespa_constants import ACCESS_CONTROL_LIST +from onyx.document_index.vespa_constants import BATCH_SIZE +from onyx.document_index.vespa_constants import BOOST +from onyx.document_index.vespa_constants import CONTENT_SUMMARY +from onyx.document_index.vespa_constants import DANSWER_CHUNK_REPLACEMENT_PAT +from onyx.document_index.vespa_constants import DATE_REPLACEMENT +from onyx.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT +from onyx.document_index.vespa_constants import DOCUMENT_REPLACEMENT_PAT +from onyx.document_index.vespa_constants import DOCUMENT_SETS +from onyx.document_index.vespa_constants import HIDDEN +from onyx.document_index.vespa_constants import NUM_THREADS +from onyx.document_index.vespa_constants import SEARCH_THREAD_NUMBER_PAT +from onyx.document_index.vespa_constants import TENANT_ID_PAT +from onyx.document_index.vespa_constants import TENANT_ID_REPLACEMENT +from onyx.document_index.vespa_constants import VESPA_APPLICATION_ENDPOINT +from onyx.document_index.vespa_constants import VESPA_DIM_REPLACEMENT_PAT +from onyx.document_index.vespa_constants import VESPA_TIMEOUT +from onyx.document_index.vespa_constants import YQL_BASE +from onyx.indexing.models import DocMetadataAwareIndexChunk +from onyx.key_value_store.factory import get_kv_store +from onyx.utils.batching import batch_generator +from onyx.utils.logger import setup_logger from shared_configs.configs import MULTI_TENANT from shared_configs.model_server_models import Embedding @@ -150,7 +150,7 @@ def ensure_indices_exist( logger.notice(f"Deploying Vespa application package to {deploy_url}") vespa_schema_path = os.path.join( - os.getcwd(), "danswer", "document_index", "vespa", "app_config" + os.getcwd(), "onyx", "document_index", "vespa", "app_config" ) schema_file = os.path.join(vespa_schema_path, "schemas", "danswer_chunk.sd") services_file = os.path.join(vespa_schema_path, "services.xml") @@ -215,7 +215,7 @@ def ensure_indices_exist( response = requests.post(deploy_url, headers=headers, data=zip_file) if response.status_code != 200: raise RuntimeError( - f"Failed to prepare Vespa Danswer Index. Response: {response.text}" + f"Failed to prepare Vespa Onyx Index. Response: {response.text}" ) @staticmethod @@ -230,7 +230,7 @@ def register_multitenant_indices( logger.info(f"Deploying Vespa application package to {deploy_url}") vespa_schema_path = os.path.join( - os.getcwd(), "danswer", "document_index", "vespa", "app_config" + os.getcwd(), "onyx", "document_index", "vespa", "app_config" ) schema_file = os.path.join(vespa_schema_path, "schemas", "danswer_chunk.sd") services_file = os.path.join(vespa_schema_path, "services.xml") @@ -300,7 +300,7 @@ def register_multitenant_indices( if response.status_code != 200: raise RuntimeError( - f"Failed to prepare Vespa Danswer Indexes. Response: {response.text}" + f"Failed to prepare Vespa Onyx Indexes. Response: {response.text}" ) def index( diff --git a/backend/danswer/document_index/vespa/indexing_utils.py b/backend/onyx/document_index/vespa/indexing_utils.py similarity index 78% rename from backend/danswer/document_index/vespa/indexing_utils.py rename to backend/onyx/document_index/vespa/indexing_utils.py index e6913cd9976..bfb0bd94163 100644 --- a/backend/danswer/document_index/vespa/indexing_utils.py +++ b/backend/onyx/document_index/vespa/indexing_utils.py @@ -7,42 +7,42 @@ import httpx from retry import retry -from danswer.connectors.cross_connector_utils.miscellaneous_utils import ( +from onyx.connectors.cross_connector_utils.miscellaneous_utils import ( get_experts_stores_representations, ) -from danswer.document_index.document_index_utils import get_uuid_from_chunk -from danswer.document_index.vespa.shared_utils.utils import remove_invalid_unicode_chars -from danswer.document_index.vespa.shared_utils.utils import ( +from onyx.document_index.document_index_utils import get_uuid_from_chunk +from onyx.document_index.vespa.shared_utils.utils import remove_invalid_unicode_chars +from onyx.document_index.vespa.shared_utils.utils import ( replace_invalid_doc_id_characters, ) -from danswer.document_index.vespa_constants import ACCESS_CONTROL_LIST -from danswer.document_index.vespa_constants import BLURB -from danswer.document_index.vespa_constants import BOOST -from danswer.document_index.vespa_constants import CHUNK_ID -from danswer.document_index.vespa_constants import CONTENT -from danswer.document_index.vespa_constants import CONTENT_SUMMARY -from danswer.document_index.vespa_constants import DOC_UPDATED_AT -from danswer.document_index.vespa_constants import DOCUMENT_ID -from danswer.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT -from danswer.document_index.vespa_constants import DOCUMENT_SETS -from danswer.document_index.vespa_constants import EMBEDDINGS -from danswer.document_index.vespa_constants import LARGE_CHUNK_REFERENCE_IDS -from danswer.document_index.vespa_constants import METADATA -from danswer.document_index.vespa_constants import METADATA_LIST -from danswer.document_index.vespa_constants import METADATA_SUFFIX -from danswer.document_index.vespa_constants import NUM_THREADS -from danswer.document_index.vespa_constants import PRIMARY_OWNERS -from danswer.document_index.vespa_constants import SECONDARY_OWNERS -from danswer.document_index.vespa_constants import SECTION_CONTINUATION -from danswer.document_index.vespa_constants import SEMANTIC_IDENTIFIER -from danswer.document_index.vespa_constants import SKIP_TITLE_EMBEDDING -from danswer.document_index.vespa_constants import SOURCE_LINKS -from danswer.document_index.vespa_constants import SOURCE_TYPE -from danswer.document_index.vespa_constants import TENANT_ID -from danswer.document_index.vespa_constants import TITLE -from danswer.document_index.vespa_constants import TITLE_EMBEDDING -from danswer.indexing.models import DocMetadataAwareIndexChunk -from danswer.utils.logger import setup_logger +from onyx.document_index.vespa_constants import ACCESS_CONTROL_LIST +from onyx.document_index.vespa_constants import BLURB +from onyx.document_index.vespa_constants import BOOST +from onyx.document_index.vespa_constants import CHUNK_ID +from onyx.document_index.vespa_constants import CONTENT +from onyx.document_index.vespa_constants import CONTENT_SUMMARY +from onyx.document_index.vespa_constants import DOC_UPDATED_AT +from onyx.document_index.vespa_constants import DOCUMENT_ID +from onyx.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT +from onyx.document_index.vespa_constants import DOCUMENT_SETS +from onyx.document_index.vespa_constants import EMBEDDINGS +from onyx.document_index.vespa_constants import LARGE_CHUNK_REFERENCE_IDS +from onyx.document_index.vespa_constants import METADATA +from onyx.document_index.vespa_constants import METADATA_LIST +from onyx.document_index.vespa_constants import METADATA_SUFFIX +from onyx.document_index.vespa_constants import NUM_THREADS +from onyx.document_index.vespa_constants import PRIMARY_OWNERS +from onyx.document_index.vespa_constants import SECONDARY_OWNERS +from onyx.document_index.vespa_constants import SECTION_CONTINUATION +from onyx.document_index.vespa_constants import SEMANTIC_IDENTIFIER +from onyx.document_index.vespa_constants import SKIP_TITLE_EMBEDDING +from onyx.document_index.vespa_constants import SOURCE_LINKS +from onyx.document_index.vespa_constants import SOURCE_TYPE +from onyx.document_index.vespa_constants import TENANT_ID +from onyx.document_index.vespa_constants import TITLE +from onyx.document_index.vespa_constants import TITLE_EMBEDDING +from onyx.indexing.models import DocMetadataAwareIndexChunk +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -54,7 +54,7 @@ def _does_document_exist( http_client: httpx.Client, ) -> bool: """Returns whether the document already exists and the users/group whitelists - Specifically in this case, document refers to a vespa document which is equivalent to a Danswer + Specifically in this case, document refers to a vespa document which is equivalent to a Onyx chunk. This checks for whether the chunk exists already in the index""" doc_url = f"{DOCUMENT_ID_ENDPOINT.format(index_name=index_name)}/{doc_chunk_id}" doc_fetch_response = http_client.get(doc_url) diff --git a/backend/danswer/document_index/vespa/shared_utils/utils.py b/backend/onyx/document_index/vespa/shared_utils/utils.py similarity index 90% rename from backend/danswer/document_index/vespa/shared_utils/utils.py rename to backend/onyx/document_index/vespa/shared_utils/utils.py index 49fdd680198..175b2afa9cc 100644 --- a/backend/danswer/document_index/vespa/shared_utils/utils.py +++ b/backend/onyx/document_index/vespa/shared_utils/utils.py @@ -3,10 +3,10 @@ import httpx -from danswer.configs.app_configs import MANAGED_VESPA -from danswer.configs.app_configs import VESPA_CLOUD_CERT_PATH -from danswer.configs.app_configs import VESPA_CLOUD_KEY_PATH -from danswer.configs.app_configs import VESPA_REQUEST_TIMEOUT +from onyx.configs.app_configs import MANAGED_VESPA +from onyx.configs.app_configs import VESPA_CLOUD_CERT_PATH +from onyx.configs.app_configs import VESPA_CLOUD_KEY_PATH +from onyx.configs.app_configs import VESPA_REQUEST_TIMEOUT # NOTE: This does not seem to be used in reality despite the Vespa Docs pointing to this code # See here for reference: https://docs.vespa.ai/en/documents.html diff --git a/backend/danswer/document_index/vespa/shared_utils/vespa_request_builders.py b/backend/onyx/document_index/vespa/shared_utils/vespa_request_builders.py similarity index 78% rename from backend/danswer/document_index/vespa/shared_utils/vespa_request_builders.py rename to backend/onyx/document_index/vespa/shared_utils/vespa_request_builders.py index a3261288dda..a1752d52c23 100644 --- a/backend/danswer/document_index/vespa/shared_utils/vespa_request_builders.py +++ b/backend/onyx/document_index/vespa/shared_utils/vespa_request_builders.py @@ -2,19 +2,19 @@ from datetime import timedelta from datetime import timezone -from danswer.configs.constants import INDEX_SEPARATOR -from danswer.context.search.models import IndexFilters -from danswer.document_index.interfaces import VespaChunkRequest -from danswer.document_index.vespa_constants import ACCESS_CONTROL_LIST -from danswer.document_index.vespa_constants import CHUNK_ID -from danswer.document_index.vespa_constants import DOC_UPDATED_AT -from danswer.document_index.vespa_constants import DOCUMENT_ID -from danswer.document_index.vespa_constants import DOCUMENT_SETS -from danswer.document_index.vespa_constants import HIDDEN -from danswer.document_index.vespa_constants import METADATA_LIST -from danswer.document_index.vespa_constants import SOURCE_TYPE -from danswer.document_index.vespa_constants import TENANT_ID -from danswer.utils.logger import setup_logger +from onyx.configs.constants import INDEX_SEPARATOR +from onyx.context.search.models import IndexFilters +from onyx.document_index.interfaces import VespaChunkRequest +from onyx.document_index.vespa_constants import ACCESS_CONTROL_LIST +from onyx.document_index.vespa_constants import CHUNK_ID +from onyx.document_index.vespa_constants import DOC_UPDATED_AT +from onyx.document_index.vespa_constants import DOCUMENT_ID +from onyx.document_index.vespa_constants import DOCUMENT_SETS +from onyx.document_index.vespa_constants import HIDDEN +from onyx.document_index.vespa_constants import METADATA_LIST +from onyx.document_index.vespa_constants import SOURCE_TYPE +from onyx.document_index.vespa_constants import TENANT_ID +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/document_index/vespa_constants.py b/backend/onyx/document_index/vespa_constants.py similarity index 90% rename from backend/danswer/document_index/vespa_constants.py rename to backend/onyx/document_index/vespa_constants.py index 30039922f1a..aff4e85566d 100644 --- a/backend/danswer/document_index/vespa_constants.py +++ b/backend/onyx/document_index/vespa_constants.py @@ -1,9 +1,9 @@ -from danswer.configs.app_configs import VESPA_CLOUD_URL -from danswer.configs.app_configs import VESPA_CONFIG_SERVER_HOST -from danswer.configs.app_configs import VESPA_HOST -from danswer.configs.app_configs import VESPA_PORT -from danswer.configs.app_configs import VESPA_TENANT_PORT -from danswer.configs.constants import SOURCE_TYPE +from onyx.configs.app_configs import VESPA_CLOUD_URL +from onyx.configs.app_configs import VESPA_CONFIG_SERVER_HOST +from onyx.configs.app_configs import VESPA_HOST +from onyx.configs.app_configs import VESPA_PORT +from onyx.configs.app_configs import VESPA_TENANT_PORT +from onyx.configs.constants import SOURCE_TYPE VESPA_DIM_REPLACEMENT_PAT = "VARIABLE_DIM" DANSWER_CHUNK_REPLACEMENT_PAT = "DANSWER_CHUNK_NAME" diff --git a/backend/danswer/server/features/__init__.py b/backend/onyx/file_processing/__init__.py similarity index 100% rename from backend/danswer/server/features/__init__.py rename to backend/onyx/file_processing/__init__.py diff --git a/backend/danswer/file_processing/enums.py b/backend/onyx/file_processing/enums.py similarity index 100% rename from backend/danswer/file_processing/enums.py rename to backend/onyx/file_processing/enums.py diff --git a/backend/danswer/file_processing/extract_file_text.py b/backend/onyx/file_processing/extract_file_text.py similarity index 94% rename from backend/danswer/file_processing/extract_file_text.py rename to backend/onyx/file_processing/extract_file_text.py index 58016e80d63..b5cbe4556e0 100644 --- a/backend/danswer/file_processing/extract_file_text.py +++ b/backend/onyx/file_processing/extract_file_text.py @@ -21,13 +21,13 @@ from pypdf import PdfReader from pypdf.errors import PdfStreamError -from danswer.configs.constants import DANSWER_METADATA_FILENAME -from danswer.configs.constants import FileOrigin -from danswer.file_processing.html_utils import parse_html_page_basic -from danswer.file_processing.unstructured import get_unstructured_api_key -from danswer.file_processing.unstructured import unstructured_to_text -from danswer.file_store.file_store import FileStore -from danswer.utils.logger import setup_logger +from onyx.configs.constants import DANSWER_METADATA_FILENAME +from onyx.configs.constants import FileOrigin +from onyx.file_processing.html_utils import parse_html_page_basic +from onyx.file_processing.unstructured import get_unstructured_api_key +from onyx.file_processing.unstructured import unstructured_to_text +from onyx.file_store.file_store import FileStore +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -97,7 +97,7 @@ def is_macos_resource_fork_file(file_name: str) -> bool: ) -# To include additional metadata in the search index, add a .danswer_metadata.json file +# To include additional metadata in the search index, add a .onyx_metadata.json file # to the zip file. This file should contain a list of objects with the following format: # [{ "filename": "file1.txt", "link": "https://example.com/file1.txt" }] def load_files_from_zip( @@ -133,7 +133,7 @@ def load_files_from_zip( yield file_info, file, zip_metadata.get(file_info.filename, {}) -def _extract_danswer_metadata(line: str) -> dict | None: +def _extract_onyx_metadata(line: str) -> dict | None: html_comment_pattern = r"" hashtag_pattern = r"#DANSWER_METADATA=\{(.*?)\}" @@ -157,7 +157,7 @@ def read_text_file( file: IO, encoding: str = "utf-8", errors: str = "replace", - ignore_danswer_metadata: bool = True, + ignore_onyx_metadata: bool = True, ) -> tuple[str, dict]: metadata = {} file_content_raw = "" @@ -173,7 +173,7 @@ def read_text_file( if ind == 0: metadata_or_none = ( - None if ignore_danswer_metadata else _extract_danswer_metadata(line) + None if ignore_onyx_metadata else _extract_onyx_metadata(line) ) if metadata_or_none is not None: metadata = metadata_or_none diff --git a/backend/danswer/file_processing/html_utils.py b/backend/onyx/file_processing/html_utils.py similarity index 94% rename from backend/danswer/file_processing/html_utils.py rename to backend/onyx/file_processing/html_utils.py index d1948d011f5..4c4442f7376 100644 --- a/backend/danswer/file_processing/html_utils.py +++ b/backend/onyx/file_processing/html_utils.py @@ -7,12 +7,12 @@ import trafilatura # type: ignore from trafilatura.settings import use_config # type: ignore -from danswer.configs.app_configs import HTML_BASED_CONNECTOR_TRANSFORM_LINKS_STRATEGY -from danswer.configs.app_configs import PARSE_WITH_TRAFILATURA -from danswer.configs.app_configs import WEB_CONNECTOR_IGNORED_CLASSES -from danswer.configs.app_configs import WEB_CONNECTOR_IGNORED_ELEMENTS -from danswer.file_processing.enums import HtmlBasedConnectorTransformLinksStrategy -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import HTML_BASED_CONNECTOR_TRANSFORM_LINKS_STRATEGY +from onyx.configs.app_configs import PARSE_WITH_TRAFILATURA +from onyx.configs.app_configs import WEB_CONNECTOR_IGNORED_CLASSES +from onyx.configs.app_configs import WEB_CONNECTOR_IGNORED_ELEMENTS +from onyx.file_processing.enums import HtmlBasedConnectorTransformLinksStrategy +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/file_processing/unstructured.py b/backend/onyx/file_processing/unstructured.py similarity index 89% rename from backend/danswer/file_processing/unstructured.py rename to backend/onyx/file_processing/unstructured.py index dc61869ee9c..4faa14a1ad0 100644 --- a/backend/danswer/file_processing/unstructured.py +++ b/backend/onyx/file_processing/unstructured.py @@ -7,10 +7,10 @@ from unstructured_client.models import operations # type: ignore from unstructured_client.models import shared -from danswer.configs.constants import KV_UNSTRUCTURED_API_KEY -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.utils.logger import setup_logger +from onyx.configs.constants import KV_UNSTRUCTURED_API_KEY +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/file_store/constants.py b/backend/onyx/file_store/constants.py similarity index 100% rename from backend/danswer/file_store/constants.py rename to backend/onyx/file_store/constants.py diff --git a/backend/danswer/file_store/file_store.py b/backend/onyx/file_store/file_store.py similarity index 90% rename from backend/danswer/file_store/file_store.py rename to backend/onyx/file_store/file_store.py index e57b9222a1b..9d86602dd49 100644 --- a/backend/danswer/file_store/file_store.py +++ b/backend/onyx/file_store/file_store.py @@ -4,14 +4,14 @@ from sqlalchemy.orm import Session -from danswer.configs.constants import FileOrigin -from danswer.db.models import PGFileStore -from danswer.db.pg_file_store import create_populate_lobj -from danswer.db.pg_file_store import delete_lobj_by_id -from danswer.db.pg_file_store import delete_pgfilestore_by_file_name -from danswer.db.pg_file_store import get_pgfilestore_by_file_name -from danswer.db.pg_file_store import read_lobj -from danswer.db.pg_file_store import upsert_pgfilestore +from onyx.configs.constants import FileOrigin +from onyx.db.models import PGFileStore +from onyx.db.pg_file_store import create_populate_lobj +from onyx.db.pg_file_store import delete_lobj_by_id +from onyx.db.pg_file_store import delete_pgfilestore_by_file_name +from onyx.db.pg_file_store import get_pgfilestore_by_file_name +from onyx.db.pg_file_store import read_lobj +from onyx.db.pg_file_store import upsert_pgfilestore class FileStore(ABC): diff --git a/backend/danswer/file_store/models.py b/backend/onyx/file_store/models.py similarity index 100% rename from backend/danswer/file_store/models.py rename to backend/onyx/file_store/models.py diff --git a/backend/danswer/file_store/utils.py b/backend/onyx/file_store/utils.py similarity index 89% rename from backend/danswer/file_store/utils.py rename to backend/onyx/file_store/utils.py index 978bb92e6be..2541a3611a9 100644 --- a/backend/danswer/file_store/utils.py +++ b/backend/onyx/file_store/utils.py @@ -7,14 +7,14 @@ import requests from sqlalchemy.orm import Session -from danswer.configs.constants import FileOrigin -from danswer.db.engine import get_session_with_tenant -from danswer.db.models import ChatMessage -from danswer.file_store.file_store import get_default_file_store -from danswer.file_store.models import FileDescriptor -from danswer.file_store.models import InMemoryChatFile -from danswer.utils.b64 import get_image_type -from danswer.utils.threadpool_concurrency import run_functions_tuples_in_parallel +from onyx.configs.constants import FileOrigin +from onyx.db.engine import get_session_with_tenant +from onyx.db.models import ChatMessage +from onyx.file_store.file_store import get_default_file_store +from onyx.file_store.models import FileDescriptor +from onyx.file_store.models import InMemoryChatFile +from onyx.utils.b64 import get_image_type +from onyx.utils.threadpool_concurrency import run_functions_tuples_in_parallel def load_chat_file( diff --git a/backend/danswer/server/features/document_set/__init__.py b/backend/onyx/indexing/__init__.py similarity index 100% rename from backend/danswer/server/features/document_set/__init__.py rename to backend/onyx/indexing/__init__.py diff --git a/backend/danswer/indexing/chunker.py b/backend/onyx/indexing/chunker.py similarity index 93% rename from backend/danswer/indexing/chunker.py rename to backend/onyx/indexing/chunker.py index 86209624d2e..5756481e4e7 100644 --- a/backend/danswer/indexing/chunker.py +++ b/backend/onyx/indexing/chunker.py @@ -1,21 +1,21 @@ -from danswer.configs.app_configs import BLURB_SIZE -from danswer.configs.app_configs import LARGE_CHUNK_RATIO -from danswer.configs.app_configs import MINI_CHUNK_SIZE -from danswer.configs.app_configs import SKIP_METADATA_IN_CHUNK -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import RETURN_SEPARATOR -from danswer.configs.constants import SECTION_SEPARATOR -from danswer.configs.model_configs import DOC_EMBEDDING_CONTEXT_SIZE -from danswer.connectors.cross_connector_utils.miscellaneous_utils import ( +from onyx.configs.app_configs import BLURB_SIZE +from onyx.configs.app_configs import LARGE_CHUNK_RATIO +from onyx.configs.app_configs import MINI_CHUNK_SIZE +from onyx.configs.app_configs import SKIP_METADATA_IN_CHUNK +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import RETURN_SEPARATOR +from onyx.configs.constants import SECTION_SEPARATOR +from onyx.configs.model_configs import DOC_EMBEDDING_CONTEXT_SIZE +from onyx.connectors.cross_connector_utils.miscellaneous_utils import ( get_metadata_keys_to_ignore, ) -from danswer.connectors.models import Document -from danswer.indexing.indexing_heartbeat import IndexingHeartbeatInterface -from danswer.indexing.models import DocAwareChunk -from danswer.natural_language_processing.utils import BaseTokenizer -from danswer.utils.logger import setup_logger -from danswer.utils.text_processing import clean_text -from danswer.utils.text_processing import shared_precompare_cleanup +from onyx.connectors.models import Document +from onyx.indexing.indexing_heartbeat import IndexingHeartbeatInterface +from onyx.indexing.models import DocAwareChunk +from onyx.natural_language_processing.utils import BaseTokenizer +from onyx.utils.logger import setup_logger +from onyx.utils.text_processing import clean_text +from onyx.utils.text_processing import shared_precompare_cleanup from shared_configs.configs import STRICT_CHUNK_TOKEN_LIMIT # Not supporting overlaps, we need a clean combination of chunks and it is unclear if overlaps diff --git a/backend/danswer/indexing/embedder.py b/backend/onyx/indexing/embedder.py similarity index 94% rename from backend/danswer/indexing/embedder.py rename to backend/onyx/indexing/embedder.py index 2e975324186..f2e4037d913 100644 --- a/backend/danswer/indexing/embedder.py +++ b/backend/onyx/indexing/embedder.py @@ -1,14 +1,14 @@ from abc import ABC from abc import abstractmethod -from danswer.db.models import SearchSettings -from danswer.indexing.indexing_heartbeat import IndexingHeartbeatInterface -from danswer.indexing.models import ChunkEmbedding -from danswer.indexing.models import DocAwareChunk -from danswer.indexing.models import IndexChunk -from danswer.natural_language_processing.search_nlp_models import EmbeddingModel -from danswer.utils.logger import setup_logger -from danswer.utils.timing import log_function_time +from onyx.db.models import SearchSettings +from onyx.indexing.indexing_heartbeat import IndexingHeartbeatInterface +from onyx.indexing.models import ChunkEmbedding +from onyx.indexing.models import DocAwareChunk +from onyx.indexing.models import IndexChunk +from onyx.natural_language_processing.search_nlp_models import EmbeddingModel +from onyx.utils.logger import setup_logger +from onyx.utils.timing import log_function_time from shared_configs.configs import INDEXING_MODEL_SERVER_HOST from shared_configs.configs import INDEXING_MODEL_SERVER_PORT from shared_configs.enums import EmbeddingProvider diff --git a/backend/danswer/indexing/indexing_heartbeat.py b/backend/onyx/indexing/indexing_heartbeat.py similarity index 100% rename from backend/danswer/indexing/indexing_heartbeat.py rename to backend/onyx/indexing/indexing_heartbeat.py diff --git a/backend/danswer/indexing/indexing_pipeline.py b/backend/onyx/indexing/indexing_pipeline.py similarity index 90% rename from backend/danswer/indexing/indexing_pipeline.py rename to backend/onyx/indexing/indexing_pipeline.py index bace61cec80..da328dc18a3 100644 --- a/backend/danswer/indexing/indexing_pipeline.py +++ b/backend/onyx/indexing/indexing_pipeline.py @@ -9,38 +9,38 @@ from pydantic import ConfigDict from sqlalchemy.orm import Session -from danswer.access.access import get_access_for_documents -from danswer.access.models import DocumentAccess -from danswer.configs.app_configs import ENABLE_MULTIPASS_INDEXING -from danswer.configs.app_configs import INDEXING_EXCEPTION_LIMIT -from danswer.configs.app_configs import MAX_DOCUMENT_CHARS -from danswer.configs.constants import DEFAULT_BOOST -from danswer.connectors.cross_connector_utils.miscellaneous_utils import ( +from onyx.access.access import get_access_for_documents +from onyx.access.models import DocumentAccess +from onyx.configs.app_configs import ENABLE_MULTIPASS_INDEXING +from onyx.configs.app_configs import INDEXING_EXCEPTION_LIMIT +from onyx.configs.app_configs import MAX_DOCUMENT_CHARS +from onyx.configs.constants import DEFAULT_BOOST +from onyx.connectors.cross_connector_utils.miscellaneous_utils import ( get_experts_stores_representations, ) -from danswer.connectors.models import Document -from danswer.connectors.models import IndexAttemptMetadata -from danswer.db.document import get_documents_by_ids -from danswer.db.document import prepare_to_modify_documents -from danswer.db.document import update_docs_last_modified__no_commit -from danswer.db.document import update_docs_updated_at__no_commit -from danswer.db.document import upsert_document_by_connector_credential_pair -from danswer.db.document import upsert_documents -from danswer.db.document_set import fetch_document_sets_for_documents -from danswer.db.index_attempt import create_index_attempt_error -from danswer.db.models import Document as DBDocument -from danswer.db.search_settings import get_current_search_settings -from danswer.db.tag import create_or_add_document_tag -from danswer.db.tag import create_or_add_document_tag_list -from danswer.document_index.interfaces import DocumentIndex -from danswer.document_index.interfaces import DocumentMetadata -from danswer.indexing.chunker import Chunker -from danswer.indexing.embedder import IndexingEmbedder -from danswer.indexing.indexing_heartbeat import IndexingHeartbeatInterface -from danswer.indexing.models import DocAwareChunk -from danswer.indexing.models import DocMetadataAwareIndexChunk -from danswer.utils.logger import setup_logger -from danswer.utils.timing import log_function_time +from onyx.connectors.models import Document +from onyx.connectors.models import IndexAttemptMetadata +from onyx.db.document import get_documents_by_ids +from onyx.db.document import prepare_to_modify_documents +from onyx.db.document import update_docs_last_modified__no_commit +from onyx.db.document import update_docs_updated_at__no_commit +from onyx.db.document import upsert_document_by_connector_credential_pair +from onyx.db.document import upsert_documents +from onyx.db.document_set import fetch_document_sets_for_documents +from onyx.db.index_attempt import create_index_attempt_error +from onyx.db.models import Document as DBDocument +from onyx.db.search_settings import get_current_search_settings +from onyx.db.tag import create_or_add_document_tag +from onyx.db.tag import create_or_add_document_tag_list +from onyx.document_index.interfaces import DocumentIndex +from onyx.document_index.interfaces import DocumentMetadata +from onyx.indexing.chunker import Chunker +from onyx.indexing.embedder import IndexingEmbedder +from onyx.indexing.indexing_heartbeat import IndexingHeartbeatInterface +from onyx.indexing.models import DocAwareChunk +from onyx.indexing.models import DocMetadataAwareIndexChunk +from onyx.utils.logger import setup_logger +from onyx.utils.timing import log_function_time from shared_configs.enums import EmbeddingProvider logger = setup_logger() diff --git a/backend/danswer/indexing/models.py b/backend/onyx/indexing/models.py similarity index 96% rename from backend/danswer/indexing/models.py rename to backend/onyx/indexing/models.py index 39cfa2cca0c..e9a155d172b 100644 --- a/backend/danswer/indexing/models.py +++ b/backend/onyx/indexing/models.py @@ -3,14 +3,14 @@ from pydantic import BaseModel from pydantic import Field -from danswer.access.models import DocumentAccess -from danswer.connectors.models import Document -from danswer.utils.logger import setup_logger +from onyx.access.models import DocumentAccess +from onyx.connectors.models import Document +from onyx.utils.logger import setup_logger from shared_configs.enums import EmbeddingProvider from shared_configs.model_server_models import Embedding if TYPE_CHECKING: - from danswer.db.models import SearchSettings + from onyx.db.models import SearchSettings logger = setup_logger() diff --git a/backend/danswer/server/features/folder/__init__.py b/backend/onyx/key_value_store/__init__.py similarity index 100% rename from backend/danswer/server/features/folder/__init__.py rename to backend/onyx/key_value_store/__init__.py diff --git a/backend/danswer/key_value_store/factory.py b/backend/onyx/key_value_store/factory.py similarity index 66% rename from backend/danswer/key_value_store/factory.py rename to backend/onyx/key_value_store/factory.py index 142e9031b77..c53f7ebac6c 100644 --- a/backend/danswer/key_value_store/factory.py +++ b/backend/onyx/key_value_store/factory.py @@ -1,5 +1,5 @@ -from danswer.key_value_store.interface import KeyValueStore -from danswer.key_value_store.store import PgRedisKVStore +from onyx.key_value_store.interface import KeyValueStore +from onyx.key_value_store.store import PgRedisKVStore def get_kv_store() -> KeyValueStore: diff --git a/backend/danswer/key_value_store/interface.py b/backend/onyx/key_value_store/interface.py similarity index 92% rename from backend/danswer/key_value_store/interface.py rename to backend/onyx/key_value_store/interface.py index 39c10047692..6686d8f36f9 100644 --- a/backend/danswer/key_value_store/interface.py +++ b/backend/onyx/key_value_store/interface.py @@ -1,6 +1,6 @@ import abc -from danswer.utils.special_types import JSON_ro +from onyx.utils.special_types import JSON_ro class KvKeyNotFoundError(Exception): diff --git a/backend/danswer/key_value_store/store.py b/backend/onyx/key_value_store/store.py similarity index 90% rename from backend/danswer/key_value_store/store.py rename to backend/onyx/key_value_store/store.py index cd1df75af7c..b252c17dc62 100644 --- a/backend/danswer/key_value_store/store.py +++ b/backend/onyx/key_value_store/store.py @@ -8,14 +8,14 @@ from sqlalchemy import text from sqlalchemy.orm import Session -from danswer.db.engine import get_sqlalchemy_engine -from danswer.db.engine import is_valid_schema_name -from danswer.db.models import KVStore -from danswer.key_value_store.interface import KeyValueStore -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.redis.redis_pool import get_redis_client -from danswer.utils.logger import setup_logger -from danswer.utils.special_types import JSON_ro +from onyx.db.engine import get_sqlalchemy_engine +from onyx.db.engine import is_valid_schema_name +from onyx.db.models import KVStore +from onyx.key_value_store.interface import KeyValueStore +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.redis.redis_pool import get_redis_client +from onyx.utils.logger import setup_logger +from onyx.utils.special_types import JSON_ro from shared_configs.configs import MULTI_TENANT from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR @@ -23,7 +23,7 @@ logger = setup_logger() -REDIS_KEY_PREFIX = "danswer_kv_store:" +REDIS_KEY_PREFIX = "onyx_kv_store:" KV_REDIS_KEY_EXPIRATION = 60 * 60 * 24 # 1 Day diff --git a/backend/danswer/server/features/persona/__init__.py b/backend/onyx/llm/__init__.py similarity index 100% rename from backend/danswer/server/features/persona/__init__.py rename to backend/onyx/llm/__init__.py diff --git a/backend/danswer/llm/chat_llm.py b/backend/onyx/llm/chat_llm.py similarity index 97% rename from backend/danswer/llm/chat_llm.py rename to backend/onyx/llm/chat_llm.py index 88b8f0396d5..32f8684b4e7 100644 --- a/backend/danswer/llm/chat_llm.py +++ b/backend/onyx/llm/chat_llm.py @@ -25,18 +25,18 @@ from langchain_core.messages.tool import ToolMessage from langchain_core.prompt_values import PromptValue -from danswer.configs.app_configs import LOG_DANSWER_MODEL_INTERACTIONS -from danswer.configs.model_configs import ( +from onyx.configs.app_configs import LOG_DANSWER_MODEL_INTERACTIONS +from onyx.configs.model_configs import ( DISABLE_LITELLM_STREAMING, ) -from danswer.configs.model_configs import GEN_AI_TEMPERATURE -from danswer.configs.model_configs import LITELLM_EXTRA_BODY -from danswer.llm.interfaces import LLM -from danswer.llm.interfaces import LLMConfig -from danswer.llm.interfaces import ToolChoiceOptions -from danswer.server.utils import mask_string -from danswer.utils.logger import setup_logger -from danswer.utils.long_term_log import LongTermLogger +from onyx.configs.model_configs import GEN_AI_TEMPERATURE +from onyx.configs.model_configs import LITELLM_EXTRA_BODY +from onyx.llm.interfaces import LLM +from onyx.llm.interfaces import LLMConfig +from onyx.llm.interfaces import ToolChoiceOptions +from onyx.server.utils import mask_string +from onyx.utils.logger import setup_logger +from onyx.utils.long_term_log import LongTermLogger logger = setup_logger() diff --git a/backend/danswer/llm/custom_llm.py b/backend/onyx/llm/custom_llm.py similarity index 86% rename from backend/danswer/llm/custom_llm.py rename to backend/onyx/llm/custom_llm.py index 6b80406cf2f..af8dfcaebed 100644 --- a/backend/danswer/llm/custom_llm.py +++ b/backend/onyx/llm/custom_llm.py @@ -7,18 +7,18 @@ from langchain_core.messages import BaseMessage from requests import Timeout -from danswer.configs.model_configs import GEN_AI_NUM_RESERVED_OUTPUT_TOKENS -from danswer.llm.interfaces import LLM -from danswer.llm.interfaces import ToolChoiceOptions -from danswer.llm.utils import convert_lm_input_to_basic_string -from danswer.utils.logger import setup_logger +from onyx.configs.model_configs import GEN_AI_NUM_RESERVED_OUTPUT_TOKENS +from onyx.llm.interfaces import LLM +from onyx.llm.interfaces import ToolChoiceOptions +from onyx.llm.utils import convert_lm_input_to_basic_string +from onyx.utils.logger import setup_logger logger = setup_logger() class CustomModelServer(LLM): - """This class is to provide an example for how to use Danswer + """This class is to provide an example for how to use Onyx with any LLM, even servers with custom API definitions. To use with your own model server, simply implement the functions below to fit your model server expectation @@ -41,7 +41,7 @@ def __init__( ): if not endpoint: raise ValueError( - "Cannot point Danswer to a custom LLM server without providing the " + "Cannot point Onyx to a custom LLM server without providing the " "endpoint for the model server." ) diff --git a/backend/danswer/llm/exceptions.py b/backend/onyx/llm/exceptions.py similarity index 100% rename from backend/danswer/llm/exceptions.py rename to backend/onyx/llm/exceptions.py diff --git a/backend/danswer/llm/factory.py b/backend/onyx/llm/factory.py similarity index 85% rename from backend/danswer/llm/factory.py rename to backend/onyx/llm/factory.py index 0b688a0cfcb..8e720a756b8 100644 --- a/backend/danswer/llm/factory.py +++ b/backend/onyx/llm/factory.py @@ -1,21 +1,21 @@ from typing import Any -from danswer.chat.models import PersonaOverrideConfig -from danswer.configs.app_configs import DISABLE_GENERATIVE_AI -from danswer.configs.chat_configs import QA_TIMEOUT -from danswer.configs.model_configs import GEN_AI_MODEL_FALLBACK_MAX_TOKENS -from danswer.configs.model_configs import GEN_AI_TEMPERATURE -from danswer.db.engine import get_session_context_manager -from danswer.db.llm import fetch_default_provider -from danswer.db.llm import fetch_provider -from danswer.db.models import Persona -from danswer.llm.chat_llm import DefaultMultiLLM -from danswer.llm.exceptions import GenAIDisabledException -from danswer.llm.interfaces import LLM -from danswer.llm.override_models import LLMOverride -from danswer.utils.headers import build_llm_extra_headers -from danswer.utils.logger import setup_logger -from danswer.utils.long_term_log import LongTermLogger +from onyx.chat.models import PersonaOverrideConfig +from onyx.configs.app_configs import DISABLE_GENERATIVE_AI +from onyx.configs.chat_configs import QA_TIMEOUT +from onyx.configs.model_configs import GEN_AI_MODEL_FALLBACK_MAX_TOKENS +from onyx.configs.model_configs import GEN_AI_TEMPERATURE +from onyx.db.engine import get_session_context_manager +from onyx.db.llm import fetch_default_provider +from onyx.db.llm import fetch_provider +from onyx.db.models import Persona +from onyx.llm.chat_llm import DefaultMultiLLM +from onyx.llm.exceptions import GenAIDisabledException +from onyx.llm.interfaces import LLM +from onyx.llm.override_models import LLMOverride +from onyx.utils.headers import build_llm_extra_headers +from onyx.utils.logger import setup_logger +from onyx.utils.long_term_log import LongTermLogger logger = setup_logger() diff --git a/backend/danswer/llm/interfaces.py b/backend/onyx/llm/interfaces.py similarity index 94% rename from backend/danswer/llm/interfaces.py rename to backend/onyx/llm/interfaces.py index b5e689a9a4d..fba7997d036 100644 --- a/backend/danswer/llm/interfaces.py +++ b/backend/onyx/llm/interfaces.py @@ -7,10 +7,10 @@ from langchain_core.messages import BaseMessage from pydantic import BaseModel -from danswer.configs.app_configs import DISABLE_GENERATIVE_AI -from danswer.configs.app_configs import LOG_DANSWER_MODEL_INTERACTIONS -from danswer.configs.app_configs import LOG_INDIVIDUAL_MODEL_TOKENS -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import DISABLE_GENERATIVE_AI +from onyx.configs.app_configs import LOG_DANSWER_MODEL_INTERACTIONS +from onyx.configs.app_configs import LOG_INDIVIDUAL_MODEL_TOKENS +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/llm/llm_provider_options.py b/backend/onyx/llm/llm_provider_options.py similarity index 100% rename from backend/danswer/llm/llm_provider_options.py rename to backend/onyx/llm/llm_provider_options.py diff --git a/backend/danswer/llm/models.py b/backend/onyx/llm/models.py similarity index 87% rename from backend/danswer/llm/models.py rename to backend/onyx/llm/models.py index 182fc97fb26..d755a9bd88f 100644 --- a/backend/danswer/llm/models.py +++ b/backend/onyx/llm/models.py @@ -6,13 +6,13 @@ from langchain.schema.messages import SystemMessage from pydantic import BaseModel -from danswer.configs.constants import MessageType -from danswer.file_store.models import InMemoryChatFile -from danswer.llm.utils import build_content_with_imgs -from danswer.tools.models import ToolCallFinalResult +from onyx.configs.constants import MessageType +from onyx.file_store.models import InMemoryChatFile +from onyx.llm.utils import build_content_with_imgs +from onyx.tools.models import ToolCallFinalResult if TYPE_CHECKING: - from danswer.db.models import ChatMessage + from onyx.db.models import ChatMessage class PreviousMessage(BaseModel): diff --git a/backend/danswer/llm/override_models.py b/backend/onyx/llm/override_models.py similarity index 100% rename from backend/danswer/llm/override_models.py rename to backend/onyx/llm/override_models.py diff --git a/backend/danswer/llm/utils.py b/backend/onyx/llm/utils.py similarity index 96% rename from backend/danswer/llm/utils.py rename to backend/onyx/llm/utils.py index 47175c8d9fd..17472f93a21 100644 --- a/backend/danswer/llm/utils.py +++ b/backend/onyx/llm/utils.py @@ -28,17 +28,17 @@ from litellm.exceptions import Timeout # type: ignore from litellm.exceptions import UnprocessableEntityError # type: ignore -from danswer.configs.constants import MessageType -from danswer.configs.model_configs import GEN_AI_MAX_TOKENS -from danswer.configs.model_configs import GEN_AI_MODEL_FALLBACK_MAX_TOKENS -from danswer.configs.model_configs import GEN_AI_NUM_RESERVED_OUTPUT_TOKENS -from danswer.file_store.models import ChatFileType -from danswer.file_store.models import InMemoryChatFile -from danswer.llm.interfaces import LLM -from danswer.prompts.constants import CODE_BLOCK_PAT -from danswer.utils.b64 import get_image_type -from danswer.utils.b64 import get_image_type_from_bytes -from danswer.utils.logger import setup_logger +from onyx.configs.constants import MessageType +from onyx.configs.model_configs import GEN_AI_MAX_TOKENS +from onyx.configs.model_configs import GEN_AI_MODEL_FALLBACK_MAX_TOKENS +from onyx.configs.model_configs import GEN_AI_NUM_RESERVED_OUTPUT_TOKENS +from onyx.file_store.models import ChatFileType +from onyx.file_store.models import InMemoryChatFile +from onyx.llm.interfaces import LLM +from onyx.prompts.constants import CODE_BLOCK_PAT +from onyx.utils.b64 import get_image_type +from onyx.utils.b64 import get_image_type_from_bytes +from onyx.utils.logger import setup_logger from shared_configs.configs import LOG_LEVEL logger = setup_logger() diff --git a/backend/danswer/main.py b/backend/onyx/main.py similarity index 68% rename from backend/danswer/main.py rename to backend/onyx/main.py index 49fdfadfbf3..62488e391c4 100644 --- a/backend/danswer/main.py +++ b/backend/onyx/main.py @@ -20,85 +20,84 @@ from sentry_sdk.integrations.starlette import StarletteIntegration from sqlalchemy.orm import Session -from danswer import __version__ -from danswer.auth.schemas import UserCreate -from danswer.auth.schemas import UserRead -from danswer.auth.schemas import UserUpdate -from danswer.auth.users import auth_backend -from danswer.auth.users import create_danswer_oauth_router -from danswer.auth.users import fastapi_users -from danswer.configs.app_configs import APP_API_PREFIX -from danswer.configs.app_configs import APP_HOST -from danswer.configs.app_configs import APP_PORT -from danswer.configs.app_configs import AUTH_TYPE -from danswer.configs.app_configs import DISABLE_GENERATIVE_AI -from danswer.configs.app_configs import LOG_ENDPOINT_LATENCY -from danswer.configs.app_configs import OAUTH_CLIENT_ID -from danswer.configs.app_configs import OAUTH_CLIENT_SECRET -from danswer.configs.app_configs import POSTGRES_API_SERVER_POOL_OVERFLOW -from danswer.configs.app_configs import POSTGRES_API_SERVER_POOL_SIZE -from danswer.configs.app_configs import SYSTEM_RECURSION_LIMIT -from danswer.configs.app_configs import USER_AUTH_SECRET -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.configs.constants import AuthType -from danswer.configs.constants import POSTGRES_WEB_APP_NAME -from danswer.db.engine import SqlEngine -from danswer.db.engine import warm_up_connections -from danswer.server.api_key.api import router as api_key_router -from danswer.server.auth_check import check_router_auth -from danswer.server.danswer_api.ingestion import router as danswer_api_router -from danswer.server.documents.cc_pair import router as cc_pair_router -from danswer.server.documents.connector import router as connector_router -from danswer.server.documents.credential import router as credential_router -from danswer.server.documents.document import router as document_router -from danswer.server.documents.indexing import router as indexing_router -from danswer.server.documents.standard_oauth import router as standard_oauth_router -from danswer.server.features.document_set.api import router as document_set_router -from danswer.server.features.folder.api import router as folder_router -from danswer.server.features.notifications.api import router as notification_router -from danswer.server.features.persona.api import admin_router as admin_persona_router -from danswer.server.features.persona.api import basic_router as persona_router -from danswer.server.features.prompt.api import basic_router as prompt_router -from danswer.server.features.tool.api import admin_router as admin_tool_router -from danswer.server.features.tool.api import router as tool_router -from danswer.server.gpts.api import router as gpts_router -from danswer.server.long_term_logs.long_term_logs_api import ( +from onyx import __version__ +from onyx.auth.schemas import UserCreate +from onyx.auth.schemas import UserRead +from onyx.auth.schemas import UserUpdate +from onyx.auth.users import auth_backend +from onyx.auth.users import create_onyx_oauth_router +from onyx.auth.users import fastapi_users +from onyx.configs.app_configs import APP_API_PREFIX +from onyx.configs.app_configs import APP_HOST +from onyx.configs.app_configs import APP_PORT +from onyx.configs.app_configs import AUTH_TYPE +from onyx.configs.app_configs import DISABLE_GENERATIVE_AI +from onyx.configs.app_configs import LOG_ENDPOINT_LATENCY +from onyx.configs.app_configs import OAUTH_CLIENT_ID +from onyx.configs.app_configs import OAUTH_CLIENT_SECRET +from onyx.configs.app_configs import POSTGRES_API_SERVER_POOL_OVERFLOW +from onyx.configs.app_configs import POSTGRES_API_SERVER_POOL_SIZE +from onyx.configs.app_configs import SYSTEM_RECURSION_LIMIT +from onyx.configs.app_configs import USER_AUTH_SECRET +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.configs.constants import AuthType +from onyx.configs.constants import POSTGRES_WEB_APP_NAME +from onyx.db.engine import SqlEngine +from onyx.db.engine import warm_up_connections +from onyx.server.api_key.api import router as api_key_router +from onyx.server.auth_check import check_router_auth +from onyx.server.documents.cc_pair import router as cc_pair_router +from onyx.server.documents.connector import router as connector_router +from onyx.server.documents.credential import router as credential_router +from onyx.server.documents.document import router as document_router +from onyx.server.documents.indexing import router as indexing_router +from onyx.server.documents.standard_oauth import router as oauth_router +from onyx.server.features.document_set.api import router as document_set_router +from onyx.server.features.folder.api import router as folder_router +from onyx.server.features.notifications.api import router as notification_router +from onyx.server.features.persona.api import admin_router as admin_persona_router +from onyx.server.features.persona.api import basic_router as persona_router +from onyx.server.features.prompt.api import basic_router as prompt_router +from onyx.server.features.tool.api import admin_router as admin_tool_router +from onyx.server.features.tool.api import router as tool_router +from onyx.server.gpts.api import router as gpts_router +from onyx.server.long_term_logs.long_term_logs_api import ( router as long_term_logs_router, ) -from danswer.server.manage.administrative import router as admin_router -from danswer.server.manage.embedding.api import admin_router as embedding_admin_router -from danswer.server.manage.embedding.api import basic_router as embedding_router -from danswer.server.manage.get_state import router as state_router -from danswer.server.manage.llm.api import admin_router as llm_admin_router -from danswer.server.manage.llm.api import basic_router as llm_router -from danswer.server.manage.search_settings import router as search_settings_router -from danswer.server.manage.slack_bot import router as slack_bot_management_router -from danswer.server.manage.users import router as user_router -from danswer.server.middleware.latency_logging import add_latency_logging_middleware -from danswer.server.oauth import router as oauth_router -from danswer.server.openai_assistants_api.full_openai_assistants_api import ( +from onyx.server.manage.administrative import router as admin_router +from onyx.server.manage.embedding.api import admin_router as embedding_admin_router +from onyx.server.manage.embedding.api import basic_router as embedding_router +from onyx.server.manage.get_state import router as state_router +from onyx.server.manage.llm.api import admin_router as llm_admin_router +from onyx.server.manage.llm.api import basic_router as llm_router +from onyx.server.manage.search_settings import router as search_settings_router +from onyx.server.manage.slack_bot import router as slack_bot_management_router +from onyx.server.manage.users import router as user_router +from onyx.server.middleware.latency_logging import add_latency_logging_middleware +from onyx.server.onyx_api.ingestion import router as onyx_api_router +from onyx.server.openai_assistants_api.full_openai_assistants_api import ( get_full_openai_assistants_api_router, ) -from danswer.server.query_and_chat.chat_backend import router as chat_router -from danswer.server.query_and_chat.query_backend import ( +from onyx.server.query_and_chat.chat_backend import router as chat_router +from onyx.server.query_and_chat.query_backend import ( admin_router as admin_query_router, ) -from danswer.server.query_and_chat.query_backend import basic_router as query_router -from danswer.server.settings.api import admin_router as settings_admin_router -from danswer.server.settings.api import basic_router as settings_router -from danswer.server.token_rate_limits.api import ( +from onyx.server.query_and_chat.query_backend import basic_router as query_router +from onyx.server.settings.api import admin_router as settings_admin_router +from onyx.server.settings.api import basic_router as settings_router +from onyx.server.token_rate_limits.api import ( router as token_rate_limit_settings_router, ) -from danswer.server.utils import BasicAuthenticationError -from danswer.setup import setup_danswer -from danswer.setup import setup_multitenant_danswer -from danswer.utils.logger import setup_logger -from danswer.utils.telemetry import get_or_generate_uuid -from danswer.utils.telemetry import optional_telemetry -from danswer.utils.telemetry import RecordType -from danswer.utils.variable_functionality import fetch_versioned_implementation -from danswer.utils.variable_functionality import global_version -from danswer.utils.variable_functionality import set_is_ee_based_on_env_variable +from onyx.server.utils import BasicAuthenticationError +from onyx.setup import setup_multitenant_onyx +from onyx.setup import setup_onyx +from onyx.utils.logger import setup_logger +from onyx.utils.telemetry import get_or_generate_uuid +from onyx.utils.telemetry import optional_telemetry +from onyx.utils.telemetry import RecordType +from onyx.utils.variable_functionality import fetch_versioned_implementation +from onyx.utils.variable_functionality import global_version +from onyx.utils.variable_functionality import set_is_ee_based_on_env_variable from shared_configs.configs import CORS_ALLOWED_ORIGIN from shared_configs.configs import MULTI_TENANT from shared_configs.configs import SENTRY_DSN @@ -169,7 +168,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator: engine = SqlEngine.get_engine() verify_auth = fetch_versioned_implementation( - "danswer.auth.users", "verify_auth_setting" + "onyx.auth.users", "verify_auth_setting" ) # Will throw exception if an issue is found @@ -190,9 +189,9 @@ async def lifespan(app: FastAPI) -> AsyncGenerator: # If we are multi-tenant, we need to only set up initial public tables with Session(engine) as db_session: - setup_danswer(db_session, None) + setup_onyx(db_session, None) else: - setup_multitenant_danswer() + setup_multitenant_onyx() optional_telemetry(record_type=RecordType.VERSION, data={"version": __version__}) yield @@ -218,9 +217,7 @@ def log_http_error(_: Request, exc: Exception) -> JSONResponse: def get_application() -> FastAPI: - application = FastAPI( - title="Danswer Backend", version=__version__, lifespan=lifespan - ) + application = FastAPI(title="Onyx Backend", version=__version__, lifespan=lifespan) if SENTRY_DSN: sentry_sdk.init( dsn=SENTRY_DSN, @@ -261,7 +258,7 @@ def get_application() -> FastAPI: include_router_with_global_prefix_prepended(application, tool_router) include_router_with_global_prefix_prepended(application, admin_tool_router) include_router_with_global_prefix_prepended(application, state_router) - include_router_with_global_prefix_prepended(application, danswer_api_router) + include_router_with_global_prefix_prepended(application, onyx_api_router) include_router_with_global_prefix_prepended(application, gpts_router) include_router_with_global_prefix_prepended(application, settings_router) include_router_with_global_prefix_prepended(application, settings_admin_router) @@ -277,7 +274,6 @@ def get_application() -> FastAPI: application, get_full_openai_assistants_api_router() ) include_router_with_global_prefix_prepended(application, long_term_logs_router) - include_router_with_global_prefix_prepended(application, standard_oauth_router) include_router_with_global_prefix_prepended(application, api_key_router) include_router_with_global_prefix_prepended(application, oauth_router) @@ -323,7 +319,7 @@ def get_application() -> FastAPI: oauth_client = GoogleOAuth2(OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET) include_router_with_global_prefix_prepended( application, - create_danswer_oauth_router( + create_onyx_oauth_router( oauth_client, auth_backend, USER_AUTH_SECRET, @@ -369,12 +365,12 @@ def get_application() -> FastAPI: # NOTE: needs to be outside of the `if __name__ == "__main__"` block so that the # app is exportable set_is_ee_based_on_env_variable() -app = fetch_versioned_implementation(module="danswer.main", attribute="get_application") +app = fetch_versioned_implementation(module="onyx.main", attribute="get_application") if __name__ == "__main__": logger.notice( - f"Starting Danswer Backend version {__version__} on http://{APP_HOST}:{str(APP_PORT)}/" + f"Starting Onyx Backend version {__version__} on http://{APP_HOST}:{str(APP_PORT)}/" ) if global_version.is_ee_version(): diff --git a/backend/danswer/server/features/prompt/__init__.py b/backend/onyx/natural_language_processing/__init__.py similarity index 100% rename from backend/danswer/server/features/prompt/__init__.py rename to backend/onyx/natural_language_processing/__init__.py diff --git a/backend/danswer/natural_language_processing/exceptions.py b/backend/onyx/natural_language_processing/exceptions.py similarity index 100% rename from backend/danswer/natural_language_processing/exceptions.py rename to backend/onyx/natural_language_processing/exceptions.py diff --git a/backend/danswer/natural_language_processing/search_nlp_models.py b/backend/onyx/natural_language_processing/search_nlp_models.py similarity index 95% rename from backend/danswer/natural_language_processing/search_nlp_models.py rename to backend/onyx/natural_language_processing/search_nlp_models.py index 9fed0d489e7..5bf8cd30a0a 100644 --- a/backend/danswer/natural_language_processing/search_nlp_models.py +++ b/backend/onyx/natural_language_processing/search_nlp_models.py @@ -11,20 +11,20 @@ from requests import Response from retry import retry -from danswer.configs.app_configs import LARGE_CHUNK_RATIO -from danswer.configs.model_configs import BATCH_SIZE_ENCODE_CHUNKS -from danswer.configs.model_configs import ( +from onyx.configs.app_configs import LARGE_CHUNK_RATIO +from onyx.configs.model_configs import BATCH_SIZE_ENCODE_CHUNKS +from onyx.configs.model_configs import ( BATCH_SIZE_ENCODE_CHUNKS_FOR_API_EMBEDDING_SERVICES, ) -from danswer.configs.model_configs import DOC_EMBEDDING_CONTEXT_SIZE -from danswer.db.models import SearchSettings -from danswer.indexing.indexing_heartbeat import IndexingHeartbeatInterface -from danswer.natural_language_processing.exceptions import ( +from onyx.configs.model_configs import DOC_EMBEDDING_CONTEXT_SIZE +from onyx.db.models import SearchSettings +from onyx.indexing.indexing_heartbeat import IndexingHeartbeatInterface +from onyx.natural_language_processing.exceptions import ( ModelServerRateLimitError, ) -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.natural_language_processing.utils import tokenizer_trim_content -from danswer.utils.logger import setup_logger +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.natural_language_processing.utils import tokenizer_trim_content +from onyx.utils.logger import setup_logger from shared_configs.configs import MODEL_SERVER_HOST from shared_configs.configs import MODEL_SERVER_PORT from shared_configs.enums import EmbeddingProvider @@ -45,9 +45,9 @@ WARM_UP_STRINGS = [ - "Danswer is amazing!", + "Onyx is amazing!", "Check out our easy deployment guide at", - "https://docs.danswer.dev/quickstart", + "https://docs.onyx.app/quickstart", ] diff --git a/backend/danswer/natural_language_processing/utils.py b/backend/onyx/natural_language_processing/utils.py similarity index 96% rename from backend/danswer/natural_language_processing/utils.py rename to backend/onyx/natural_language_processing/utils.py index 35f5629e06f..7b68b20d8e9 100644 --- a/backend/danswer/natural_language_processing/utils.py +++ b/backend/onyx/natural_language_processing/utils.py @@ -5,10 +5,10 @@ from transformers import logging as transformer_logging # type:ignore -from danswer.configs.model_configs import DOC_EMBEDDING_CONTEXT_SIZE -from danswer.configs.model_configs import DOCUMENT_ENCODER_MODEL -from danswer.context.search.models import InferenceChunk -from danswer.utils.logger import setup_logger +from onyx.configs.model_configs import DOC_EMBEDDING_CONTEXT_SIZE +from onyx.configs.model_configs import DOCUMENT_ENCODER_MODEL +from onyx.context.search.models import InferenceChunk +from onyx.utils.logger import setup_logger from shared_configs.enums import EmbeddingProvider logger = setup_logger() diff --git a/backend/danswer/danswerbot/slack/blocks.py b/backend/onyx/onyxbot/slack/blocks.py similarity index 90% rename from backend/danswer/danswerbot/slack/blocks.py rename to backend/onyx/onyxbot/slack/blocks.py index 34ec92e7daa..db914014294 100644 --- a/backend/danswer/danswerbot/slack/blocks.py +++ b/backend/onyx/onyxbot/slack/blocks.py @@ -16,31 +16,31 @@ from slack_sdk.models.blocks.basic_components import MarkdownTextObject from slack_sdk.models.blocks.block_elements import ImageElement -from danswer.chat.models import ChatDanswerBotResponse -from danswer.configs.app_configs import DISABLE_GENERATIVE_AI -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import SearchFeedbackType -from danswer.configs.danswerbot_configs import DANSWER_BOT_NUM_DOCS_TO_DISPLAY -from danswer.context.search.models import SavedSearchDoc -from danswer.danswerbot.slack.constants import CONTINUE_IN_WEB_UI_ACTION_ID -from danswer.danswerbot.slack.constants import DISLIKE_BLOCK_ACTION_ID -from danswer.danswerbot.slack.constants import FEEDBACK_DOC_BUTTON_BLOCK_ACTION_ID -from danswer.danswerbot.slack.constants import FOLLOWUP_BUTTON_ACTION_ID -from danswer.danswerbot.slack.constants import FOLLOWUP_BUTTON_RESOLVED_ACTION_ID -from danswer.danswerbot.slack.constants import IMMEDIATE_RESOLVED_BUTTON_ACTION_ID -from danswer.danswerbot.slack.constants import LIKE_BLOCK_ACTION_ID -from danswer.danswerbot.slack.formatting import format_slack_message -from danswer.danswerbot.slack.icons import source_to_github_img_link -from danswer.danswerbot.slack.models import SlackMessageInfo -from danswer.danswerbot.slack.utils import build_continue_in_web_ui_id -from danswer.danswerbot.slack.utils import build_feedback_id -from danswer.danswerbot.slack.utils import remove_slack_text_interactions -from danswer.danswerbot.slack.utils import translate_vespa_highlight_to_slack -from danswer.db.chat import get_chat_session_by_message_id -from danswer.db.engine import get_session_with_tenant -from danswer.db.models import ChannelConfig -from danswer.utils.text_processing import decode_escapes +from onyx.chat.models import ChatOnyxBotResponse +from onyx.configs.app_configs import DISABLE_GENERATIVE_AI +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import SearchFeedbackType +from onyx.configs.onyxbot_configs import DANSWER_BOT_NUM_DOCS_TO_DISPLAY +from onyx.context.search.models import SavedSearchDoc +from onyx.db.chat import get_chat_session_by_message_id +from onyx.db.engine import get_session_with_tenant +from onyx.db.models import ChannelConfig +from onyx.onyxbot.slack.constants import CONTINUE_IN_WEB_UI_ACTION_ID +from onyx.onyxbot.slack.constants import DISLIKE_BLOCK_ACTION_ID +from onyx.onyxbot.slack.constants import FEEDBACK_DOC_BUTTON_BLOCK_ACTION_ID +from onyx.onyxbot.slack.constants import FOLLOWUP_BUTTON_ACTION_ID +from onyx.onyxbot.slack.constants import FOLLOWUP_BUTTON_RESOLVED_ACTION_ID +from onyx.onyxbot.slack.constants import IMMEDIATE_RESOLVED_BUTTON_ACTION_ID +from onyx.onyxbot.slack.constants import LIKE_BLOCK_ACTION_ID +from onyx.onyxbot.slack.formatting import format_slack_message +from onyx.onyxbot.slack.icons import source_to_github_img_link +from onyx.onyxbot.slack.models import SlackMessageInfo +from onyx.onyxbot.slack.utils import build_continue_in_web_ui_id +from onyx.onyxbot.slack.utils import build_feedback_id +from onyx.onyxbot.slack.utils import remove_slack_text_interactions +from onyx.onyxbot.slack.utils import translate_vespa_highlight_to_slack +from onyx.utils.text_processing import decode_escapes _MAX_BLURB_LEN = 45 @@ -325,7 +325,7 @@ def _build_sources_blocks( def _priority_ordered_documents_blocks( - answer: ChatDanswerBotResponse, + answer: ChatOnyxBotResponse, ) -> list[Block]: docs_response = answer.docs if answer.docs else None top_docs = docs_response.top_documents if docs_response else [] @@ -348,7 +348,7 @@ def _priority_ordered_documents_blocks( def _build_citations_blocks( - answer: ChatDanswerBotResponse, + answer: ChatOnyxBotResponse, ) -> list[Block]: docs_response = answer.docs if answer.docs else None top_docs = docs_response.top_documents if docs_response else [] @@ -368,7 +368,7 @@ def _build_citations_blocks( def _build_qa_response_blocks( - answer: ChatDanswerBotResponse, + answer: ChatOnyxBotResponse, process_message_for_citations: bool = False, ) -> list[Block]: retrieval_info = answer.docs @@ -450,7 +450,7 @@ def _build_continue_in_web_ui_block( elements=[ ButtonElement( action_id=CONTINUE_IN_WEB_UI_ACTION_ID, - text="Continue Chat in Danswer!", + text="Continue Chat in Onyx!", style="primary", url=f"{WEB_DOMAIN}/chat?slackChatId={chat_session.id}", ), @@ -506,7 +506,7 @@ def build_follow_up_resolved_blocks( def build_slack_response_blocks( - answer: ChatDanswerBotResponse, + answer: ChatOnyxBotResponse, tenant_id: str | None, message_info: SlackMessageInfo, channel_conf: ChannelConfig | None, @@ -518,7 +518,7 @@ def build_slack_response_blocks( This function is a top level function that builds all the blocks for the Slack response. It also handles combining all the blocks together. """ - # If called with the DanswerBot slash command, the question is lost so we have to reshow it + # If called with the OnyxBot slash command, the question is lost so we have to reshow it restate_question_block = get_restate_blocks( message_info.thread_messages[-1].message, message_info.is_bot_msg ) diff --git a/backend/danswer/danswerbot/slack/config.py b/backend/onyx/onyxbot/slack/config.py similarity index 94% rename from backend/danswer/danswerbot/slack/config.py rename to backend/onyx/onyxbot/slack/config.py index f4ca36e26a3..6462e78ed99 100644 --- a/backend/danswer/danswerbot/slack/config.py +++ b/backend/onyx/onyxbot/slack/config.py @@ -2,8 +2,8 @@ from sqlalchemy.orm import Session -from danswer.db.models import SlackChannelConfig -from danswer.db.slack_channel_config import fetch_slack_channel_configs +from onyx.db.models import SlackChannelConfig +from onyx.db.slack_channel_config import fetch_slack_channel_configs VALID_SLACK_FILTERS = [ diff --git a/backend/danswer/danswerbot/slack/constants.py b/backend/onyx/onyxbot/slack/constants.py similarity index 100% rename from backend/danswer/danswerbot/slack/constants.py rename to backend/onyx/onyxbot/slack/constants.py diff --git a/backend/danswer/danswerbot/slack/formatting.py b/backend/onyx/onyxbot/slack/formatting.py similarity index 100% rename from backend/danswer/danswerbot/slack/formatting.py rename to backend/onyx/onyxbot/slack/formatting.py diff --git a/backend/danswer/server/manage/__init__.py b/backend/onyx/onyxbot/slack/handlers/__init__.py similarity index 100% rename from backend/danswer/server/manage/__init__.py rename to backend/onyx/onyxbot/slack/handlers/__init__.py diff --git a/backend/danswer/danswerbot/slack/handlers/handle_buttons.py b/backend/onyx/onyxbot/slack/handlers/handle_buttons.py similarity index 84% rename from backend/danswer/danswerbot/slack/handlers/handle_buttons.py rename to backend/onyx/onyxbot/slack/handlers/handle_buttons.py index 9335b96874f..6079b22f026 100644 --- a/backend/danswer/danswerbot/slack/handlers/handle_buttons.py +++ b/backend/onyx/onyxbot/slack/handlers/handle_buttons.py @@ -6,41 +6,41 @@ from slack_sdk.models.views import View from slack_sdk.socket_mode.request import SocketModeRequest -from danswer.configs.constants import MessageType -from danswer.configs.constants import SearchFeedbackType -from danswer.configs.danswerbot_configs import DANSWER_FOLLOWUP_EMOJI -from danswer.connectors.slack.utils import expert_info_from_slack_id -from danswer.connectors.slack.utils import make_slack_api_rate_limited -from danswer.danswerbot.slack.blocks import build_follow_up_resolved_blocks -from danswer.danswerbot.slack.blocks import get_document_feedback_blocks -from danswer.danswerbot.slack.config import get_slack_channel_config_for_bot_and_channel -from danswer.danswerbot.slack.constants import DISLIKE_BLOCK_ACTION_ID -from danswer.danswerbot.slack.constants import FeedbackVisibility -from danswer.danswerbot.slack.constants import LIKE_BLOCK_ACTION_ID -from danswer.danswerbot.slack.constants import VIEW_DOC_FEEDBACK_ID -from danswer.danswerbot.slack.handlers.handle_message import ( +from onyx.configs.constants import MessageType +from onyx.configs.constants import SearchFeedbackType +from onyx.configs.onyxbot_configs import DANSWER_FOLLOWUP_EMOJI +from onyx.connectors.slack.utils import expert_info_from_slack_id +from onyx.connectors.slack.utils import make_slack_api_rate_limited +from onyx.db.engine import get_session_with_tenant +from onyx.db.feedback import create_chat_message_feedback +from onyx.db.feedback import create_doc_retrieval_feedback +from onyx.document_index.document_index_utils import get_both_index_names +from onyx.document_index.factory import get_default_document_index +from onyx.onyxbot.slack.blocks import build_follow_up_resolved_blocks +from onyx.onyxbot.slack.blocks import get_document_feedback_blocks +from onyx.onyxbot.slack.config import get_slack_channel_config_for_bot_and_channel +from onyx.onyxbot.slack.constants import DISLIKE_BLOCK_ACTION_ID +from onyx.onyxbot.slack.constants import FeedbackVisibility +from onyx.onyxbot.slack.constants import LIKE_BLOCK_ACTION_ID +from onyx.onyxbot.slack.constants import VIEW_DOC_FEEDBACK_ID +from onyx.onyxbot.slack.handlers.handle_message import ( remove_scheduled_feedback_reminder, ) -from danswer.danswerbot.slack.handlers.handle_regular_answer import ( +from onyx.onyxbot.slack.handlers.handle_regular_answer import ( handle_regular_answer, ) -from danswer.danswerbot.slack.models import SlackMessageInfo -from danswer.danswerbot.slack.utils import build_feedback_id -from danswer.danswerbot.slack.utils import decompose_action_id -from danswer.danswerbot.slack.utils import fetch_group_ids_from_names -from danswer.danswerbot.slack.utils import fetch_slack_user_ids_from_emails -from danswer.danswerbot.slack.utils import get_channel_name_from_id -from danswer.danswerbot.slack.utils import get_feedback_visibility -from danswer.danswerbot.slack.utils import read_slack_thread -from danswer.danswerbot.slack.utils import respond_in_thread -from danswer.danswerbot.slack.utils import TenantSocketModeClient -from danswer.danswerbot.slack.utils import update_emote_react -from danswer.db.engine import get_session_with_tenant -from danswer.db.feedback import create_chat_message_feedback -from danswer.db.feedback import create_doc_retrieval_feedback -from danswer.document_index.document_index_utils import get_both_index_names -from danswer.document_index.factory import get_default_document_index -from danswer.utils.logger import setup_logger +from onyx.onyxbot.slack.models import SlackMessageInfo +from onyx.onyxbot.slack.utils import build_feedback_id +from onyx.onyxbot.slack.utils import decompose_action_id +from onyx.onyxbot.slack.utils import fetch_group_ids_from_names +from onyx.onyxbot.slack.utils import fetch_slack_user_ids_from_emails +from onyx.onyxbot.slack.utils import get_channel_name_from_id +from onyx.onyxbot.slack.utils import get_feedback_visibility +from onyx.onyxbot.slack.utils import read_slack_thread +from onyx.onyxbot.slack.utils import respond_in_thread +from onyx.onyxbot.slack.utils import TenantSocketModeClient +from onyx.onyxbot.slack.utils import update_emote_react +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/danswerbot/slack/handlers/handle_message.py b/backend/onyx/onyxbot/slack/handlers/handle_message.py similarity index 86% rename from backend/danswer/danswerbot/slack/handlers/handle_message.py rename to backend/onyx/onyxbot/slack/handlers/handle_message.py index 1f19d0a70a6..78e58b85f31 100644 --- a/backend/danswer/danswerbot/slack/handlers/handle_message.py +++ b/backend/onyx/onyxbot/slack/handlers/handle_message.py @@ -3,25 +3,25 @@ from slack_sdk import WebClient from slack_sdk.errors import SlackApiError -from danswer.configs.danswerbot_configs import DANSWER_BOT_FEEDBACK_REMINDER -from danswer.configs.danswerbot_configs import DANSWER_REACT_EMOJI -from danswer.danswerbot.slack.blocks import get_feedback_reminder_blocks -from danswer.danswerbot.slack.handlers.handle_regular_answer import ( +from onyx.configs.onyxbot_configs import DANSWER_BOT_FEEDBACK_REMINDER +from onyx.configs.onyxbot_configs import DANSWER_REACT_EMOJI +from onyx.db.engine import get_session_with_tenant +from onyx.db.models import SlackChannelConfig +from onyx.db.users import add_slack_user_if_not_exists +from onyx.onyxbot.slack.blocks import get_feedback_reminder_blocks +from onyx.onyxbot.slack.handlers.handle_regular_answer import ( handle_regular_answer, ) -from danswer.danswerbot.slack.handlers.handle_standard_answers import ( +from onyx.onyxbot.slack.handlers.handle_standard_answers import ( handle_standard_answers, ) -from danswer.danswerbot.slack.models import SlackMessageInfo -from danswer.danswerbot.slack.utils import fetch_slack_user_ids_from_emails -from danswer.danswerbot.slack.utils import fetch_user_ids_from_groups -from danswer.danswerbot.slack.utils import respond_in_thread -from danswer.danswerbot.slack.utils import slack_usage_report -from danswer.danswerbot.slack.utils import update_emote_react -from danswer.db.engine import get_session_with_tenant -from danswer.db.models import SlackChannelConfig -from danswer.db.users import add_slack_user_if_not_exists -from danswer.utils.logger import setup_logger +from onyx.onyxbot.slack.models import SlackMessageInfo +from onyx.onyxbot.slack.utils import fetch_slack_user_ids_from_emails +from onyx.onyxbot.slack.utils import fetch_user_ids_from_groups +from onyx.onyxbot.slack.utils import respond_in_thread +from onyx.onyxbot.slack.utils import slack_usage_report +from onyx.onyxbot.slack.utils import update_emote_react +from onyx.utils.logger import setup_logger from shared_configs.configs import SLACK_CHANNEL_ID logger_base = setup_logger() @@ -116,7 +116,7 @@ def handle_message( Returns True if need to respond with an additional message to the user(s) after this function is finished. True indicates an unexpected failure that needs to be communicated Query thrown out by filters due to config does not count as a failure that should be notified - Danswer failing to answer/retrieve docs does count and should be notified + Onyx failing to answer/retrieve docs does count and should be notified """ channel = message_info.channel_to_respond @@ -176,7 +176,7 @@ def handle_message( if respond_tag_only and not bypass_filters: logger.info( "Skipping message since the channel is configured such that " - "DanswerBot only responds to tags" + "OnyxBot only responds to tags" ) return False @@ -194,7 +194,7 @@ def handle_message( if missing_users: logger.warning(f"Failed to find these users/groups: {missing_users}") - # If configured to respond to team members only, then cannot be used with a /DanswerBot command + # If configured to respond to team members only, then cannot be used with a /OnyxBot command # which would just respond to the sender if send_to and is_bot_msg: if sender_id: @@ -202,7 +202,7 @@ def handle_message( client=client, channel=channel, receiver_ids=[sender_id], - text="The DanswerBot slash command is not enabled for this channel", + text="The OnyxBot slash command is not enabled for this channel", thread_ts=None, ) diff --git a/backend/danswer/danswerbot/slack/handlers/handle_regular_answer.py b/backend/onyx/onyxbot/slack/handlers/handle_regular_answer.py similarity index 84% rename from backend/danswer/danswerbot/slack/handlers/handle_regular_answer.py rename to backend/onyx/onyxbot/slack/handlers/handle_regular_answer.py index e1e3673e8ec..19e3e2a363d 100644 --- a/backend/danswer/danswerbot/slack/handlers/handle_regular_answer.py +++ b/backend/onyx/onyxbot/slack/handlers/handle_regular_answer.py @@ -8,35 +8,35 @@ from slack_sdk import WebClient from slack_sdk.models.blocks import SectionBlock -from danswer.chat.chat_utils import prepare_chat_message_request -from danswer.chat.models import ChatDanswerBotResponse -from danswer.chat.process_message import gather_stream_for_slack -from danswer.chat.process_message import stream_chat_message_objects -from danswer.configs.app_configs import DISABLE_GENERATIVE_AI -from danswer.configs.constants import DEFAULT_PERSONA_ID -from danswer.configs.danswerbot_configs import DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER -from danswer.configs.danswerbot_configs import DANSWER_BOT_DISPLAY_ERROR_MSGS -from danswer.configs.danswerbot_configs import DANSWER_BOT_NUM_RETRIES -from danswer.configs.danswerbot_configs import DANSWER_FOLLOWUP_EMOJI -from danswer.configs.danswerbot_configs import DANSWER_REACT_EMOJI -from danswer.configs.danswerbot_configs import MAX_THREAD_CONTEXT_PERCENTAGE -from danswer.context.search.enums import OptionalSearchSetting -from danswer.context.search.models import BaseFilters -from danswer.context.search.models import RetrievalDetails -from danswer.danswerbot.slack.blocks import build_slack_response_blocks -from danswer.danswerbot.slack.handlers.utils import send_team_member_message -from danswer.danswerbot.slack.handlers.utils import slackify_message_thread -from danswer.danswerbot.slack.models import SlackMessageInfo -from danswer.danswerbot.slack.utils import respond_in_thread -from danswer.danswerbot.slack.utils import SlackRateLimiter -from danswer.danswerbot.slack.utils import update_emote_react -from danswer.db.engine import get_session_with_tenant -from danswer.db.models import SlackChannelConfig -from danswer.db.models import User -from danswer.db.persona import get_persona_by_id -from danswer.db.users import get_user_by_email -from danswer.server.query_and_chat.models import CreateChatMessageRequest -from danswer.utils.logger import DanswerLoggingAdapter +from onyx.chat.chat_utils import prepare_chat_message_request +from onyx.chat.models import ChatOnyxBotResponse +from onyx.chat.process_message import gather_stream_for_slack +from onyx.chat.process_message import stream_chat_message_objects +from onyx.configs.app_configs import DISABLE_GENERATIVE_AI +from onyx.configs.constants import DEFAULT_PERSONA_ID +from onyx.configs.onyxbot_configs import DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER +from onyx.configs.onyxbot_configs import DANSWER_BOT_DISPLAY_ERROR_MSGS +from onyx.configs.onyxbot_configs import DANSWER_BOT_NUM_RETRIES +from onyx.configs.onyxbot_configs import DANSWER_FOLLOWUP_EMOJI +from onyx.configs.onyxbot_configs import DANSWER_REACT_EMOJI +from onyx.configs.onyxbot_configs import MAX_THREAD_CONTEXT_PERCENTAGE +from onyx.context.search.enums import OptionalSearchSetting +from onyx.context.search.models import BaseFilters +from onyx.context.search.models import RetrievalDetails +from onyx.db.engine import get_session_with_tenant +from onyx.db.models import SlackChannelConfig +from onyx.db.models import User +from onyx.db.persona import get_persona_by_id +from onyx.db.users import get_user_by_email +from onyx.onyxbot.slack.blocks import build_slack_response_blocks +from onyx.onyxbot.slack.handlers.utils import send_team_member_message +from onyx.onyxbot.slack.handlers.utils import slackify_message_thread +from onyx.onyxbot.slack.models import SlackMessageInfo +from onyx.onyxbot.slack.utils import respond_in_thread +from onyx.onyxbot.slack.utils import SlackRateLimiter +from onyx.onyxbot.slack.utils import update_emote_react +from onyx.server.query_and_chat.models import CreateChatMessageRequest +from onyx.utils.logger import OnyxLoggingAdapter srl = SlackRateLimiter() @@ -68,7 +68,7 @@ def handle_regular_answer( receiver_ids: list[str] | None, client: WebClient, channel: str, - logger: DanswerLoggingAdapter, + logger: OnyxLoggingAdapter, feedback_reminder_id: str | None, tenant_id: str | None, num_retries: int = DANSWER_BOT_NUM_RETRIES, @@ -139,7 +139,7 @@ def handle_regular_answer( bypass_acl = True if not message_ts_to_respond_to and not is_bot_msg: - # if the message is not "/danswer" command, then it should have a message ts to respond to + # if the message is not "/onyx" command, then it should have a message ts to respond to raise RuntimeError( "No message timestamp to respond to in `handle_message`. This should never happen." ) @@ -151,12 +151,12 @@ def handle_regular_answer( ) @rate_limits(client=client, channel=channel, thread_ts=message_ts_to_respond_to) def _get_slack_answer( - new_message_request: CreateChatMessageRequest, danswer_user: User | None - ) -> ChatDanswerBotResponse: + new_message_request: CreateChatMessageRequest, onyx_user: User | None + ) -> ChatOnyxBotResponse: with get_session_with_tenant(tenant_id) as db_session: packets = stream_chat_message_objects( new_msg_req=new_message_request, - user=danswer_user, + user=onyx_user, db_session=db_session, bypass_acl=bypass_acl, ) @@ -210,9 +210,7 @@ def _get_slack_answer( db_session=db_session, ) - answer = _get_slack_answer( - new_message_request=answer_request, danswer_user=user - ) + answer = _get_slack_answer(new_message_request=answer_request, onyx_user=user) except Exception as e: logger.exception( @@ -249,10 +247,10 @@ def _get_slack_answer( client=client, channel=channel, receiver_ids=receiver_ids, - text="Hello! Danswer has some results for you!", + text="Hello! Onyx has some results for you!", blocks=[ SectionBlock( - text="Danswer is down for maintenance.\nWe're working hard on recharging the AI!" + text="Onyx is down for maintenance.\nWe're working hard on recharging the AI!" ) ], thread_ts=message_ts_to_respond_to, @@ -376,7 +374,7 @@ def _get_slack_answer( receiver_ids=[message_info.sender] if message_info.is_bot_msg and message_info.sender else receiver_ids, - text="Hello! Danswer has some results for you!", + text="Hello! Onyx has some results for you!", blocks=all_blocks, thread_ts=message_ts_to_respond_to, # don't unfurl, since otherwise we will have 5+ previews which makes the message very long @@ -385,7 +383,7 @@ def _get_slack_answer( # For DM (ephemeral message), we need to create a thread via a normal message so the user can see # the ephemeral message. This also will give the user a notification which ephemeral message does not. - # if there is no message_ts_to_respond_to, and we have made it this far, then this is a /danswer message + # if there is no message_ts_to_respond_to, and we have made it this far, then this is a /onyx message # so we shouldn't send_team_member_message if receiver_ids and message_ts_to_respond_to is not None: send_team_member_message( diff --git a/backend/danswer/danswerbot/slack/handlers/handle_standard_answers.py b/backend/onyx/onyxbot/slack/handlers/handle_standard_answers.py similarity index 74% rename from backend/danswer/danswerbot/slack/handlers/handle_standard_answers.py rename to backend/onyx/onyxbot/slack/handlers/handle_standard_answers.py index b0789e1ac3e..bd16f7f9923 100644 --- a/backend/danswer/danswerbot/slack/handlers/handle_standard_answers.py +++ b/backend/onyx/onyxbot/slack/handlers/handle_standard_answers.py @@ -1,12 +1,12 @@ from slack_sdk import WebClient from sqlalchemy.orm import Session -from danswer.danswerbot.slack.models import SlackMessageInfo -from danswer.db.models import Prompt -from danswer.db.models import SlackChannelConfig -from danswer.utils.logger import DanswerLoggingAdapter -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_versioned_implementation +from onyx.db.models import Prompt +from onyx.db.models import SlackChannelConfig +from onyx.onyxbot.slack.models import SlackMessageInfo +from onyx.utils.logger import OnyxLoggingAdapter +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_versioned_implementation logger = setup_logger() @@ -16,14 +16,14 @@ def handle_standard_answers( receiver_ids: list[str] | None, slack_channel_config: SlackChannelConfig | None, prompt: Prompt | None, - logger: DanswerLoggingAdapter, + logger: OnyxLoggingAdapter, client: WebClient, db_session: Session, ) -> bool: """Returns whether one or more Standard Answer message blocks were emitted by the Slack bot""" versioned_handle_standard_answers = fetch_versioned_implementation( - "danswer.danswerbot.slack.handlers.handle_standard_answers", + "onyx.onyxbot.slack.handlers.handle_standard_answers", "_handle_standard_answers", ) return versioned_handle_standard_answers( @@ -42,7 +42,7 @@ def _handle_standard_answers( receiver_ids: list[str] | None, slack_channel_config: SlackChannelConfig | None, prompt: Prompt | None, - logger: DanswerLoggingAdapter, + logger: OnyxLoggingAdapter, client: WebClient, db_session: Session, ) -> bool: diff --git a/backend/danswer/danswerbot/slack/handlers/utils.py b/backend/onyx/onyxbot/slack/handlers/utils.py similarity index 88% rename from backend/danswer/danswerbot/slack/handlers/utils.py rename to backend/onyx/onyxbot/slack/handlers/utils.py index d34e8455df7..ea8ab3288b7 100644 --- a/backend/danswer/danswerbot/slack/handlers/utils.py +++ b/backend/onyx/onyxbot/slack/handlers/utils.py @@ -1,8 +1,8 @@ from slack_sdk import WebClient -from danswer.chat.models import ThreadMessage -from danswer.configs.constants import MessageType -from danswer.danswerbot.slack.utils import respond_in_thread +from onyx.chat.models import ThreadMessage +from onyx.configs.constants import MessageType +from onyx.onyxbot.slack.utils import respond_in_thread def slackify_message_thread(messages: list[ThreadMessage]) -> str: diff --git a/backend/onyx/onyxbot/slack/icons.py b/backend/onyx/onyxbot/slack/icons.py new file mode 100644 index 00000000000..adbe5d0bf33 --- /dev/null +++ b/backend/onyx/onyxbot/slack/icons.py @@ -0,0 +1,76 @@ +from onyx.configs.constants import DocumentSource + + +def source_to_github_img_link(source: DocumentSource) -> str | None: + # TODO: store these images somewhere better + if source == DocumentSource.WEB.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/backend/slackbot_images/Web.png" + if source == DocumentSource.FILE.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/backend/slackbot_images/File.png" + if source == DocumentSource.GOOGLE_SITES.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/GoogleSites.png" + if source == DocumentSource.SLACK.value: + return ( + "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Slack.png" + ) + if source == DocumentSource.GMAIL.value: + return ( + "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Gmail.png" + ) + if source == DocumentSource.GOOGLE_DRIVE.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/GoogleDrive.png" + if source == DocumentSource.GITHUB.value: + return ( + "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Github.png" + ) + if source == DocumentSource.GITLAB.value: + return ( + "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Gitlab.png" + ) + if source == DocumentSource.CONFLUENCE.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/backend/slackbot_images/Confluence.png" + if source == DocumentSource.JIRA.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/backend/slackbot_images/Jira.png" + if source == DocumentSource.NOTION.value: + return ( + "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Notion.png" + ) + if source == DocumentSource.ZENDESK.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/backend/slackbot_images/Zendesk.png" + if source == DocumentSource.GONG.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Gong.png" + if source == DocumentSource.LINEAR.value: + return ( + "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Linear.png" + ) + if source == DocumentSource.PRODUCTBOARD.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Productboard.webp" + if source == DocumentSource.SLAB.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/SlabLogo.png" + if source == DocumentSource.ZULIP.value: + return ( + "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Zulip.png" + ) + if source == DocumentSource.GURU.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/backend/slackbot_images/Guru.png" + if source == DocumentSource.HUBSPOT.value: + return ( + "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/HubSpot.png" + ) + if source == DocumentSource.DOCUMENT360.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Document360.png" + if source == DocumentSource.BOOKSTACK.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Bookstack.png" + if source == DocumentSource.LOOPIO.value: + return ( + "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Loopio.png" + ) + if source == DocumentSource.SHAREPOINT.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/web/public/Sharepoint.png" + if source == DocumentSource.REQUESTTRACKER.value: + # just use file icon for now + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/backend/slackbot_images/File.png" + if source == DocumentSource.INGESTION_API.value: + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/backend/slackbot_images/File.png" + + return "https://raw.githubusercontent.com/onyx-ai/onyx/main/backend/slackbot_images/File.png" diff --git a/backend/danswer/danswerbot/slack/listener.py b/backend/onyx/onyxbot/slack/listener.py similarity index 84% rename from backend/danswer/danswerbot/slack/listener.py rename to backend/onyx/onyxbot/slack/listener.py index b19c89d8576..4cb3065ae9b 100644 --- a/backend/danswer/danswerbot/slack/listener.py +++ b/backend/onyx/onyxbot/slack/listener.py @@ -19,67 +19,67 @@ from slack_sdk.socket_mode.response import SocketModeResponse from sqlalchemy.orm import Session -from danswer.chat.models import ThreadMessage -from danswer.configs.app_configs import DEV_MODE -from danswer.configs.app_configs import POD_NAME -from danswer.configs.app_configs import POD_NAMESPACE -from danswer.configs.constants import DanswerRedisLocks -from danswer.configs.constants import MessageType -from danswer.configs.danswerbot_configs import DANSWER_BOT_REPHRASE_MESSAGE -from danswer.configs.danswerbot_configs import DANSWER_BOT_RESPOND_EVERY_CHANNEL -from danswer.configs.danswerbot_configs import NOTIFY_SLACKBOT_NO_ANSWER -from danswer.connectors.slack.utils import expert_info_from_slack_id -from danswer.context.search.retrieval.search_runner import download_nltk_data -from danswer.danswerbot.slack.config import get_slack_channel_config_for_bot_and_channel -from danswer.danswerbot.slack.config import MAX_TENANTS_PER_POD -from danswer.danswerbot.slack.config import TENANT_ACQUISITION_INTERVAL -from danswer.danswerbot.slack.config import TENANT_HEARTBEAT_EXPIRATION -from danswer.danswerbot.slack.config import TENANT_HEARTBEAT_INTERVAL -from danswer.danswerbot.slack.config import TENANT_LOCK_EXPIRATION -from danswer.danswerbot.slack.constants import DISLIKE_BLOCK_ACTION_ID -from danswer.danswerbot.slack.constants import FEEDBACK_DOC_BUTTON_BLOCK_ACTION_ID -from danswer.danswerbot.slack.constants import FOLLOWUP_BUTTON_ACTION_ID -from danswer.danswerbot.slack.constants import FOLLOWUP_BUTTON_RESOLVED_ACTION_ID -from danswer.danswerbot.slack.constants import GENERATE_ANSWER_BUTTON_ACTION_ID -from danswer.danswerbot.slack.constants import IMMEDIATE_RESOLVED_BUTTON_ACTION_ID -from danswer.danswerbot.slack.constants import LIKE_BLOCK_ACTION_ID -from danswer.danswerbot.slack.constants import VIEW_DOC_FEEDBACK_ID -from danswer.danswerbot.slack.handlers.handle_buttons import handle_doc_feedback_button -from danswer.danswerbot.slack.handlers.handle_buttons import handle_followup_button -from danswer.danswerbot.slack.handlers.handle_buttons import ( +from onyx.chat.models import ThreadMessage +from onyx.configs.app_configs import DEV_MODE +from onyx.configs.app_configs import POD_NAME +from onyx.configs.app_configs import POD_NAMESPACE +from onyx.configs.constants import MessageType +from onyx.configs.constants import OnyxRedisLocks +from onyx.configs.onyxbot_configs import DANSWER_BOT_REPHRASE_MESSAGE +from onyx.configs.onyxbot_configs import DANSWER_BOT_RESPOND_EVERY_CHANNEL +from onyx.configs.onyxbot_configs import NOTIFY_SLACKBOT_NO_ANSWER +from onyx.connectors.slack.utils import expert_info_from_slack_id +from onyx.context.search.retrieval.search_runner import download_nltk_data +from onyx.db.engine import get_all_tenant_ids +from onyx.db.engine import get_session_with_tenant +from onyx.db.models import SlackBot +from onyx.db.search_settings import get_current_search_settings +from onyx.db.slack_bot import fetch_slack_bots +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.natural_language_processing.search_nlp_models import EmbeddingModel +from onyx.natural_language_processing.search_nlp_models import warm_up_bi_encoder +from onyx.onyxbot.slack.config import get_slack_channel_config_for_bot_and_channel +from onyx.onyxbot.slack.config import MAX_TENANTS_PER_POD +from onyx.onyxbot.slack.config import TENANT_ACQUISITION_INTERVAL +from onyx.onyxbot.slack.config import TENANT_HEARTBEAT_EXPIRATION +from onyx.onyxbot.slack.config import TENANT_HEARTBEAT_INTERVAL +from onyx.onyxbot.slack.config import TENANT_LOCK_EXPIRATION +from onyx.onyxbot.slack.constants import DISLIKE_BLOCK_ACTION_ID +from onyx.onyxbot.slack.constants import FEEDBACK_DOC_BUTTON_BLOCK_ACTION_ID +from onyx.onyxbot.slack.constants import FOLLOWUP_BUTTON_ACTION_ID +from onyx.onyxbot.slack.constants import FOLLOWUP_BUTTON_RESOLVED_ACTION_ID +from onyx.onyxbot.slack.constants import GENERATE_ANSWER_BUTTON_ACTION_ID +from onyx.onyxbot.slack.constants import IMMEDIATE_RESOLVED_BUTTON_ACTION_ID +from onyx.onyxbot.slack.constants import LIKE_BLOCK_ACTION_ID +from onyx.onyxbot.slack.constants import VIEW_DOC_FEEDBACK_ID +from onyx.onyxbot.slack.handlers.handle_buttons import handle_doc_feedback_button +from onyx.onyxbot.slack.handlers.handle_buttons import handle_followup_button +from onyx.onyxbot.slack.handlers.handle_buttons import ( handle_followup_resolved_button, ) -from danswer.danswerbot.slack.handlers.handle_buttons import ( +from onyx.onyxbot.slack.handlers.handle_buttons import ( handle_generate_answer_button, ) -from danswer.danswerbot.slack.handlers.handle_buttons import handle_slack_feedback -from danswer.danswerbot.slack.handlers.handle_message import handle_message -from danswer.danswerbot.slack.handlers.handle_message import ( +from onyx.onyxbot.slack.handlers.handle_buttons import handle_slack_feedback +from onyx.onyxbot.slack.handlers.handle_message import handle_message +from onyx.onyxbot.slack.handlers.handle_message import ( remove_scheduled_feedback_reminder, ) -from danswer.danswerbot.slack.handlers.handle_message import schedule_feedback_reminder -from danswer.danswerbot.slack.models import SlackMessageInfo -from danswer.danswerbot.slack.utils import check_message_limit -from danswer.danswerbot.slack.utils import decompose_action_id -from danswer.danswerbot.slack.utils import get_channel_name_from_id -from danswer.danswerbot.slack.utils import get_danswer_bot_slack_bot_id -from danswer.danswerbot.slack.utils import read_slack_thread -from danswer.danswerbot.slack.utils import remove_danswer_bot_tag -from danswer.danswerbot.slack.utils import rephrase_slack_message -from danswer.danswerbot.slack.utils import respond_in_thread -from danswer.danswerbot.slack.utils import TenantSocketModeClient -from danswer.db.engine import get_all_tenant_ids -from danswer.db.engine import get_session_with_tenant -from danswer.db.models import SlackBot -from danswer.db.search_settings import get_current_search_settings -from danswer.db.slack_bot import fetch_slack_bots -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.natural_language_processing.search_nlp_models import EmbeddingModel -from danswer.natural_language_processing.search_nlp_models import warm_up_bi_encoder -from danswer.redis.redis_pool import get_redis_client -from danswer.server.manage.models import SlackBotTokens -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import set_is_ee_based_on_env_variable +from onyx.onyxbot.slack.handlers.handle_message import schedule_feedback_reminder +from onyx.onyxbot.slack.models import SlackMessageInfo +from onyx.onyxbot.slack.utils import check_message_limit +from onyx.onyxbot.slack.utils import decompose_action_id +from onyx.onyxbot.slack.utils import get_channel_name_from_id +from onyx.onyxbot.slack.utils import get_onyx_bot_slack_bot_id +from onyx.onyxbot.slack.utils import read_slack_thread +from onyx.onyxbot.slack.utils import remove_onyx_bot_tag +from onyx.onyxbot.slack.utils import rephrase_slack_message +from onyx.onyxbot.slack.utils import respond_in_thread +from onyx.onyxbot.slack.utils import TenantSocketModeClient +from onyx.redis.redis_pool import get_redis_client +from onyx.server.manage.models import SlackBotTokens +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import set_is_ee_based_on_env_variable from shared_configs.configs import DISALLOWED_SLACK_BOT_TENANT_LIST from shared_configs.configs import MODEL_SERVER_HOST from shared_configs.configs import MODEL_SERVER_PORT @@ -246,7 +246,7 @@ def acquire_tenants(self) -> None: redis_client = get_redis_client(tenant_id=tenant_id) pod_id = self.pod_id acquired = redis_client.set( - DanswerRedisLocks.SLACK_BOT_LOCK, + OnyxRedisLocks.SLACK_BOT_LOCK, pod_id, nx=True, ex=TENANT_LOCK_EXPIRATION, @@ -290,9 +290,7 @@ def send_heartbeats(self) -> None: logger.debug(f"Sending heartbeats for {len(self.tenant_ids)} tenants") for tenant_id in self.tenant_ids: redis_client = get_redis_client(tenant_id=tenant_id) - heartbeat_key = ( - f"{DanswerRedisLocks.SLACK_BOT_HEARTBEAT_PREFIX}:{self.pod_id}" - ) + heartbeat_key = f"{OnyxRedisLocks.SLACK_BOT_HEARTBEAT_PREFIX}:{self.pod_id}" redis_client.set( heartbeat_key, current_time, ex=TENANT_HEARTBEAT_EXPIRATION ) @@ -347,7 +345,7 @@ def shutdown(self, signum: int | None, frame: FrameType | None) -> None: for tenant_id in self.tenant_ids: try: redis_client = get_redis_client(tenant_id=tenant_id) - redis_client.delete(DanswerRedisLocks.SLACK_BOT_LOCK) + redis_client.delete(OnyxRedisLocks.SLACK_BOT_LOCK) logger.info(f"Released lock for tenant {tenant_id}") except Exception as e: logger.error(f"Error releasing lock for tenant {tenant_id}: {e}") @@ -393,7 +391,7 @@ def prefilter_requests(req: SocketModeRequest, client: TenantSocketModeClient) - if ( msg in _SLACK_GREETINGS_TO_IGNORE - or remove_danswer_bot_tag(msg, client=client.web_client) + or remove_onyx_bot_tag(msg, client=client.web_client) in _SLACK_GREETINGS_TO_IGNORE ): channel_specific_logger.error( @@ -412,18 +410,18 @@ def prefilter_requests(req: SocketModeRequest, client: TenantSocketModeClient) - ) return False - bot_tag_id = get_danswer_bot_slack_bot_id(client.web_client) + bot_tag_id = get_onyx_bot_slack_bot_id(client.web_client) if event_type == "message": is_dm = event.get("channel_type") == "im" is_tagged = bot_tag_id and bot_tag_id in msg - is_danswer_bot_msg = bot_tag_id and bot_tag_id in event.get("user", "") + is_onyx_bot_msg = bot_tag_id and bot_tag_id in event.get("user", "") - # DanswerBot should never respond to itself - if is_danswer_bot_msg: - logger.info("Ignoring message from DanswerBot") + # OnyxBot should never respond to itself + if is_onyx_bot_msg: + logger.info("Ignoring message from OnyxBot") return False - # DMs with the bot don't pick up the @DanswerBot so we have to keep the + # DMs with the bot don't pick up the @OnyxBot so we have to keep the # caught events_api if is_tagged and not is_dm: # Let the tag flow handle this case, don't reply twice @@ -440,7 +438,7 @@ def prefilter_requests(req: SocketModeRequest, client: TenantSocketModeClient) - slack_bot_id=client.slack_bot_id, channel_name=channel_name, ) - # If DanswerBot is not specifically tagged and the channel is not set to respond to bots, ignore the message + # If OnyxBot is not specifically tagged and the channel is not set to respond to bots, ignore the message if (not bot_tag_id or bot_tag_id not in msg) and ( not slack_channel_config or not slack_channel_config.channel_config.get("respond_to_bots") @@ -461,7 +459,7 @@ def prefilter_requests(req: SocketModeRequest, client: TenantSocketModeClient) - message_ts = event.get("ts") thread_ts = event.get("thread_ts") # Pick the root of the thread (if a thread exists) - # Can respond in thread if it's an "im" directly to Danswer or @DanswerBot is tagged + # Can respond in thread if it's an "im" directly to Onyx or @OnyxBot is tagged if ( thread_ts and message_ts != thread_ts @@ -485,14 +483,14 @@ def prefilter_requests(req: SocketModeRequest, client: TenantSocketModeClient) - if not channel: channel_specific_logger.error( - "Received DanswerBot command without channel - skipping" + "Received OnyxBot command without channel - skipping" ) return False sender = req.payload.get("user_id") if not sender: channel_specific_logger.error( - "Cannot respond to DanswerBot command without sender to respond to." + "Cannot respond to OnyxBot command without sender to respond to." ) return False @@ -548,7 +546,7 @@ def build_request_details( ) email = expert_info.email if expert_info else None - msg = remove_danswer_bot_tag(msg, client=client.web_client) + msg = remove_onyx_bot_tag(msg, client=client.web_client) if DANSWER_BOT_REPHRASE_MESSAGE: logger.info(f"Rephrasing Slack message. Original message: {msg}") @@ -561,7 +559,7 @@ def build_request_details( logger.info(f"Received Slack message: {msg}") if tagged: - logger.debug("User tagged DanswerBot") + logger.debug("User tagged OnyxBot") if thread_ts != message_ts and thread_ts is not None: thread_messages = read_slack_thread( @@ -661,7 +659,7 @@ def process_message( and not respond_every_channel # Can't have configs for DMs so don't toss them out and not is_dm - # If /DanswerBot (is_bot_msg) or @DanswerBot (bypass_filters) + # If /OnyxBot (is_bot_msg) or @OnyxBot (bypass_filters) # always respond with the default configs and not (details.is_bot_msg or details.bypass_filters) ): @@ -759,7 +757,7 @@ def _get_socket_client( slack_bot_tokens: SlackBotTokens, tenant_id: str | None, slack_bot_id: int ) -> TenantSocketModeClient: # For more info on how to set this up, checkout the docs: - # https://docs.danswer.dev/slack_bot_setup + # https://docs.onyx.app/slack_bot_setup return TenantSocketModeClient( # This app-level token will be used only for establishing a connection app_token=slack_bot_tokens.app_token, diff --git a/backend/danswer/danswerbot/slack/models.py b/backend/onyx/onyxbot/slack/models.py similarity index 53% rename from backend/danswer/danswerbot/slack/models.py rename to backend/onyx/onyxbot/slack/models.py index ef03cc0544d..3921e0b9bb9 100644 --- a/backend/danswer/danswerbot/slack/models.py +++ b/backend/onyx/onyxbot/slack/models.py @@ -1,6 +1,6 @@ from pydantic import BaseModel -from danswer.chat.models import ThreadMessage +from onyx.chat.models import ThreadMessage class SlackMessageInfo(BaseModel): @@ -10,6 +10,6 @@ class SlackMessageInfo(BaseModel): thread_to_respond: str | None sender: str | None email: str | None - bypass_filters: bool # User has tagged @DanswerBot - is_bot_msg: bool # User is using /DanswerBot - is_bot_dm: bool # User is direct messaging to DanswerBot + bypass_filters: bool # User has tagged @OnyxBot + is_bot_msg: bool # User is using /OnyxBot + is_bot_dm: bool # User is direct messaging to OnyxBot diff --git a/backend/danswer/danswerbot/slack/utils.py b/backend/onyx/onyxbot/slack/utils.py similarity index 89% rename from backend/danswer/danswerbot/slack/utils.py rename to backend/onyx/onyxbot/slack/utils.py index 147356b76d1..cd3607dcd5d 100644 --- a/backend/danswer/danswerbot/slack/utils.py +++ b/backend/onyx/onyxbot/slack/utils.py @@ -15,34 +15,34 @@ from slack_sdk.models.metadata import Metadata from slack_sdk.socket_mode import SocketModeClient -from danswer.configs.app_configs import DISABLE_TELEMETRY -from danswer.configs.constants import ID_SEPARATOR -from danswer.configs.constants import MessageType -from danswer.configs.danswerbot_configs import DANSWER_BOT_FEEDBACK_VISIBILITY -from danswer.configs.danswerbot_configs import DANSWER_BOT_MAX_QPM -from danswer.configs.danswerbot_configs import DANSWER_BOT_MAX_WAIT_TIME -from danswer.configs.danswerbot_configs import DANSWER_BOT_NUM_RETRIES -from danswer.configs.danswerbot_configs import ( +from onyx.configs.app_configs import DISABLE_TELEMETRY +from onyx.configs.constants import ID_SEPARATOR +from onyx.configs.constants import MessageType +from onyx.configs.onyxbot_configs import DANSWER_BOT_FEEDBACK_VISIBILITY +from onyx.configs.onyxbot_configs import DANSWER_BOT_MAX_QPM +from onyx.configs.onyxbot_configs import DANSWER_BOT_MAX_WAIT_TIME +from onyx.configs.onyxbot_configs import DANSWER_BOT_NUM_RETRIES +from onyx.configs.onyxbot_configs import ( DANSWER_BOT_RESPONSE_LIMIT_PER_TIME_PERIOD, ) -from danswer.configs.danswerbot_configs import ( +from onyx.configs.onyxbot_configs import ( DANSWER_BOT_RESPONSE_LIMIT_TIME_PERIOD_SECONDS, ) -from danswer.connectors.slack.utils import make_slack_api_rate_limited -from danswer.connectors.slack.utils import SlackTextCleaner -from danswer.danswerbot.slack.constants import FeedbackVisibility -from danswer.danswerbot.slack.models import ThreadMessage -from danswer.db.engine import get_session_with_tenant -from danswer.db.users import get_user_by_email -from danswer.llm.exceptions import GenAIDisabledException -from danswer.llm.factory import get_default_llms -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_to_string -from danswer.prompts.miscellaneous_prompts import SLACK_LANGUAGE_REPHRASE_PROMPT -from danswer.utils.logger import setup_logger -from danswer.utils.telemetry import optional_telemetry -from danswer.utils.telemetry import RecordType -from danswer.utils.text_processing import replace_whitespaces_w_space +from onyx.connectors.slack.utils import make_slack_api_rate_limited +from onyx.connectors.slack.utils import SlackTextCleaner +from onyx.db.engine import get_session_with_tenant +from onyx.db.users import get_user_by_email +from onyx.llm.exceptions import GenAIDisabledException +from onyx.llm.factory import get_default_llms +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_to_string +from onyx.onyxbot.slack.constants import FeedbackVisibility +from onyx.onyxbot.slack.models import ThreadMessage +from onyx.prompts.miscellaneous_prompts import SLACK_LANGUAGE_REPHRASE_PROMPT +from onyx.utils.logger import setup_logger +from onyx.utils.telemetry import optional_telemetry +from onyx.utils.telemetry import RecordType +from onyx.utils.text_processing import replace_whitespaces_w_space logger = setup_logger() @@ -52,7 +52,7 @@ _DANSWER_BOT_COUNT_START_TIME: float = time.time() -def get_danswer_bot_slack_bot_id(web_client: WebClient) -> Any: +def get_onyx_bot_slack_bot_id(web_client: WebClient) -> Any: global _DANSWER_BOT_SLACK_BOT_ID if _DANSWER_BOT_SLACK_BOT_ID is None: _DANSWER_BOT_SLACK_BOT_ID = web_client.auth_test().get("user_id") @@ -75,9 +75,9 @@ def check_message_limit() -> bool: _DANSWER_BOT_COUNT_START_TIME = time.time() if (_DANSWER_BOT_MESSAGE_COUNT + 1) > DANSWER_BOT_RESPONSE_LIMIT_PER_TIME_PERIOD: logger.error( - f"DanswerBot has reached the message limit {DANSWER_BOT_RESPONSE_LIMIT_PER_TIME_PERIOD}" + f"OnyxBot has reached the message limit {DANSWER_BOT_RESPONSE_LIMIT_PER_TIME_PERIOD}" f" for the time period {DANSWER_BOT_RESPONSE_LIMIT_TIME_PERIOD_SECONDS} seconds." - " These limits are configurable in backend/danswer/configs/danswerbot_configs.py" + " These limits are configurable in backend/onyx/configs/onyxbot_configs.py" ) return False _DANSWER_BOT_MESSAGE_COUNT += 1 @@ -136,8 +136,8 @@ def update_emote_react( logger.error(f"Was not able to react to user message due to: {e}") -def remove_danswer_bot_tag(message_str: str, client: WebClient) -> str: - bot_tag_id = get_danswer_bot_slack_bot_id(web_client=client) +def remove_onyx_bot_tag(message_str: str, client: WebClient) -> str: + bot_tag_id = get_onyx_bot_slack_bot_id(web_client=client) return re.sub(rf"<@{bot_tag_id}>\s", "", message_str) @@ -518,19 +518,19 @@ def read_slack_thread( ) message_type = MessageType.USER else: - self_slack_bot_id = get_danswer_bot_slack_bot_id(client) + self_slack_bot_id = get_onyx_bot_slack_bot_id(client) if reply.get("user") == self_slack_bot_id: - # DanswerBot response + # OnyxBot response message_type = MessageType.ASSISTANT user_sem_id = "Assistant" - # DanswerBot responses have both text and blocks + # OnyxBot responses have both text and blocks # The useful content is in the blocks, specifically the first block unless there are # auto-detected filters blocks = reply.get("blocks") if not blocks: - logger.warning(f"DanswerBot response has no blocks: {reply}") + logger.warning(f"OnyxBot response has no blocks: {reply}") continue message = blocks[0].get("text", {}).get("text") @@ -541,11 +541,11 @@ def read_slack_thread( if len(blocks) < 2: logger.warning(f"Only filter blocks found: {reply}") continue - # This is the DanswerBot answer format, if there is a change to how we respond, + # This is the OnyxBot answer format, if there is a change to how we respond, # this will need to be updated to get the correct "answer" portion message = reply["blocks"][1].get("text", {}).get("text") else: - # Other bots are not counted as the LLM response which only comes from Danswer + # Other bots are not counted as the LLM response which only comes from Onyx message_type = MessageType.USER bot_user_name = fetch_user_semantic_id_from_id( reply.get("user"), client @@ -562,7 +562,7 @@ def read_slack_thread( logger.warning("Skipping Slack thread message, no text found") continue - message = remove_danswer_bot_tag(message, client=client) + message = remove_onyx_bot_tag(message, client=client) thread_messages.append( ThreadMessage(message=message, sender=user_sem_id, role=message_type) ) @@ -576,7 +576,7 @@ def slack_usage_report( if DISABLE_TELEMETRY: return - danswer_user = None + onyx_user = None sender_email = None try: sender_email = client.users_info(user=sender_id).data["user"]["profile"]["email"] # type: ignore @@ -585,12 +585,12 @@ def slack_usage_report( if sender_email is not None: with get_session_with_tenant(tenant_id) as db_session: - danswer_user = get_user_by_email(email=sender_email, db_session=db_session) + onyx_user = get_user_by_email(email=sender_email, db_session=db_session) optional_telemetry( record_type=RecordType.USAGE, data={"action": action}, - user_id=str(danswer_user.id) if danswer_user else "Non-Danswer-Or-No-Auth-User", + user_id=str(onyx_user.id) if onyx_user else "Non-Onyx-Or-No-Auth-User", ) diff --git a/backend/danswer/server/query_and_chat/__init__.py b/backend/onyx/prompts/__init__.py similarity index 100% rename from backend/danswer/server/query_and_chat/__init__.py rename to backend/onyx/prompts/__init__.py diff --git a/backend/danswer/prompts/agentic_evaluation.py b/backend/onyx/prompts/agentic_evaluation.py similarity index 100% rename from backend/danswer/prompts/agentic_evaluation.py rename to backend/onyx/prompts/agentic_evaluation.py diff --git a/backend/danswer/prompts/answer_validation.py b/backend/onyx/prompts/answer_validation.py similarity index 91% rename from backend/danswer/prompts/answer_validation.py rename to backend/onyx/prompts/answer_validation.py index 28d184aca78..b07b65036f6 100644 --- a/backend/danswer/prompts/answer_validation.py +++ b/backend/onyx/prompts/answer_validation.py @@ -1,8 +1,8 @@ # The following prompts are used for verifying the LLM answer after it is already produced. # Reflexion flow essentially. This feature can be toggled on/off -from danswer.configs.app_configs import CUSTOM_ANSWER_VALIDITY_CONDITIONS -from danswer.prompts.constants import ANSWER_PAT -from danswer.prompts.constants import QUESTION_PAT +from onyx.configs.app_configs import CUSTOM_ANSWER_VALIDITY_CONDITIONS +from onyx.prompts.constants import ANSWER_PAT +from onyx.prompts.constants import QUESTION_PAT ANSWER_VALIDITY_CONDITIONS = ( """ diff --git a/backend/danswer/prompts/chat_prompts.py b/backend/onyx/prompts/chat_prompts.py similarity index 98% rename from backend/danswer/prompts/chat_prompts.py rename to backend/onyx/prompts/chat_prompts.py index a9653254f9a..56cd279fd66 100644 --- a/backend/danswer/prompts/chat_prompts.py +++ b/backend/onyx/prompts/chat_prompts.py @@ -1,5 +1,5 @@ -from danswer.prompts.constants import GENERAL_SEP_PAT -from danswer.prompts.constants import QUESTION_PAT +from onyx.prompts.constants import GENERAL_SEP_PAT +from onyx.prompts.constants import QUESTION_PAT REQUIRE_CITATION_STATEMENT = """ Cite relevant statements INLINE using the format [1], [2], [3], etc to reference the document number, \ diff --git a/backend/danswer/prompts/chat_tools.py b/backend/onyx/prompts/chat_tools.py similarity index 98% rename from backend/danswer/prompts/chat_tools.py rename to backend/onyx/prompts/chat_tools.py index a33bf2037b0..05b07a0800e 100644 --- a/backend/danswer/prompts/chat_tools.py +++ b/backend/onyx/prompts/chat_tools.py @@ -1,6 +1,6 @@ # These prompts are to support tool calling. Currently not used in the main flow or via any configs # The current generation of LLM is too unreliable for this task. -# Danswer retrieval call as a tool option +# Onyx retrieval call as a tool option DANSWER_TOOL_NAME = "Current Search" DANSWER_TOOL_DESCRIPTION = ( "A search tool that can find information on any topic " diff --git a/backend/danswer/prompts/constants.py b/backend/onyx/prompts/constants.py similarity index 100% rename from backend/danswer/prompts/constants.py rename to backend/onyx/prompts/constants.py diff --git a/backend/danswer/prompts/direct_qa_prompts.py b/backend/onyx/prompts/direct_qa_prompts.py similarity index 92% rename from backend/danswer/prompts/direct_qa_prompts.py rename to backend/onyx/prompts/direct_qa_prompts.py index b00cfcebf15..2b98c486405 100644 --- a/backend/danswer/prompts/direct_qa_prompts.py +++ b/backend/onyx/prompts/direct_qa_prompts.py @@ -2,11 +2,11 @@ # It is used also for the one shot direct QA flow import json -from danswer.prompts.constants import DEFAULT_IGNORE_STATEMENT -from danswer.prompts.constants import FINAL_QUERY_PAT -from danswer.prompts.constants import GENERAL_SEP_PAT -from danswer.prompts.constants import QUESTION_PAT -from danswer.prompts.constants import THOUGHT_PAT +from onyx.prompts.constants import DEFAULT_IGNORE_STATEMENT +from onyx.prompts.constants import FINAL_QUERY_PAT +from onyx.prompts.constants import GENERAL_SEP_PAT +from onyx.prompts.constants import QUESTION_PAT +from onyx.prompts.constants import THOUGHT_PAT ONE_SHOT_SYSTEM_PROMPT = """ @@ -171,4 +171,4 @@ # User the following for easy viewing of prompts if __name__ == "__main__": - print(JSON_PROMPT) # Default prompt used in the Danswer UI flow + print(JSON_PROMPT) # Default prompt used in the Onyx UI flow diff --git a/backend/danswer/prompts/filter_extration.py b/backend/onyx/prompts/filter_extration.py similarity index 98% rename from backend/danswer/prompts/filter_extration.py rename to backend/onyx/prompts/filter_extration.py index 3c5e879ebe0..d213abc34c2 100644 --- a/backend/danswer/prompts/filter_extration.py +++ b/backend/onyx/prompts/filter_extration.py @@ -1,7 +1,7 @@ # The following prompts are used for extracting filters to apply along with the query in the # document index. For example, a filter for dates or a filter by source type such as GitHub # or Slack -from danswer.prompts.constants import SOURCES_KEY +from onyx.prompts.constants import SOURCES_KEY # Smaller followup prompts in time_filter.py diff --git a/backend/danswer/prompts/llm_chunk_filter.py b/backend/onyx/prompts/llm_chunk_filter.py similarity index 100% rename from backend/danswer/prompts/llm_chunk_filter.py rename to backend/onyx/prompts/llm_chunk_filter.py diff --git a/backend/danswer/prompts/miscellaneous_prompts.py b/backend/onyx/prompts/miscellaneous_prompts.py similarity index 100% rename from backend/danswer/prompts/miscellaneous_prompts.py rename to backend/onyx/prompts/miscellaneous_prompts.py diff --git a/backend/danswer/prompts/prompt_utils.py b/backend/onyx/prompts/prompt_utils.py similarity index 92% rename from backend/danswer/prompts/prompt_utils.py rename to backend/onyx/prompts/prompt_utils.py index ec2801783cd..254bba9e38a 100644 --- a/backend/danswer/prompts/prompt_utils.py +++ b/backend/onyx/prompts/prompt_utils.py @@ -4,16 +4,16 @@ from langchain_core.messages import BaseMessage -from danswer.chat.models import LlmDoc -from danswer.chat.models import PromptConfig -from danswer.configs.chat_configs import LANGUAGE_HINT -from danswer.configs.constants import DocumentSource -from danswer.context.search.models import InferenceChunk -from danswer.db.models import Prompt -from danswer.prompts.chat_prompts import ADDITIONAL_INFO -from danswer.prompts.chat_prompts import CITATION_REMINDER -from danswer.prompts.constants import CODE_BLOCK_PAT -from danswer.utils.logger import setup_logger +from onyx.chat.models import LlmDoc +from onyx.chat.models import PromptConfig +from onyx.configs.chat_configs import LANGUAGE_HINT +from onyx.configs.constants import DocumentSource +from onyx.context.search.models import InferenceChunk +from onyx.db.models import Prompt +from onyx.prompts.chat_prompts import ADDITIONAL_INFO +from onyx.prompts.chat_prompts import CITATION_REMINDER +from onyx.prompts.constants import CODE_BLOCK_PAT +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/prompts/query_validation.py b/backend/onyx/prompts/query_validation.py similarity index 82% rename from backend/danswer/prompts/query_validation.py rename to backend/onyx/prompts/query_validation.py index 68163229925..9f08f12e937 100644 --- a/backend/danswer/prompts/query_validation.py +++ b/backend/onyx/prompts/query_validation.py @@ -2,10 +2,10 @@ # system. Many new users do not understand the design/capabilities of the system and will ask # questions that are unanswerable such as aggregations or user specific questions that the system # cannot handle, this is used to identify those cases -from danswer.prompts.constants import ANSWERABLE_PAT -from danswer.prompts.constants import GENERAL_SEP_PAT -from danswer.prompts.constants import QUESTION_PAT -from danswer.prompts.constants import THOUGHT_PAT +from onyx.prompts.constants import ANSWERABLE_PAT +from onyx.prompts.constants import GENERAL_SEP_PAT +from onyx.prompts.constants import QUESTION_PAT +from onyx.prompts.constants import THOUGHT_PAT ANSWERABLE_PROMPT = f""" @@ -32,10 +32,10 @@ {ANSWERABLE_PAT.upper()} False ``` -{QUESTION_PAT.upper()} Danswer is unreachable. +{QUESTION_PAT.upper()} Onyx is unreachable. ``` -{THOUGHT_PAT.upper()} The system searches documents related to Danswer being unreachable. \ -Assuming the documents from search contains situations where Danswer is not reachable and \ +{THOUGHT_PAT.upper()} The system searches documents related to Onyx being unreachable. \ +Assuming the documents from search contains situations where Onyx is not reachable and \ contains a fix, the query may be answerable. {ANSWERABLE_PAT.upper()} True ``` diff --git a/backend/danswer/prompts/token_counts.py b/backend/onyx/prompts/token_counts.py similarity index 62% rename from backend/danswer/prompts/token_counts.py rename to backend/onyx/prompts/token_counts.py index c5bb7b2881e..beb6a5064c3 100644 --- a/backend/danswer/prompts/token_counts.py +++ b/backend/onyx/prompts/token_counts.py @@ -1,11 +1,11 @@ -from danswer.configs.chat_configs import LANGUAGE_HINT -from danswer.llm.utils import check_number_of_tokens -from danswer.prompts.chat_prompts import ADDITIONAL_INFO -from danswer.prompts.chat_prompts import CHAT_USER_PROMPT -from danswer.prompts.chat_prompts import CITATION_REMINDER -from danswer.prompts.chat_prompts import REQUIRE_CITATION_STATEMENT -from danswer.prompts.constants import DEFAULT_IGNORE_STATEMENT -from danswer.prompts.prompt_utils import get_current_llm_day_time +from onyx.configs.chat_configs import LANGUAGE_HINT +from onyx.llm.utils import check_number_of_tokens +from onyx.prompts.chat_prompts import ADDITIONAL_INFO +from onyx.prompts.chat_prompts import CHAT_USER_PROMPT +from onyx.prompts.chat_prompts import CITATION_REMINDER +from onyx.prompts.chat_prompts import REQUIRE_CITATION_STATEMENT +from onyx.prompts.constants import DEFAULT_IGNORE_STATEMENT +from onyx.prompts.prompt_utils import get_current_llm_day_time # tokens outside of the actual persona's "user_prompt" that make up the end user message CHAT_USER_PROMPT_WITH_CONTEXT_OVERHEAD_TOKEN_CNT = check_number_of_tokens( diff --git a/backend/danswer/redis/redis_connector.py b/backend/onyx/redis/redis_connector.py similarity index 86% rename from backend/danswer/redis/redis_connector.py rename to backend/onyx/redis/redis_connector.py index 8d82fc11943..f55ff4a89db 100644 --- a/backend/danswer/redis/redis_connector.py +++ b/backend/onyx/redis/redis_connector.py @@ -2,14 +2,14 @@ import redis -from danswer.db.models import SearchSettings -from danswer.redis.redis_connector_delete import RedisConnectorDelete -from danswer.redis.redis_connector_doc_perm_sync import RedisConnectorPermissionSync -from danswer.redis.redis_connector_ext_group_sync import RedisConnectorExternalGroupSync -from danswer.redis.redis_connector_index import RedisConnectorIndex -from danswer.redis.redis_connector_prune import RedisConnectorPrune -from danswer.redis.redis_connector_stop import RedisConnectorStop -from danswer.redis.redis_pool import get_redis_client +from onyx.db.models import SearchSettings +from onyx.redis.redis_connector_delete import RedisConnectorDelete +from onyx.redis.redis_connector_doc_perm_sync import RedisConnectorPermissionSync +from onyx.redis.redis_connector_ext_group_sync import RedisConnectorExternalGroupSync +from onyx.redis.redis_connector_index import RedisConnectorIndex +from onyx.redis.redis_connector_prune import RedisConnectorPrune +from onyx.redis.redis_connector_stop import RedisConnectorStop +from onyx.redis.redis_pool import get_redis_client class RedisConnector: diff --git a/backend/danswer/redis/redis_connector_credential_pair.py b/backend/onyx/redis/redis_connector_credential_pair.py similarity index 85% rename from backend/danswer/redis/redis_connector_credential_pair.py rename to backend/onyx/redis/redis_connector_credential_pair.py index 23661bf82c9..a8db85d2872 100644 --- a/backend/danswer/redis/redis_connector_credential_pair.py +++ b/backend/onyx/redis/redis_connector_credential_pair.py @@ -7,16 +7,16 @@ from redis.lock import Lock as RedisLock from sqlalchemy.orm import Session -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.document import ( +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.document import ( construct_document_select_for_connector_credential_pair_by_needs_sync, ) -from danswer.db.models import Document -from danswer.redis.redis_object_helper import RedisObjectHelper +from onyx.db.models import Document +from onyx.redis.redis_object_helper import RedisObjectHelper class RedisConnectorCredentialPair(RedisObjectHelper): @@ -106,11 +106,11 @@ def generate_tasks( # Priority on sync's triggered by new indexing should be medium result = celery_app.send_task( - DanswerCeleryTask.VESPA_METADATA_SYNC_TASK, + OnyxCeleryTask.VESPA_METADATA_SYNC_TASK, kwargs=dict(document_id=doc.id, tenant_id=tenant_id), - queue=DanswerCeleryQueues.VESPA_METADATA_SYNC, + queue=OnyxCeleryQueues.VESPA_METADATA_SYNC, task_id=custom_task_id, - priority=DanswerCeleryPriority.MEDIUM, + priority=OnyxCeleryPriority.MEDIUM, ) async_results.append(result) diff --git a/backend/danswer/redis/redis_connector_delete.py b/backend/onyx/redis/redis_connector_delete.py similarity index 87% rename from backend/danswer/redis/redis_connector_delete.py rename to backend/onyx/redis/redis_connector_delete.py index 4ab42ee65a7..1afe01e2696 100644 --- a/backend/danswer/redis/redis_connector_delete.py +++ b/backend/onyx/redis/redis_connector_delete.py @@ -9,13 +9,13 @@ from redis.lock import Lock as RedisLock from sqlalchemy.orm import Session -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.document import construct_document_select_for_connector_credential_pair -from danswer.db.models import Document as DbDocument +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.document import construct_document_select_for_connector_credential_pair +from onyx.db.models import Document as DbDocument class RedisConnectorDeletePayload(BaseModel): @@ -115,16 +115,16 @@ def generate_tasks( # Priority on sync's triggered by new indexing should be medium result = celery_app.send_task( - DanswerCeleryTask.DOCUMENT_BY_CC_PAIR_CLEANUP_TASK, + OnyxCeleryTask.DOCUMENT_BY_CC_PAIR_CLEANUP_TASK, kwargs=dict( document_id=doc.id, connector_id=cc_pair.connector_id, credential_id=cc_pair.credential_id, tenant_id=self.tenant_id, ), - queue=DanswerCeleryQueues.CONNECTOR_DELETION, + queue=OnyxCeleryQueues.CONNECTOR_DELETION, task_id=custom_task_id, - priority=DanswerCeleryPriority.MEDIUM, + priority=OnyxCeleryPriority.MEDIUM, ) async_results.append(result) diff --git a/backend/danswer/redis/redis_connector_doc_perm_sync.py b/backend/onyx/redis/redis_connector_doc_perm_sync.py similarity index 92% rename from backend/danswer/redis/redis_connector_doc_perm_sync.py rename to backend/onyx/redis/redis_connector_doc_perm_sync.py index f14d761f709..4fabab95769 100644 --- a/backend/danswer/redis/redis_connector_doc_perm_sync.py +++ b/backend/onyx/redis/redis_connector_doc_perm_sync.py @@ -8,11 +8,11 @@ from pydantic import BaseModel from redis.lock import Lock as RedisLock -from danswer.access.models import DocExternalAccess -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask +from onyx.access.models import DocExternalAccess +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask class RedisConnectorPermissionSyncPayload(BaseModel): @@ -152,7 +152,7 @@ def generate_tasks( self.redis.sadd(self.taskset_key, custom_task_id) result = celery_app.send_task( - DanswerCeleryTask.UPDATE_EXTERNAL_DOCUMENT_PERMISSIONS_TASK, + OnyxCeleryTask.UPDATE_EXTERNAL_DOCUMENT_PERMISSIONS_TASK, kwargs=dict( tenant_id=self.tenant_id, serialized_doc_external_access=doc_perm.to_dict(), @@ -160,9 +160,9 @@ def generate_tasks( connector_id=connector_id, credential_id=credential_id, ), - queue=DanswerCeleryQueues.DOC_PERMISSIONS_UPSERT, + queue=OnyxCeleryQueues.DOC_PERMISSIONS_UPSERT, task_id=custom_task_id, - priority=DanswerCeleryPriority.MEDIUM, + priority=OnyxCeleryPriority.MEDIUM, ) async_results.append(result) diff --git a/backend/danswer/redis/redis_connector_ext_group_sync.py b/backend/onyx/redis/redis_connector_ext_group_sync.py similarity index 100% rename from backend/danswer/redis/redis_connector_ext_group_sync.py rename to backend/onyx/redis/redis_connector_ext_group_sync.py diff --git a/backend/danswer/redis/redis_connector_index.py b/backend/onyx/redis/redis_connector_index.py similarity index 100% rename from backend/danswer/redis/redis_connector_index.py rename to backend/onyx/redis/redis_connector_index.py diff --git a/backend/danswer/redis/redis_connector_prune.py b/backend/onyx/redis/redis_connector_prune.py similarity index 91% rename from backend/danswer/redis/redis_connector_prune.py rename to backend/onyx/redis/redis_connector_prune.py index 9739d2f9832..2e7f8214e1c 100644 --- a/backend/danswer/redis/redis_connector_prune.py +++ b/backend/onyx/redis/redis_connector_prune.py @@ -7,11 +7,11 @@ from redis.lock import Lock as RedisLock from sqlalchemy.orm import Session -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id class RedisConnectorPrune: @@ -135,16 +135,16 @@ def generate_tasks( # Priority on sync's triggered by new indexing should be medium result = celery_app.send_task( - DanswerCeleryTask.DOCUMENT_BY_CC_PAIR_CLEANUP_TASK, + OnyxCeleryTask.DOCUMENT_BY_CC_PAIR_CLEANUP_TASK, kwargs=dict( document_id=doc_id, connector_id=cc_pair.connector_id, credential_id=cc_pair.credential_id, tenant_id=self.tenant_id, ), - queue=DanswerCeleryQueues.CONNECTOR_DELETION, + queue=OnyxCeleryQueues.CONNECTOR_DELETION, task_id=custom_task_id, - priority=DanswerCeleryPriority.MEDIUM, + priority=OnyxCeleryPriority.MEDIUM, ) async_results.append(result) diff --git a/backend/danswer/redis/redis_connector_stop.py b/backend/onyx/redis/redis_connector_stop.py similarity index 100% rename from backend/danswer/redis/redis_connector_stop.py rename to backend/onyx/redis/redis_connector_stop.py diff --git a/backend/danswer/redis/redis_document_set.py b/backend/onyx/redis/redis_document_set.py similarity index 83% rename from backend/danswer/redis/redis_document_set.py rename to backend/onyx/redis/redis_document_set.py index ff92c30a4e5..6ace3e325c2 100644 --- a/backend/danswer/redis/redis_document_set.py +++ b/backend/onyx/redis/redis_document_set.py @@ -8,12 +8,12 @@ from redis.lock import Lock as RedisLock from sqlalchemy.orm import Session -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.db.document_set import construct_document_select_by_docset -from danswer.redis.redis_object_helper import RedisObjectHelper +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.db.document_set import construct_document_select_by_docset +from onyx.redis.redis_object_helper import RedisObjectHelper class RedisDocumentSet(RedisObjectHelper): @@ -77,11 +77,11 @@ def generate_tasks( redis_client.sadd(self.taskset_key, custom_task_id) result = celery_app.send_task( - DanswerCeleryTask.VESPA_METADATA_SYNC_TASK, + OnyxCeleryTask.VESPA_METADATA_SYNC_TASK, kwargs=dict(document_id=doc.id, tenant_id=tenant_id), - queue=DanswerCeleryQueues.VESPA_METADATA_SYNC, + queue=OnyxCeleryQueues.VESPA_METADATA_SYNC, task_id=custom_task_id, - priority=DanswerCeleryPriority.LOW, + priority=OnyxCeleryPriority.LOW, ) async_results.append(result) diff --git a/backend/danswer/redis/redis_object_helper.py b/backend/onyx/redis/redis_object_helper.py similarity index 98% rename from backend/danswer/redis/redis_object_helper.py rename to backend/onyx/redis/redis_object_helper.py index 35366a36aab..4c90236573b 100644 --- a/backend/danswer/redis/redis_object_helper.py +++ b/backend/onyx/redis/redis_object_helper.py @@ -6,7 +6,7 @@ from redis.lock import Lock as RedisLock from sqlalchemy.orm import Session -from danswer.redis.redis_pool import get_redis_client +from onyx.redis.redis_pool import get_redis_client class RedisObjectHelper(ABC): diff --git a/backend/danswer/redis/redis_pool.py b/backend/onyx/redis/redis_pool.py similarity index 90% rename from backend/danswer/redis/redis_pool.py rename to backend/onyx/redis/redis_pool.py index 0fe5c0ddd42..9387049138e 100644 --- a/backend/danswer/redis/redis_pool.py +++ b/backend/onyx/redis/redis_pool.py @@ -7,17 +7,17 @@ import redis from redis.client import Redis -from danswer.configs.app_configs import REDIS_DB_NUMBER -from danswer.configs.app_configs import REDIS_HEALTH_CHECK_INTERVAL -from danswer.configs.app_configs import REDIS_HOST -from danswer.configs.app_configs import REDIS_PASSWORD -from danswer.configs.app_configs import REDIS_POOL_MAX_CONNECTIONS -from danswer.configs.app_configs import REDIS_PORT -from danswer.configs.app_configs import REDIS_SSL -from danswer.configs.app_configs import REDIS_SSL_CA_CERTS -from danswer.configs.app_configs import REDIS_SSL_CERT_REQS -from danswer.configs.constants import REDIS_SOCKET_KEEPALIVE_OPTIONS -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import REDIS_DB_NUMBER +from onyx.configs.app_configs import REDIS_HEALTH_CHECK_INTERVAL +from onyx.configs.app_configs import REDIS_HOST +from onyx.configs.app_configs import REDIS_PASSWORD +from onyx.configs.app_configs import REDIS_POOL_MAX_CONNECTIONS +from onyx.configs.app_configs import REDIS_PORT +from onyx.configs.app_configs import REDIS_SSL +from onyx.configs.app_configs import REDIS_SSL_CA_CERTS +from onyx.configs.app_configs import REDIS_SSL_CERT_REQS +from onyx.configs.constants import REDIS_SOCKET_KEEPALIVE_OPTIONS +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/redis/redis_usergroup.py b/backend/onyx/redis/redis_usergroup.py similarity index 82% rename from backend/danswer/redis/redis_usergroup.py rename to backend/onyx/redis/redis_usergroup.py index 83bd8859632..3a9a863fa5d 100644 --- a/backend/danswer/redis/redis_usergroup.py +++ b/backend/onyx/redis/redis_usergroup.py @@ -8,13 +8,13 @@ from redis.lock import Lock as RedisLock from sqlalchemy.orm import Session -from danswer.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryQueues -from danswer.configs.constants import DanswerCeleryTask -from danswer.redis.redis_object_helper import RedisObjectHelper -from danswer.utils.variable_functionality import fetch_versioned_implementation -from danswer.utils.variable_functionality import global_version +from onyx.configs.constants import CELERY_VESPA_SYNC_BEAT_LOCK_TIMEOUT +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryQueues +from onyx.configs.constants import OnyxCeleryTask +from onyx.redis.redis_object_helper import RedisObjectHelper +from onyx.utils.variable_functionality import fetch_versioned_implementation +from onyx.utils.variable_functionality import global_version class RedisUserGroup(RedisObjectHelper): @@ -65,7 +65,7 @@ def generate_tasks( try: construct_document_select_by_usergroup = fetch_versioned_implementation( - "danswer.db.user_group", + "onyx.db.user_group", "construct_document_select_by_usergroup", ) except ModuleNotFoundError: @@ -90,11 +90,11 @@ def generate_tasks( redis_client.sadd(self.taskset_key, custom_task_id) result = celery_app.send_task( - DanswerCeleryTask.VESPA_METADATA_SYNC_TASK, + OnyxCeleryTask.VESPA_METADATA_SYNC_TASK, kwargs=dict(document_id=doc.id, tenant_id=tenant_id), - queue=DanswerCeleryQueues.VESPA_METADATA_SYNC, + queue=OnyxCeleryQueues.VESPA_METADATA_SYNC, task_id=custom_task_id, - priority=DanswerCeleryPriority.LOW, + priority=OnyxCeleryPriority.LOW, ) async_results.append(result) diff --git a/backend/danswer/utils/__init__.py b/backend/onyx/secondary_llm_flows/__init__.py similarity index 100% rename from backend/danswer/utils/__init__.py rename to backend/onyx/secondary_llm_flows/__init__.py diff --git a/backend/danswer/secondary_llm_flows/agentic_evaluation.py b/backend/onyx/secondary_llm_flows/agentic_evaluation.py similarity index 86% rename from backend/danswer/secondary_llm_flows/agentic_evaluation.py rename to backend/onyx/secondary_llm_flows/agentic_evaluation.py index 2da61f4cb51..c942f9ed183 100644 --- a/backend/danswer/secondary_llm_flows/agentic_evaluation.py +++ b/backend/onyx/secondary_llm_flows/agentic_evaluation.py @@ -1,13 +1,13 @@ import re -from danswer.chat.models import SectionRelevancePiece -from danswer.context.search.models import InferenceSection -from danswer.llm.interfaces import LLM -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_to_string -from danswer.prompts.agentic_evaluation import AGENTIC_SEARCH_SYSTEM_PROMPT -from danswer.prompts.agentic_evaluation import AGENTIC_SEARCH_USER_PROMPT -from danswer.utils.logger import setup_logger +from onyx.chat.models import SectionRelevancePiece +from onyx.context.search.models import InferenceSection +from onyx.llm.interfaces import LLM +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_to_string +from onyx.prompts.agentic_evaluation import AGENTIC_SEARCH_SYSTEM_PROMPT +from onyx.prompts.agentic_evaluation import AGENTIC_SEARCH_USER_PROMPT +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/secondary_llm_flows/answer_validation.py b/backend/onyx/secondary_llm_flows/answer_validation.py similarity index 81% rename from backend/danswer/secondary_llm_flows/answer_validation.py rename to backend/onyx/secondary_llm_flows/answer_validation.py index 68587109538..5b750a2514e 100644 --- a/backend/danswer/secondary_llm_flows/answer_validation.py +++ b/backend/onyx/secondary_llm_flows/answer_validation.py @@ -1,10 +1,10 @@ -from danswer.llm.exceptions import GenAIDisabledException -from danswer.llm.factory import get_default_llms -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_to_string -from danswer.prompts.answer_validation import ANSWER_VALIDITY_PROMPT -from danswer.utils.logger import setup_logger -from danswer.utils.timing import log_function_time +from onyx.llm.exceptions import GenAIDisabledException +from onyx.llm.factory import get_default_llms +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_to_string +from onyx.prompts.answer_validation import ANSWER_VALIDITY_PROMPT +from onyx.utils.logger import setup_logger +from onyx.utils.timing import log_function_time logger = setup_logger() diff --git a/backend/danswer/secondary_llm_flows/chat_session_naming.py b/backend/onyx/secondary_llm_flows/chat_session_naming.py similarity index 60% rename from backend/danswer/secondary_llm_flows/chat_session_naming.py rename to backend/onyx/secondary_llm_flows/chat_session_naming.py index 9ca5f34a62f..439fa1cbe57 100644 --- a/backend/danswer/secondary_llm_flows/chat_session_naming.py +++ b/backend/onyx/secondary_llm_flows/chat_session_naming.py @@ -1,13 +1,13 @@ -from danswer.chat.chat_utils import combine_message_chain -from danswer.configs.chat_configs import LANGUAGE_CHAT_NAMING_HINT -from danswer.configs.model_configs import GEN_AI_HISTORY_CUTOFF -from danswer.db.models import ChatMessage -from danswer.db.search_settings import get_multilingual_expansion -from danswer.llm.interfaces import LLM -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_to_string -from danswer.prompts.chat_prompts import CHAT_NAMING -from danswer.utils.logger import setup_logger +from onyx.chat.chat_utils import combine_message_chain +from onyx.configs.chat_configs import LANGUAGE_CHAT_NAMING_HINT +from onyx.configs.model_configs import GEN_AI_HISTORY_CUTOFF +from onyx.db.models import ChatMessage +from onyx.db.search_settings import get_multilingual_expansion +from onyx.llm.interfaces import LLM +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_to_string +from onyx.prompts.chat_prompts import CHAT_NAMING +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/secondary_llm_flows/choose_search.py b/backend/onyx/secondary_llm_flows/choose_search.py similarity index 66% rename from backend/danswer/secondary_llm_flows/choose_search.py rename to backend/onyx/secondary_llm_flows/choose_search.py index 36539dd4a7d..7f48501af38 100644 --- a/backend/danswer/secondary_llm_flows/choose_search.py +++ b/backend/onyx/secondary_llm_flows/choose_search.py @@ -2,21 +2,21 @@ from langchain.schema import HumanMessage from langchain.schema import SystemMessage -from danswer.chat.chat_utils import combine_message_chain -from danswer.chat.prompt_builder.utils import translate_danswer_msg_to_langchain -from danswer.configs.chat_configs import DISABLE_LLM_CHOOSE_SEARCH -from danswer.configs.model_configs import GEN_AI_HISTORY_CUTOFF -from danswer.db.models import ChatMessage -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_to_string -from danswer.prompts.chat_prompts import AGGRESSIVE_SEARCH_TEMPLATE -from danswer.prompts.chat_prompts import NO_SEARCH -from danswer.prompts.chat_prompts import REQUIRE_SEARCH_HINT -from danswer.prompts.chat_prompts import REQUIRE_SEARCH_SYSTEM_MSG -from danswer.prompts.chat_prompts import SKIP_SEARCH -from danswer.utils.logger import setup_logger +from onyx.chat.chat_utils import combine_message_chain +from onyx.chat.prompt_builder.utils import translate_onyx_msg_to_langchain +from onyx.configs.chat_configs import DISABLE_LLM_CHOOSE_SEARCH +from onyx.configs.model_configs import GEN_AI_HISTORY_CUTOFF +from onyx.db.models import ChatMessage +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_to_string +from onyx.prompts.chat_prompts import AGGRESSIVE_SEARCH_TEMPLATE +from onyx.prompts.chat_prompts import NO_SEARCH +from onyx.prompts.chat_prompts import REQUIRE_SEARCH_HINT +from onyx.prompts.chat_prompts import REQUIRE_SEARCH_SYSTEM_MSG +from onyx.prompts.chat_prompts import SKIP_SEARCH +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -32,7 +32,7 @@ def check_if_need_search_multi_message( return True prompt_msgs: list[BaseMessage] = [SystemMessage(content=REQUIRE_SEARCH_SYSTEM_MSG)] - prompt_msgs.extend([translate_danswer_msg_to_langchain(msg) for msg in history]) + prompt_msgs.extend([translate_onyx_msg_to_langchain(msg) for msg in history]) last_query = query_message.message diff --git a/backend/danswer/secondary_llm_flows/chunk_usefulness.py b/backend/onyx/secondary_llm_flows/chunk_usefulness.py similarity index 86% rename from backend/danswer/secondary_llm_flows/chunk_usefulness.py rename to backend/onyx/secondary_llm_flows/chunk_usefulness.py index b978244028f..323a7802e05 100644 --- a/backend/danswer/secondary_llm_flows/chunk_usefulness.py +++ b/backend/onyx/secondary_llm_flows/chunk_usefulness.py @@ -1,13 +1,13 @@ from collections.abc import Callable -from danswer.configs.chat_configs import DISABLE_LLM_DOC_RELEVANCE -from danswer.llm.interfaces import LLM -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_to_string -from danswer.prompts.llm_chunk_filter import NONUSEFUL_PAT -from danswer.prompts.llm_chunk_filter import SECTION_FILTER_PROMPT -from danswer.utils.logger import setup_logger -from danswer.utils.threadpool_concurrency import run_functions_tuples_in_parallel +from onyx.configs.chat_configs import DISABLE_LLM_DOC_RELEVANCE +from onyx.llm.interfaces import LLM +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_to_string +from onyx.prompts.llm_chunk_filter import NONUSEFUL_PAT +from onyx.prompts.llm_chunk_filter import SECTION_FILTER_PROMPT +from onyx.utils.logger import setup_logger +from onyx.utils.threadpool_concurrency import run_functions_tuples_in_parallel logger = setup_logger() diff --git a/backend/danswer/secondary_llm_flows/query_expansion.py b/backend/onyx/secondary_llm_flows/query_expansion.py similarity index 83% rename from backend/danswer/secondary_llm_flows/query_expansion.py rename to backend/onyx/secondary_llm_flows/query_expansion.py index 07f187e5b4f..a44beefeb88 100644 --- a/backend/danswer/secondary_llm_flows/query_expansion.py +++ b/backend/onyx/secondary_llm_flows/query_expansion.py @@ -1,20 +1,20 @@ from collections.abc import Callable -from danswer.chat.chat_utils import combine_message_chain -from danswer.configs.chat_configs import DISABLE_LLM_QUERY_REPHRASE -from danswer.configs.model_configs import GEN_AI_HISTORY_CUTOFF -from danswer.db.models import ChatMessage -from danswer.llm.exceptions import GenAIDisabledException -from danswer.llm.factory import get_default_llms -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_to_string -from danswer.prompts.chat_prompts import HISTORY_QUERY_REPHRASE -from danswer.prompts.miscellaneous_prompts import LANGUAGE_REPHRASE_PROMPT -from danswer.utils.logger import setup_logger -from danswer.utils.text_processing import count_punctuation -from danswer.utils.threadpool_concurrency import run_functions_tuples_in_parallel +from onyx.chat.chat_utils import combine_message_chain +from onyx.configs.chat_configs import DISABLE_LLM_QUERY_REPHRASE +from onyx.configs.model_configs import GEN_AI_HISTORY_CUTOFF +from onyx.db.models import ChatMessage +from onyx.llm.exceptions import GenAIDisabledException +from onyx.llm.factory import get_default_llms +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_to_string +from onyx.prompts.chat_prompts import HISTORY_QUERY_REPHRASE +from onyx.prompts.miscellaneous_prompts import LANGUAGE_REPHRASE_PROMPT +from onyx.utils.logger import setup_logger +from onyx.utils.text_processing import count_punctuation +from onyx.utils.threadpool_concurrency import run_functions_tuples_in_parallel logger = setup_logger() diff --git a/backend/danswer/secondary_llm_flows/query_validation.py b/backend/onyx/secondary_llm_flows/query_validation.py similarity index 82% rename from backend/danswer/secondary_llm_flows/query_validation.py rename to backend/onyx/secondary_llm_flows/query_validation.py index d11e603715e..514c2d5e103 100644 --- a/backend/danswer/secondary_llm_flows/query_validation.py +++ b/backend/onyx/secondary_llm_flows/query_validation.py @@ -2,19 +2,19 @@ import re from collections.abc import Iterator -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import StreamingError -from danswer.llm.exceptions import GenAIDisabledException -from danswer.llm.factory import get_default_llms -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_generator_to_string_generator -from danswer.llm.utils import message_to_string -from danswer.prompts.constants import ANSWERABLE_PAT -from danswer.prompts.constants import THOUGHT_PAT -from danswer.prompts.query_validation import ANSWERABLE_PROMPT -from danswer.server.query_and_chat.models import QueryValidationResponse -from danswer.server.utils import get_json_line -from danswer.utils.logger import setup_logger +from onyx.chat.models import OnyxAnswerPiece +from onyx.chat.models import StreamingError +from onyx.llm.exceptions import GenAIDisabledException +from onyx.llm.factory import get_default_llms +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_generator_to_string_generator +from onyx.llm.utils import message_to_string +from onyx.prompts.constants import ANSWERABLE_PAT +from onyx.prompts.constants import THOUGHT_PAT +from onyx.prompts.query_validation import ANSWERABLE_PROMPT +from onyx.server.query_and_chat.models import QueryValidationResponse +from onyx.server.utils import get_json_line +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -107,7 +107,7 @@ def stream_query_answerability( remaining = model_output[reason_ind + len(THOUGHT_PAT.upper()) :] if remaining: yield get_json_line( - DanswerAnswerPiece(answer_piece=remaining).model_dump() + OnyxAnswerPiece(answer_piece=remaining).model_dump() ) continue @@ -116,7 +116,7 @@ def stream_query_answerability( if hold_answerable == ANSWERABLE_PAT.upper()[: len(hold_answerable)]: continue yield get_json_line( - DanswerAnswerPiece(answer_piece=hold_answerable).model_dump() + OnyxAnswerPiece(answer_piece=hold_answerable).model_dump() ) hold_answerable = "" diff --git a/backend/danswer/secondary_llm_flows/source_filter.py b/backend/onyx/secondary_llm_flows/source_filter.py similarity index 85% rename from backend/danswer/secondary_llm_flows/source_filter.py rename to backend/onyx/secondary_llm_flows/source_filter.py index f58a91016e0..420a8b0d8a2 100644 --- a/backend/danswer/secondary_llm_flows/source_filter.py +++ b/backend/onyx/secondary_llm_flows/source_filter.py @@ -3,22 +3,22 @@ from sqlalchemy.orm import Session -from danswer.configs.chat_configs import ENABLE_CONNECTOR_CLASSIFIER -from danswer.configs.constants import DocumentSource -from danswer.db.connector import fetch_unique_document_sources -from danswer.db.engine import get_sqlalchemy_engine -from danswer.llm.interfaces import LLM -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_to_string -from danswer.natural_language_processing.search_nlp_models import ( +from onyx.configs.chat_configs import ENABLE_CONNECTOR_CLASSIFIER +from onyx.configs.constants import DocumentSource +from onyx.db.connector import fetch_unique_document_sources +from onyx.db.engine import get_sqlalchemy_engine +from onyx.llm.interfaces import LLM +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_to_string +from onyx.natural_language_processing.search_nlp_models import ( ConnectorClassificationModel, ) -from danswer.prompts.constants import SOURCES_KEY -from danswer.prompts.filter_extration import FILE_SOURCE_WARNING -from danswer.prompts.filter_extration import SOURCE_FILTER_PROMPT -from danswer.prompts.filter_extration import WEB_SOURCE_WARNING -from danswer.utils.logger import setup_logger -from danswer.utils.text_processing import extract_embedded_json +from onyx.prompts.constants import SOURCES_KEY +from onyx.prompts.filter_extration import FILE_SOURCE_WARNING +from onyx.prompts.filter_extration import SOURCE_FILTER_PROMPT +from onyx.prompts.filter_extration import WEB_SOURCE_WARNING +from onyx.utils.logger import setup_logger +from onyx.utils.text_processing import extract_embedded_json logger = setup_logger() @@ -148,7 +148,7 @@ def _get_source_filter_messages( }, { "role": "user", - "content": "What page from Danswer contains debugging instruction on segfault", + "content": "What page from Onyx contains debugging instruction on segfault", }, { "role": "assistant", @@ -186,7 +186,7 @@ def _extract_source_filters_from_llm_out( if __name__ == "__main__": - from danswer.llm.factory import get_default_llms, get_main_llm_from_tuple + from onyx.llm.factory import get_default_llms, get_main_llm_from_tuple # Just for testing purposes with Session(get_sqlalchemy_engine()) as db_session: diff --git a/backend/danswer/secondary_llm_flows/time_filter.py b/backend/onyx/secondary_llm_flows/time_filter.py similarity index 93% rename from backend/danswer/secondary_llm_flows/time_filter.py rename to backend/onyx/secondary_llm_flows/time_filter.py index aef32d7bdb2..72dfc308711 100644 --- a/backend/danswer/secondary_llm_flows/time_filter.py +++ b/backend/onyx/secondary_llm_flows/time_filter.py @@ -5,12 +5,12 @@ from dateutil.parser import parse -from danswer.llm.interfaces import LLM -from danswer.llm.utils import dict_based_prompt_to_langchain_prompt -from danswer.llm.utils import message_to_string -from danswer.prompts.filter_extration import TIME_FILTER_PROMPT -from danswer.prompts.prompt_utils import get_current_llm_day_time -from danswer.utils.logger import setup_logger +from onyx.llm.interfaces import LLM +from onyx.llm.utils import dict_based_prompt_to_langchain_prompt +from onyx.llm.utils import message_to_string +from onyx.prompts.filter_extration import TIME_FILTER_PROMPT +from onyx.prompts.prompt_utils import get_current_llm_day_time +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -156,7 +156,7 @@ def _extract_time_filter_from_llm_out( if __name__ == "__main__": # Just for testing purposes, too tedious to unit test as it relies on an LLM - from danswer.llm.factory import get_default_llms, get_main_llm_from_tuple + from onyx.llm.factory import get_default_llms, get_main_llm_from_tuple while True: user_input = input("Query to Extract Time: ") diff --git a/backend/ee/danswer/__init__.py b/backend/onyx/seeding/__init__.py similarity index 100% rename from backend/ee/danswer/__init__.py rename to backend/onyx/seeding/__init__.py diff --git a/backend/danswer/seeding/initial_docs.json b/backend/onyx/seeding/initial_docs.json similarity index 97% rename from backend/danswer/seeding/initial_docs.json rename to backend/onyx/seeding/initial_docs.json index 62c66d1bc83..f5e17df6c20 100644 --- a/backend/danswer/seeding/initial_docs.json +++ b/backend/onyx/seeding/initial_docs.json @@ -1,8 +1,8 @@ [ { - "url": "https://docs.danswer.dev/more/use_cases/overview", + "url": "https://docs.onyx.app/more/use_cases/overview", "title": "Use Cases Overview", - "content": "How to leverage Danswer in your organization\n\nDanswer Overview\nDanswer is the AI Assistant connected to your organization's docs, apps, and people. Danswer makes Generative AI more versatile for work by enabling new types of questions like \"What is the most common feature request we've heard from customers this month\". Whereas other AI systems have no context of your team and are generally unhelpful with work related questions, Danswer makes it possible to ask these questions in natural language and get back answers in seconds.\n\nDanswer can connect to +30 different tools and the use cases are not limited to the ones in the following pages. The highlighted use cases are for inspiration and come from feedback gathered from our users and customers.\n\n\nCommon Getting Started Questions:\n\nWhy are these docs connected in my Danswer deployment?\nAnswer: This is just an example of how connectors work in Danswer. You can connect up your own team's knowledge and you will be able to ask questions unique to your organization. Danswer will keep all of the knowledge up to date and in sync with your connected applications.\n\nIs my data being sent anywhere when I connect it up to Danswer?\nAnswer: No! Danswer is built with data security as our highest priority. We open sourced it so our users can know exactly what is going on with their data. By default all of the document processing happens within Danswer. The only time it is sent outward is for the GenAI call to generate answers.\n\nWhere is the feature for auto sync-ing document level access permissions from all connected sources?\nAnswer: This falls under the Enterprise Edition set of Danswer features built on top of the MIT/community edition. If you are on Danswer Cloud, you have access to them by default. If you're running it yourself, reach out to the Danswer team to receive access.", + "content": "How to leverage Onyx in your organization\n\nOnyx Overview\nOnyx is the AI Assistant connected to your organization's docs, apps, and people. Onyx makes Generative AI more versatile for work by enabling new types of questions like \"What is the most common feature request we've heard from customers this month\". Whereas other AI systems have no context of your team and are generally unhelpful with work related questions, Onyx makes it possible to ask these questions in natural language and get back answers in seconds.\n\nOnyx can connect to +30 different tools and the use cases are not limited to the ones in the following pages. The highlighted use cases are for inspiration and come from feedback gathered from our users and customers.\n\n\nCommon Getting Started Questions:\n\nWhy are these docs connected in my Onyx deployment?\nAnswer: This is just an example of how connectors work in Onyx. You can connect up your own team's knowledge and you will be able to ask questions unique to your organization. Onyx will keep all of the knowledge up to date and in sync with your connected applications.\n\nIs my data being sent anywhere when I connect it up to Onyx?\nAnswer: No! Onyx is built with data security as our highest priority. We open sourced it so our users can know exactly what is going on with their data. By default all of the document processing happens within Onyx. The only time it is sent outward is for the GenAI call to generate answers.\n\nWhere is the feature for auto sync-ing document level access permissions from all connected sources?\nAnswer: This falls under the Enterprise Edition set of Onyx features built on top of the MIT/community edition. If you are on Onyx Cloud, you have access to them by default. If you're running it yourself, reach out to the Onyx team to receive access.", "title_embedding": [ 0.013585364446043968, 0.06531507521867752, -0.0001728831703076139, -0.003940831869840622, 0.044078364968299866, -0.006206007208675146, @@ -522,9 +522,9 @@ "chunk_ind": 0 }, { - "url": "https://docs.danswer.dev/more/use_cases/enterprise_search", + "url": "https://docs.onyx.app/more/use_cases/enterprise_search", "title": "Enterprise Search", - "content": "Value of Enterprise Search with Danswer\n\nWhat is Enterprise Search and why is it Important?\nAn Enterprise Search system gives team members a single place to access all of the disparate knowledge of an organization. Critical information is saved across a host of channels like call transcripts with prospects, engineering design docs, IT runbooks, customer support email exchanges, project management tickets, and more. As fast moving teams scale up, information gets spread out and more disorganized.\n\nSince it quickly becomes infeasible to check across every source, decisions get made on incomplete information, employee satisfaction decreases, and the most valuable members of your team are tied up with constant distractions as junior teammates are unable to unblock themselves. Danswer solves this problem by letting anyone on the team access all of the knowledge across your organization in a permissioned and secure way. Users can ask questions in natural language and get back answers and documents across all of the connected sources instantly.\n\nWhat's the real cost?\nA typical knowledge worker spends over 2 hours a week on search, but more than that, the cost of incomplete or incorrect information can be extremely high. Customer support/success that isn't able to find the reference to similar cases could cause hours or even days of delay leading to lower customer satisfaction or in the worst case - churn. An account exec not realizing that a prospect had previously mentioned a specific need could lead to lost deals. An engineer not realizing a similar feature had previously been built could result in weeks of wasted development time and tech debt with duplicate implementation. With a lack of knowledge, your whole organization is navigating in the dark - inefficient and mistake prone.", + "content": "Value of Enterprise Search with Onyx\n\nWhat is Enterprise Search and why is it Important?\nAn Enterprise Search system gives team members a single place to access all of the disparate knowledge of an organization. Critical information is saved across a host of channels like call transcripts with prospects, engineering design docs, IT runbooks, customer support email exchanges, project management tickets, and more. As fast moving teams scale up, information gets spread out and more disorganized.\n\nSince it quickly becomes infeasible to check across every source, decisions get made on incomplete information, employee satisfaction decreases, and the most valuable members of your team are tied up with constant distractions as junior teammates are unable to unblock themselves. Onyx solves this problem by letting anyone on the team access all of the knowledge across your organization in a permissioned and secure way. Users can ask questions in natural language and get back answers and documents across all of the connected sources instantly.\n\nWhat's the real cost?\nA typical knowledge worker spends over 2 hours a week on search, but more than that, the cost of incomplete or incorrect information can be extremely high. Customer support/success that isn't able to find the reference to similar cases could cause hours or even days of delay leading to lower customer satisfaction or in the worst case - churn. An account exec not realizing that a prospect had previously mentioned a specific need could lead to lost deals. An engineer not realizing a similar feature had previously been built could result in weeks of wasted development time and tech debt with duplicate implementation. With a lack of knowledge, your whole organization is navigating in the dark - inefficient and mistake prone.", "title_embedding": [ -0.011060578748583794, 0.05994883179664612, 0.008845113217830658, 0.011364905163645744, 0.03147757425904274, 0.04506697878241539, @@ -1044,9 +1044,9 @@ "chunk_ind": 0 }, { - "url": "https://docs.danswer.dev/more/use_cases/enterprise_search", + "url": "https://docs.onyx.app/more/use_cases/enterprise_search", "title": "Enterprise Search", - "content": "More than Search\nWhen analyzing the entire corpus of knowledge within your company is as easy as asking a question in a search bar, your entire team can stay informed and up to date. Danswer also makes it trivial to identify where knowledge is well documented and where it is lacking. Team members who are centers of knowledge can begin to effectively document their expertise since it is no longer being thrown into a black hole. All of this allows the organization to achieve higher efficiency and drive business outcomes.\n\nWith Generative AI, the entire user experience has evolved as well. For example, instead of just finding similar cases for your customer support team to reference, Danswer breaks down the issue and explains it so that even the most junior members can understand it. This in turn lets them give the most holistic and technically accurate response possible to your customers. On the other end, even the super stars of your sales team will not be able to review 10 hours of transcripts before hopping on that critical call, but Danswer can easily parse through it in mere seconds and give crucial context to help your team close.", + "content": "More than Search\nWhen analyzing the entire corpus of knowledge within your company is as easy as asking a question in a search bar, your entire team can stay informed and up to date. Onyx also makes it trivial to identify where knowledge is well documented and where it is lacking. Team members who are centers of knowledge can begin to effectively document their expertise since it is no longer being thrown into a black hole. All of this allows the organization to achieve higher efficiency and drive business outcomes.\n\nWith Generative AI, the entire user experience has evolved as well. For example, instead of just finding similar cases for your customer support team to reference, Onyx breaks down the issue and explains it so that even the most junior members can understand it. This in turn lets them give the most holistic and technically accurate response possible to your customers. On the other end, even the super stars of your sales team will not be able to review 10 hours of transcripts before hopping on that critical call, but Onyx can easily parse through it in mere seconds and give crucial context to help your team close.", "title_embedding": [ -0.011060578748583794, 0.05994883179664612, 0.008845113217830658, 0.011364905163645744, 0.03147757425904274, 0.04506697878241539, @@ -1566,9 +1566,9 @@ "chunk_ind": 1 }, { - "url": "https://docs.danswer.dev/more/use_cases/ai_platform", + "url": "https://docs.onyx.app/more/use_cases/ai_platform", "title": "AI Platform", - "content": "Build AI Agents powered by the knowledge and workflows specific to your organization.\n\nBeyond Answers\nAgents enabled by generative AI and reasoning capable models are helping teams to automate their work. Danswer is helping teams make it happen. Danswer provides out of the box user chat sessions, attaching custom tools, handling LLM reasoning, code execution, data analysis, referencing internal knowledge, and much more.\n\nDanswer as a platform is not a no-code agent builder. We are made by developers for developers and this gives your team the full flexibility and power to create agents not constrained by blocks and simple logic paths.\n\nFlexibility and Extensibility\nDanswer is open source and completely whitebox. This not only gives transparency to what happens within the system but also means that your team can directly modify the source code to suit your unique needs.", + "content": "Build AI Agents powered by the knowledge and workflows specific to your organization.\n\nBeyond Answers\nAgents enabled by generative AI and reasoning capable models are helping teams to automate their work. Onyx is helping teams make it happen. Onyx provides out of the box user chat sessions, attaching custom tools, handling LLM reasoning, code execution, data analysis, referencing internal knowledge, and much more.\n\nOnyx as a platform is not a no-code agent builder. We are made by developers for developers and this gives your team the full flexibility and power to create agents not constrained by blocks and simple logic paths.\n\nFlexibility and Extensibility\nOnyx is open source and completely whitebox. This not only gives transparency to what happens within the system but also means that your team can directly modify the source code to suit your unique needs.", "title_embedding": [ 0.032763753086328506, 0.049961112439632416, 0.00777681777253747, -0.009621717967092991, 0.03860695660114288, 0.035656899213790894, @@ -2088,9 +2088,9 @@ "chunk_ind": 0 }, { - "url": "https://docs.danswer.dev/more/use_cases/customer_support", + "url": "https://docs.onyx.app/more/use_cases/customer_support", "title": "Customer Support", - "content": "Help your customer support team instantly answer any question across your entire product.\n\nAI Enabled Support\nCustomer support agents have one of the highest breadth jobs. They field requests that cover the entire surface area of the product and need to help your users find success on extremely short timelines. Because they're not the same people who designed or built the system, they often lack the depth of understanding needed - resulting in delays and escalations to other teams. Modern teams are leveraging AI to help their CS team optimize the speed and quality of these critical customer-facing interactions.\n\nThe Importance of Context\nThere are two critical components of AI copilots for customer support. The first is that the AI system needs to be connected with as much information as possible (not just support tools like Zendesk or Intercom) and that the knowledge needs to be as fresh as possible. Sometimes a fix might even be in places rarely checked by CS such as pull requests in a code repository. The second critical component is the ability of the AI system to break down difficult concepts and convoluted processes into more digestible descriptions and for your team members to be able to chat back and forth with the system to build a better understanding.\n\nDanswer takes care of both of these. The system connects up to over 30+ different applications and the knowledge is pulled in constantly so that the information access is always up to date.", + "content": "Help your customer support team instantly answer any question across your entire product.\n\nAI Enabled Support\nCustomer support agents have one of the highest breadth jobs. They field requests that cover the entire surface area of the product and need to help your users find success on extremely short timelines. Because they're not the same people who designed or built the system, they often lack the depth of understanding needed - resulting in delays and escalations to other teams. Modern teams are leveraging AI to help their CS team optimize the speed and quality of these critical customer-facing interactions.\n\nThe Importance of Context\nThere are two critical components of AI copilots for customer support. The first is that the AI system needs to be connected with as much information as possible (not just support tools like Zendesk or Intercom) and that the knowledge needs to be as fresh as possible. Sometimes a fix might even be in places rarely checked by CS such as pull requests in a code repository. The second critical component is the ability of the AI system to break down difficult concepts and convoluted processes into more digestible descriptions and for your team members to be able to chat back and forth with the system to build a better understanding.\n\nOnyx takes care of both of these. The system connects up to over 30+ different applications and the knowledge is pulled in constantly so that the information access is always up to date.", "title_embedding": [ 0.029702378436923027, 0.04087577760219574, 0.011759690940380096, -0.015867559239268303, 0.051922496408224106, 0.04818926751613617, @@ -2610,9 +2610,9 @@ "chunk_ind": 0 }, { - "url": "https://docs.danswer.dev/more/use_cases/sales", + "url": "https://docs.onyx.app/more/use_cases/sales", "title": "Sales", - "content": "Keep your team up to date on every conversation and update so they can close.\n\nRecall Every Detail\nBeing able to instantly revisit every detail of any call without reading transcripts is helping Sales teams provide more tailored pitches, build stronger relationships, and close more deals. Instead of searching and reading through hours of transcripts in preparation for a call, your team can now ask Danswer \"What specific features was ACME interested in seeing for the demo\". Since your team doesn't have time to read every transcript prior to a call, Danswer provides a more thorough summary because it can instantly parse hundreds of pages and distill out the relevant information. Even for fast lookups it becomes much more convenient - for example to brush up on connection building topics by asking \"What rapport building topic did we chat about in the last call with ACME\".\n\nKnow Every Product Update\nIt is impossible for Sales teams to keep up with every product update. Because of this, when a prospect has a question that the Sales team does not know, they have no choice but to rely on the Product and Engineering orgs to get an authoritative answer. Not only is this distracting to the other teams, it also slows down the time to respond to the prospect (and as we know, time is the biggest killer of deals). With Danswer, it is even possible to get answers live on call because of how fast accessing information becomes. A question like \"Have we shipped the Microsoft AD integration yet?\" can now be answered in seconds meaning that prospects can get answers while on the call instead of asynchronously and sales cycles are reduced as a result.", + "content": "Keep your team up to date on every conversation and update so they can close.\n\nRecall Every Detail\nBeing able to instantly revisit every detail of any call without reading transcripts is helping Sales teams provide more tailored pitches, build stronger relationships, and close more deals. Instead of searching and reading through hours of transcripts in preparation for a call, your team can now ask Onyx \"What specific features was ACME interested in seeing for the demo\". Since your team doesn't have time to read every transcript prior to a call, Onyx provides a more thorough summary because it can instantly parse hundreds of pages and distill out the relevant information. Even for fast lookups it becomes much more convenient - for example to brush up on connection building topics by asking \"What rapport building topic did we chat about in the last call with ACME\".\n\nKnow Every Product Update\nIt is impossible for Sales teams to keep up with every product update. Because of this, when a prospect has a question that the Sales team does not know, they have no choice but to rely on the Product and Engineering orgs to get an authoritative answer. Not only is this distracting to the other teams, it also slows down the time to respond to the prospect (and as we know, time is the biggest killer of deals). With Onyx, it is even possible to get answers live on call because of how fast accessing information becomes. A question like \"Have we shipped the Microsoft AD integration yet?\" can now be answered in seconds meaning that prospects can get answers while on the call instead of asynchronously and sales cycles are reduced as a result.", "title_embedding": [ 0.008453648537397385, 0.049128592014312744, 0.0009390072082169354, -0.011420674622058868, 0.009472657926380634, 0.05824451148509979, @@ -3132,9 +3132,9 @@ "chunk_ind": 0 }, { - "url": "https://docs.danswer.dev/more/use_cases/operations", + "url": "https://docs.onyx.app/more/use_cases/operations", "title": "Operations", - "content": "Double the productivity of your Ops teams like IT, HR, etc.\n\nAutomatically Resolve Tickets\nModern teams are leveraging AI to auto-resolve up to 50% of tickets. Whether it is an employee asking about benefits details or how to set up the VPN for remote work, Danswer can help your team help themselves. This frees up your team to do the real impactful work of landing star candidates or improving your internal processes.\n\nAI Aided Onboarding\nOne of the periods where your team needs the most help is when they're just ramping up. Instead of feeling lost in dozens of new tools, Danswer gives them a single place where they can ask about anything in natural language. Whether it's how to set up their work environment or what their onboarding goals are, Danswer can walk them through every step with the help of Generative AI. This lets your team feel more empowered and gives time back to the more seasoned members of your team to focus on moving the needle.", + "content": "Double the productivity of your Ops teams like IT, HR, etc.\n\nAutomatically Resolve Tickets\nModern teams are leveraging AI to auto-resolve up to 50% of tickets. Whether it is an employee asking about benefits details or how to set up the VPN for remote work, Onyx can help your team help themselves. This frees up your team to do the real impactful work of landing star candidates or improving your internal processes.\n\nAI Aided Onboarding\nOne of the periods where your team needs the most help is when they're just ramping up. Instead of feeling lost in dozens of new tools, Onyx gives them a single place where they can ask about anything in natural language. Whether it's how to set up their work environment or what their onboarding goals are, Onyx can walk them through every step with the help of Generative AI. This lets your team feel more empowered and gives time back to the more seasoned members of your team to focus on moving the needle.", "title_embedding": [ 0.010730741545557976, 0.018373621627688408, -0.0013679212424904108, 0.0001091610174626112, 0.034599218517541885, 0.038814906030893326, diff --git a/backend/onyx/seeding/initial_docs_cohere.json b/backend/onyx/seeding/initial_docs_cohere.json new file mode 100644 index 00000000000..86f8a2f3278 --- /dev/null +++ b/backend/onyx/seeding/initial_docs_cohere.json @@ -0,0 +1,44 @@ +[ + { + "url": "https://docs.onyx.app/more/use_cases/overview", + "title": "Use Cases Overview", + "content": "How to leverage Onyx in your organization\n\nOnyx Overview\nOnyx is the AI Assistant connected to your organization's docs, apps, and people. Onyx makes Generative AI more versatile for work by enabling new types of questions like \"What is the most common feature request we've heard from customers this month\". Whereas other AI systems have no context of your team and are generally unhelpful with work related questions, Onyx makes it possible to ask these questions in natural language and get back answers in seconds.\n\nOnyx can connect to +30 different tools and the use cases are not limited to the ones in the following pages. The highlighted use cases are for inspiration and come from feedback gathered from our users and customers.\n\n\nCommon Getting Started Questions:\n\nWhy are these docs connected in my Onyx deployment?\nAnswer: This is just an example of how connectors work in Onyx. You can connect up your own team's knowledge and you will be able to ask questions unique to your organization. Onyx will keep all of the knowledge up to date and in sync with your connected applications.\n\nIs my data being sent anywhere when I connect it up to Onyx?\nAnswer: No! Onyx is built with data security as our highest priority. We open sourced it so our users can know exactly what is going on with their data. By default all of the document processing happens within Onyx. The only time it is sent outward is for the GenAI call to generate answers.\n\nWhere is the feature for auto sync-ing document level access permissions from all connected sources?\nAnswer: This falls under the Enterprise Edition set of Onyx features built on top of the MIT/community edition. If you are on Onyx Cloud, you have access to them by default. If you're running it yourself, reach out to the Onyx team to receive access.", + "chunk_ind": 0 + }, + { + "url": "https://docs.onyx.app/more/use_cases/enterprise_search", + "title": "Enterprise Search", + "content": "Value of Enterprise Search with Onyx\n\nWhat is Enterprise Search and why is it Important?\nAn Enterprise Search system gives team members a single place to access all of the disparate knowledge of an organization. Critical information is saved across a host of channels like call transcripts with prospects, engineering design docs, IT runbooks, customer support email exchanges, project management tickets, and more. As fast moving teams scale up, information gets spread out and more disorganized.\n\nSince it quickly becomes infeasible to check across every source, decisions get made on incomplete information, employee satisfaction decreases, and the most valuable members of your team are tied up with constant distractions as junior teammates are unable to unblock themselves. Onyx solves this problem by letting anyone on the team access all of the knowledge across your organization in a permissioned and secure way. Users can ask questions in natural language and get back answers and documents across all of the connected sources instantly.\n\nWhat's the real cost?\nA typical knowledge worker spends over 2 hours a week on search, but more than that, the cost of incomplete or incorrect information can be extremely high. Customer support/success that isn't able to find the reference to similar cases could cause hours or even days of delay leading to lower customer satisfaction or in the worst case - churn. An account exec not realizing that a prospect had previously mentioned a specific need could lead to lost deals. An engineer not realizing a similar feature had previously been built could result in weeks of wasted development time and tech debt with duplicate implementation. With a lack of knowledge, your whole organization is navigating in the dark - inefficient and mistake prone.", + "chunk_ind": 0 + }, + { + "url": "https://docs.onyx.app/more/use_cases/enterprise_search", + "title": "Enterprise Search", + "content": "More than Search\nWhen analyzing the entire corpus of knowledge within your company is as easy as asking a question in a search bar, your entire team can stay informed and up to date. Onyx also makes it trivial to identify where knowledge is well documented and where it is lacking. Team members who are centers of knowledge can begin to effectively document their expertise since it is no longer being thrown into a black hole. All of this allows the organization to achieve higher efficiency and drive business outcomes.\n\nWith Generative AI, the entire user experience has evolved as well. For example, instead of just finding similar cases for your customer support team to reference, Onyx breaks down the issue and explains it so that even the most junior members can understand it. This in turn lets them give the most holistic and technically accurate response possible to your customers. On the other end, even the super stars of your sales team will not be able to review 10 hours of transcripts before hopping on that critical call, but Onyx can easily parse through it in mere seconds and give crucial context to help your team close.", + "chunk_ind": 0 + }, + { + "url": "https://docs.onyx.app/more/use_cases/ai_platform", + "title": "AI Platform", + "content": "Build AI Agents powered by the knowledge and workflows specific to your organization.\n\nBeyond Answers\nAgents enabled by generative AI and reasoning capable models are helping teams to automate their work. Onyx is helping teams make it happen. Onyx provides out of the box user chat sessions, attaching custom tools, handling LLM reasoning, code execution, data analysis, referencing internal knowledge, and much more.\n\nOnyx as a platform is not a no-code agent builder. We are made by developers for developers and this gives your team the full flexibility and power to create agents not constrained by blocks and simple logic paths.\n\nFlexibility and Extensibility\nOnyx is open source and completely whitebox. This not only gives transparency to what happens within the system but also means that your team can directly modify the source code to suit your unique needs.", + "chunk_ind": 0 + }, + { + "url": "https://docs.onyx.app/more/use_cases/customer_support", + "title": "Customer Support", + "content": "Help your customer support team instantly answer any question across your entire product.\n\nAI Enabled Support\nCustomer support agents have one of the highest breadth jobs. They field requests that cover the entire surface area of the product and need to help your users find success on extremely short timelines. Because they're not the same people who designed or built the system, they often lack the depth of understanding needed - resulting in delays and escalations to other teams. Modern teams are leveraging AI to help their CS team optimize the speed and quality of these critical customer-facing interactions.\n\nThe Importance of Context\nThere are two critical components of AI copilots for customer support. The first is that the AI system needs to be connected with as much information as possible (not just support tools like Zendesk or Intercom) and that the knowledge needs to be as fresh as possible. Sometimes a fix might even be in places rarely checked by CS such as pull requests in a code repository. The second critical component is the ability of the AI system to break down difficult concepts and convoluted processes into more digestible descriptions and for your team members to be able to chat back and forth with the system to build a better understanding.\n\nOnyx takes care of both of these. The system connects up to over 30+ different applications and the knowledge is pulled in constantly so that the information access is always up to date.", + "chunk_ind": 0 + }, + { + "url": "https://docs.onyx.app/more/use_cases/sales", + "title": "Sales", + "content": "Keep your team up to date on every conversation and update so they can close.\n\nRecall Every Detail\nBeing able to instantly revisit every detail of any call without reading transcripts is helping Sales teams provide more tailored pitches, build stronger relationships, and close more deals. Instead of searching and reading through hours of transcripts in preparation for a call, your team can now ask Onyx \"What specific features was ACME interested in seeing for the demo\". Since your team doesn't have time to read every transcript prior to a call, Onyx provides a more thorough summary because it can instantly parse hundreds of pages and distill out the relevant information. Even for fast lookups it becomes much more convenient - for example to brush up on connection building topics by asking \"What rapport building topic did we chat about in the last call with ACME\".\n\nKnow Every Product Update\nIt is impossible for Sales teams to keep up with every product update. Because of this, when a prospect has a question that the Sales team does not know, they have no choice but to rely on the Product and Engineering orgs to get an authoritative answer. Not only is this distracting to the other teams, it also slows down the time to respond to the prospect (and as we know, time is the biggest killer of deals). With Onyx, it is even possible to get answers live on call because of how fast accessing information becomes. A question like \"Have we shipped the Microsoft AD integration yet?\" can now be answered in seconds meaning that prospects can get answers while on the call instead of asynchronously and sales cycles are reduced as a result.", + "chunk_ind": 0 + }, + { + "url": "https://docs.onyx.app/more/use_cases/operations", + "title": "Operations", + "content": "Double the productivity of your Ops teams like IT, HR, etc.\n\nAutomatically Resolve Tickets\nModern teams are leveraging AI to auto-resolve up to 50% of tickets. Whether it is an employee asking about benefits details or how to set up the VPN for remote work, Onyx can help your team help themselves. This frees up your team to do the real impactful work of landing star candidates or improving your internal processes.\n\nAI Aided Onboarding\nOne of the periods where your team needs the most help is when they're just ramping up. Instead of feeling lost in dozens of new tools, Onyx gives them a single place where they can ask about anything in natural language. Whether it's how to set up their work environment or what their onboarding goals are, Onyx can walk them through every step with the help of Generative AI. This lets your team feel more empowered and gives time back to the more seasoned members of your team to focus on moving the needle.", + "chunk_ind": 0 + } +] diff --git a/backend/danswer/seeding/load_docs.py b/backend/onyx/seeding/load_docs.py similarity index 79% rename from backend/danswer/seeding/load_docs.py rename to backend/onyx/seeding/load_docs.py index e7061fa1311..36eccd6dc64 100644 --- a/backend/danswer/seeding/load_docs.py +++ b/backend/onyx/seeding/load_docs.py @@ -5,34 +5,34 @@ from sqlalchemy.orm import Session -from danswer.access.models import default_public_access -from danswer.configs.constants import DEFAULT_BOOST -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import KV_DOCUMENTS_SEEDED_KEY -from danswer.configs.model_configs import DEFAULT_DOCUMENT_ENCODER_MODEL -from danswer.connectors.models import Document -from danswer.connectors.models import IndexAttemptMetadata -from danswer.connectors.models import InputType -from danswer.connectors.models import Section -from danswer.db.connector import check_connectors_exist -from danswer.db.connector import create_connector -from danswer.db.connector_credential_pair import add_credential_to_connector -from danswer.db.credentials import PUBLIC_CREDENTIAL_ID -from danswer.db.document import check_docs_exist -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.index_attempt import mock_successful_index_attempt -from danswer.db.search_settings import get_current_search_settings -from danswer.document_index.factory import get_default_document_index -from danswer.indexing.indexing_pipeline import index_doc_batch_prepare -from danswer.indexing.models import ChunkEmbedding -from danswer.indexing.models import DocMetadataAwareIndexChunk -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.server.documents.models import ConnectorBase -from danswer.utils.logger import setup_logger -from danswer.utils.retry_wrapper import retry_builder -from danswer.utils.variable_functionality import fetch_versioned_implementation +from onyx.access.models import default_public_access +from onyx.configs.constants import DEFAULT_BOOST +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import KV_DOCUMENTS_SEEDED_KEY +from onyx.configs.model_configs import DEFAULT_DOCUMENT_ENCODER_MODEL +from onyx.connectors.models import Document +from onyx.connectors.models import IndexAttemptMetadata +from onyx.connectors.models import InputType +from onyx.connectors.models import Section +from onyx.db.connector import check_connectors_exist +from onyx.db.connector import create_connector +from onyx.db.connector_credential_pair import add_credential_to_connector +from onyx.db.credentials import PUBLIC_CREDENTIAL_ID +from onyx.db.document import check_docs_exist +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.index_attempt import mock_successful_index_attempt +from onyx.db.search_settings import get_current_search_settings +from onyx.document_index.factory import get_default_document_index +from onyx.indexing.indexing_pipeline import index_doc_batch_prepare +from onyx.indexing.models import ChunkEmbedding +from onyx.indexing.models import DocMetadataAwareIndexChunk +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.server.documents.models import ConnectorBase +from onyx.utils.logger import setup_logger +from onyx.utils.retry_wrapper import retry_builder +from onyx.utils.variable_functionality import fetch_versioned_implementation logger = setup_logger() @@ -95,7 +95,7 @@ def _create_indexable_chunks( def load_processed_docs(cohere_enabled: bool) -> list[dict]: initial_docs_path = os.path.join( os.getcwd(), - "danswer", + "onyx", "seeding", "initial_docs.json", ) @@ -163,7 +163,7 @@ def seed_initial_documents( source=DocumentSource.WEB, input_type=InputType.LOAD_STATE, connector_specific_config={ - "base_url": "https://docs.danswer.dev/more/use_cases", + "base_url": "https://docs.onyx.app/more/use_cases", "web_connector_type": "recursive", }, refresh_freq=None, # Never refresh by default @@ -189,7 +189,7 @@ def seed_initial_documents( ) cc_pair_id = cast(int, result.data) processed_docs = fetch_versioned_implementation( - "danswer.seeding.load_docs", + "onyx.seeding.load_docs", "load_processed_docs", )(cohere_enabled) diff --git a/backend/danswer/seeding/load_yamls.py b/backend/onyx/seeding/load_yamls.py similarity index 88% rename from backend/danswer/seeding/load_yamls.py rename to backend/onyx/seeding/load_yamls.py index 6efa1efd368..a9e6cd01d3b 100644 --- a/backend/danswer/seeding/load_yamls.py +++ b/backend/onyx/seeding/load_yamls.py @@ -1,18 +1,18 @@ import yaml from sqlalchemy.orm import Session -from danswer.configs.chat_configs import MAX_CHUNKS_FED_TO_CHAT -from danswer.configs.chat_configs import PERSONAS_YAML -from danswer.configs.chat_configs import PROMPTS_YAML -from danswer.context.search.enums import RecencyBiasSetting -from danswer.db.document_set import get_or_create_document_set_by_name -from danswer.db.models import DocumentSet as DocumentSetDBModel -from danswer.db.models import Persona -from danswer.db.models import Prompt as PromptDBModel -from danswer.db.models import Tool as ToolDBModel -from danswer.db.persona import get_prompt_by_name -from danswer.db.persona import upsert_persona -from danswer.db.persona import upsert_prompt +from onyx.configs.chat_configs import MAX_CHUNKS_FED_TO_CHAT +from onyx.configs.chat_configs import PERSONAS_YAML +from onyx.configs.chat_configs import PROMPTS_YAML +from onyx.context.search.enums import RecencyBiasSetting +from onyx.db.document_set import get_or_create_document_set_by_name +from onyx.db.models import DocumentSet as DocumentSetDBModel +from onyx.db.models import Persona +from onyx.db.models import Prompt as PromptDBModel +from onyx.db.models import Tool as ToolDBModel +from onyx.db.persona import get_prompt_by_name +from onyx.db.persona import upsert_persona +from onyx.db.persona import upsert_prompt def load_prompts_from_yaml( diff --git a/backend/danswer/seeding/personas.yaml b/backend/onyx/seeding/personas.yaml similarity index 98% rename from backend/danswer/seeding/personas.yaml rename to backend/onyx/seeding/personas.yaml index e628b32e6f7..ca28c8eb04e 100644 --- a/backend/danswer/seeding/personas.yaml +++ b/backend/onyx/seeding/personas.yaml @@ -2,7 +2,7 @@ personas: # This id field can be left blank for other default personas, however an id 0 persona must exist - # this is for DanswerBot to use when tagged in a non-configured channel + # this is for OnyxBot to use when tagged in a non-configured channel # Careful setting specific IDs, this won't autoincrement the next ID value for postgres - id: 0 name: "Search" diff --git a/backend/danswer/seeding/prompts.yaml b/backend/onyx/seeding/prompts.yaml similarity index 100% rename from backend/danswer/seeding/prompts.yaml rename to backend/onyx/seeding/prompts.yaml diff --git a/backend/ee/danswer/auth/__init__.py b/backend/onyx/server/__init__.py similarity index 100% rename from backend/ee/danswer/auth/__init__.py rename to backend/onyx/server/__init__.py diff --git a/backend/danswer/server/api_key/api.py b/backend/onyx/server/api_key/api.py similarity index 75% rename from backend/danswer/server/api_key/api.py rename to backend/onyx/server/api_key/api.py index cc21af616c7..1367d7ab8aa 100644 --- a/backend/danswer/server/api_key/api.py +++ b/backend/onyx/server/api_key/api.py @@ -2,16 +2,16 @@ from fastapi import Depends from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.db.api_key import ApiKeyDescriptor -from danswer.db.api_key import fetch_api_keys -from danswer.db.api_key import insert_api_key -from danswer.db.api_key import regenerate_api_key -from danswer.db.api_key import remove_api_key -from danswer.db.api_key import update_api_key -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.server.api_key.models import APIKeyArgs +from onyx.auth.users import current_admin_user +from onyx.db.api_key import ApiKeyDescriptor +from onyx.db.api_key import fetch_api_keys +from onyx.db.api_key import insert_api_key +from onyx.db.api_key import regenerate_api_key +from onyx.db.api_key import remove_api_key +from onyx.db.api_key import update_api_key +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.server.api_key.models import APIKeyArgs router = APIRouter(prefix="/admin/api-key") diff --git a/backend/danswer/server/api_key/models.py b/backend/onyx/server/api_key/models.py similarity index 75% rename from backend/danswer/server/api_key/models.py rename to backend/onyx/server/api_key/models.py index 596d02c43a8..c20ff8cc5f2 100644 --- a/backend/danswer/server/api_key/models.py +++ b/backend/onyx/server/api_key/models.py @@ -1,6 +1,6 @@ from pydantic import BaseModel -from danswer.auth.schemas import UserRole +from onyx.auth.schemas import UserRole class APIKeyArgs(BaseModel): diff --git a/backend/danswer/server/auth_check.py b/backend/onyx/server/auth_check.py similarity index 85% rename from backend/danswer/server/auth_check.py rename to backend/onyx/server/auth_check.py index bf55d80d90e..d55b275d127 100644 --- a/backend/danswer/server/auth_check.py +++ b/backend/onyx/server/auth_check.py @@ -4,14 +4,14 @@ from fastapi.dependencies.models import Dependant from starlette.routing import BaseRoute -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_curator_or_admin_user -from danswer.auth.users import current_limited_user -from danswer.auth.users import current_user -from danswer.auth.users import current_user_with_expired_token -from danswer.configs.app_configs import APP_API_PREFIX -from danswer.server.danswer_api.ingestion import api_key_dep -from danswer.utils.variable_functionality import fetch_ee_implementation_or_noop +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_curator_or_admin_user +from onyx.auth.users import current_limited_user +from onyx.auth.users import current_user +from onyx.auth.users import current_user_with_expired_token +from onyx.configs.app_configs import APP_API_PREFIX +from onyx.server.onyx_api.ingestion import api_key_dep +from onyx.utils.variable_functionality import fetch_ee_implementation_or_noop PUBLIC_ENDPOINT_SPECS = [ @@ -27,7 +27,7 @@ # just returns auth type, needs to be accessible before the user is logged # in to determine what flow to give the user ("/auth/type", {"GET"}), - # just gets the version of Danswer (e.g. 0.3.11) + # just gets the version of Onyx (e.g. 0.3.11) ("/version", {"GET"}), # stuff related to basic auth ("/auth/register", {"POST"}), @@ -83,10 +83,10 @@ def check_router_auth( """ control_plane_dep = fetch_ee_implementation_or_noop( - "danswer.server.tenants.access", "control_plane_dep" + "onyx.server.tenants.access", "control_plane_dep" ) current_cloud_superuser = fetch_ee_implementation_or_noop( - "danswer.auth.users", "current_cloud_superuser" + "onyx.auth.users", "current_cloud_superuser" ) for route in application.routes: diff --git a/backend/ee/danswer/configs/__init__.py b/backend/onyx/server/documents/__init__.py similarity index 100% rename from backend/ee/danswer/configs/__init__.py rename to backend/onyx/server/documents/__init__.py diff --git a/backend/danswer/server/documents/cc_pair.py b/backend/onyx/server/documents/cc_pair.py similarity index 87% rename from backend/danswer/server/documents/cc_pair.py rename to backend/onyx/server/documents/cc_pair.py index 88c812b19e2..49f65782726 100644 --- a/backend/danswer/server/documents/cc_pair.py +++ b/backend/onyx/server/documents/cc_pair.py @@ -10,48 +10,48 @@ from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import Session -from danswer.auth.users import current_curator_or_admin_user -from danswer.auth.users import current_user -from danswer.background.celery.celery_utils import get_deletion_attempt_snapshot -from danswer.background.celery.tasks.doc_permission_syncing.tasks import ( +from onyx.auth.users import current_curator_or_admin_user +from onyx.auth.users import current_user +from onyx.background.celery.celery_utils import get_deletion_attempt_snapshot +from onyx.background.celery.tasks.doc_permission_syncing.tasks import ( try_creating_permissions_sync_task, ) -from danswer.background.celery.tasks.pruning.tasks import ( +from onyx.background.celery.tasks.pruning.tasks import ( try_creating_prune_generator_task, ) -from danswer.background.celery.versioned_apps.primary import app as primary_app -from danswer.db.connector_credential_pair import add_credential_to_connector -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.connector_credential_pair import remove_credential_from_connector -from danswer.db.connector_credential_pair import ( +from onyx.background.celery.versioned_apps.primary import app as primary_app +from onyx.db.connector_credential_pair import add_credential_to_connector +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.connector_credential_pair import remove_credential_from_connector +from onyx.db.connector_credential_pair import ( update_connector_credential_pair_from_id, ) -from danswer.db.document import get_document_counts_for_cc_pairs -from danswer.db.document import get_documents_for_cc_pair -from danswer.db.engine import CURRENT_TENANT_ID_CONTEXTVAR -from danswer.db.engine import get_current_tenant_id -from danswer.db.engine import get_session -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.index_attempt import count_index_attempts_for_connector -from danswer.db.index_attempt import get_latest_index_attempt_for_cc_pair_id -from danswer.db.index_attempt import get_paginated_index_attempts_for_cc_pair_id -from danswer.db.models import SearchSettings -from danswer.db.models import User -from danswer.db.search_settings import get_active_search_settings -from danswer.db.search_settings import get_current_search_settings -from danswer.redis.redis_connector import RedisConnector -from danswer.redis.redis_pool import get_redis_client -from danswer.server.documents.models import CCPairFullInfo -from danswer.server.documents.models import CCPropertyUpdateRequest -from danswer.server.documents.models import CCStatusUpdateRequest -from danswer.server.documents.models import ConnectorCredentialPairIdentifier -from danswer.server.documents.models import ConnectorCredentialPairMetadata -from danswer.server.documents.models import DocumentSyncStatus -from danswer.server.documents.models import PaginatedIndexAttempts -from danswer.server.models import StatusResponse -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_ee_implementation_or_noop +from onyx.db.document import get_document_counts_for_cc_pairs +from onyx.db.document import get_documents_for_cc_pair +from onyx.db.engine import CURRENT_TENANT_ID_CONTEXTVAR +from onyx.db.engine import get_current_tenant_id +from onyx.db.engine import get_session +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.index_attempt import count_index_attempts_for_connector +from onyx.db.index_attempt import get_latest_index_attempt_for_cc_pair_id +from onyx.db.index_attempt import get_paginated_index_attempts_for_cc_pair_id +from onyx.db.models import SearchSettings +from onyx.db.models import User +from onyx.db.search_settings import get_active_search_settings +from onyx.db.search_settings import get_current_search_settings +from onyx.redis.redis_connector import RedisConnector +from onyx.redis.redis_pool import get_redis_client +from onyx.server.documents.models import CCPairFullInfo +from onyx.server.documents.models import CCPropertyUpdateRequest +from onyx.server.documents.models import CCStatusUpdateRequest +from onyx.server.documents.models import ConnectorCredentialPairIdentifier +from onyx.server.documents.models import ConnectorCredentialPairMetadata +from onyx.server.documents.models import DocumentSyncStatus +from onyx.server.documents.models import PaginatedIndexAttempts +from onyx.server.models import StatusResponse +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_ee_implementation_or_noop logger = setup_logger() router = APIRouter(prefix="/manage") @@ -510,7 +510,7 @@ def associate_credential_to_connector( db_session: Session = Depends(get_session), ) -> StatusResponse[int]: fetch_ee_implementation_or_noop( - "danswer.db.user_group", "validate_user_creation_permissions", None + "onyx.db.user_group", "validate_user_creation_permissions", None )( db_session=db_session, user=user, diff --git a/backend/danswer/server/documents/connector.py b/backend/onyx/server/documents/connector.py similarity index 83% rename from backend/danswer/server/documents/connector.py rename to backend/onyx/server/documents/connector.py index e6afb95e73e..67bca86fb81 100644 --- a/backend/danswer/server/documents/connector.py +++ b/backend/onyx/server/documents/connector.py @@ -13,107 +13,104 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_curator_or_admin_user -from danswer.auth.users import current_user -from danswer.background.celery.celery_utils import get_deletion_attempt_snapshot -from danswer.background.celery.versioned_apps.primary import app as primary_app -from danswer.configs.app_configs import ENABLED_CONNECTOR_TYPES -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryTask -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import FileOrigin -from danswer.connectors.google_utils.google_auth import ( +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_curator_or_admin_user +from onyx.auth.users import current_user +from onyx.background.celery.celery_utils import get_deletion_attempt_snapshot +from onyx.background.celery.versioned_apps.primary import app as primary_app +from onyx.configs.app_configs import ENABLED_CONNECTOR_TYPES +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import FileOrigin +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryTask +from onyx.connectors.google_utils.google_auth import ( get_google_oauth_creds, ) -from danswer.connectors.google_utils.google_kv import ( +from onyx.connectors.google_utils.google_kv import ( build_service_account_creds, ) -from danswer.connectors.google_utils.google_kv import ( +from onyx.connectors.google_utils.google_kv import ( delete_google_app_cred, ) -from danswer.connectors.google_utils.google_kv import ( +from onyx.connectors.google_utils.google_kv import ( delete_service_account_key, ) -from danswer.connectors.google_utils.google_kv import get_auth_url -from danswer.connectors.google_utils.google_kv import ( +from onyx.connectors.google_utils.google_kv import get_auth_url +from onyx.connectors.google_utils.google_kv import ( get_google_app_cred, ) -from danswer.connectors.google_utils.google_kv import ( +from onyx.connectors.google_utils.google_kv import ( get_service_account_key, ) -from danswer.connectors.google_utils.google_kv import ( +from onyx.connectors.google_utils.google_kv import ( update_credential_access_tokens, ) -from danswer.connectors.google_utils.google_kv import ( +from onyx.connectors.google_utils.google_kv import ( upsert_google_app_cred, ) -from danswer.connectors.google_utils.google_kv import ( +from onyx.connectors.google_utils.google_kv import ( upsert_service_account_key, ) -from danswer.connectors.google_utils.google_kv import verify_csrf -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.google_kv import verify_csrf +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_TOKEN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( - GoogleOAuthAuthenticationMethod, -) -from danswer.db.connector import create_connector -from danswer.db.connector import delete_connector -from danswer.db.connector import fetch_connector_by_id -from danswer.db.connector import fetch_connectors -from danswer.db.connector import get_connector_credential_ids -from danswer.db.connector import mark_ccpair_with_indexing_trigger -from danswer.db.connector import update_connector -from danswer.db.connector_credential_pair import add_credential_to_connector -from danswer.db.connector_credential_pair import get_cc_pair_groups_for_ids -from danswer.db.connector_credential_pair import get_connector_credential_pair -from danswer.db.connector_credential_pair import get_connector_credential_pairs -from danswer.db.credentials import cleanup_gmail_credentials -from danswer.db.credentials import cleanup_google_drive_credentials -from danswer.db.credentials import create_credential -from danswer.db.credentials import delete_service_account_credentials -from danswer.db.credentials import fetch_credential_by_id -from danswer.db.deletion_attempt import check_deletion_attempt_is_allowed -from danswer.db.document import get_document_counts_for_cc_pairs -from danswer.db.engine import get_current_tenant_id -from danswer.db.engine import get_session -from danswer.db.enums import AccessType -from danswer.db.enums import IndexingMode -from danswer.db.index_attempt import get_index_attempts_for_cc_pair -from danswer.db.index_attempt import get_latest_index_attempt_for_cc_pair_id -from danswer.db.index_attempt import get_latest_index_attempts -from danswer.db.index_attempt import get_latest_index_attempts_by_status -from danswer.db.models import IndexingStatus -from danswer.db.models import SearchSettings -from danswer.db.models import User -from danswer.db.search_settings import get_current_search_settings -from danswer.db.search_settings import get_secondary_search_settings -from danswer.file_processing.extract_file_text import convert_docx_to_txt -from danswer.file_store.file_store import get_default_file_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.redis.redis_connector import RedisConnector -from danswer.server.documents.models import AuthStatus -from danswer.server.documents.models import AuthUrl -from danswer.server.documents.models import ConnectorCredentialPairIdentifier -from danswer.server.documents.models import ConnectorIndexingStatus -from danswer.server.documents.models import ConnectorSnapshot -from danswer.server.documents.models import ConnectorUpdateRequest -from danswer.server.documents.models import CredentialBase -from danswer.server.documents.models import CredentialSnapshot -from danswer.server.documents.models import FailedConnectorIndexingStatus -from danswer.server.documents.models import FileUploadResponse -from danswer.server.documents.models import GDriveCallback -from danswer.server.documents.models import GmailCallback -from danswer.server.documents.models import GoogleAppCredentials -from danswer.server.documents.models import GoogleServiceAccountCredentialRequest -from danswer.server.documents.models import GoogleServiceAccountKey -from danswer.server.documents.models import IndexAttemptSnapshot -from danswer.server.documents.models import ObjectCreationIdResponse -from danswer.server.documents.models import RunConnectorRequest -from danswer.server.models import StatusResponse -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_ee_implementation_or_noop +from onyx.db.connector import create_connector +from onyx.db.connector import delete_connector +from onyx.db.connector import fetch_connector_by_id +from onyx.db.connector import fetch_connectors +from onyx.db.connector import get_connector_credential_ids +from onyx.db.connector import mark_ccpair_with_indexing_trigger +from onyx.db.connector import update_connector +from onyx.db.connector_credential_pair import add_credential_to_connector +from onyx.db.connector_credential_pair import get_cc_pair_groups_for_ids +from onyx.db.connector_credential_pair import get_connector_credential_pair +from onyx.db.connector_credential_pair import get_connector_credential_pairs +from onyx.db.credentials import cleanup_gmail_credentials +from onyx.db.credentials import cleanup_google_drive_credentials +from onyx.db.credentials import create_credential +from onyx.db.credentials import delete_service_account_credentials +from onyx.db.credentials import fetch_credential_by_id +from onyx.db.deletion_attempt import check_deletion_attempt_is_allowed +from onyx.db.document import get_document_counts_for_cc_pairs +from onyx.db.engine import get_current_tenant_id +from onyx.db.engine import get_session +from onyx.db.enums import AccessType +from onyx.db.enums import IndexingMode +from onyx.db.index_attempt import get_index_attempts_for_cc_pair +from onyx.db.index_attempt import get_latest_index_attempt_for_cc_pair_id +from onyx.db.index_attempt import get_latest_index_attempts +from onyx.db.index_attempt import get_latest_index_attempts_by_status +from onyx.db.models import IndexingStatus +from onyx.db.models import SearchSettings +from onyx.db.models import User +from onyx.db.search_settings import get_current_search_settings +from onyx.db.search_settings import get_secondary_search_settings +from onyx.file_processing.extract_file_text import convert_docx_to_txt +from onyx.file_store.file_store import get_default_file_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.redis.redis_connector import RedisConnector +from onyx.server.documents.models import AuthStatus +from onyx.server.documents.models import AuthUrl +from onyx.server.documents.models import ConnectorCredentialPairIdentifier +from onyx.server.documents.models import ConnectorIndexingStatus +from onyx.server.documents.models import ConnectorSnapshot +from onyx.server.documents.models import ConnectorUpdateRequest +from onyx.server.documents.models import CredentialBase +from onyx.server.documents.models import CredentialSnapshot +from onyx.server.documents.models import FailedConnectorIndexingStatus +from onyx.server.documents.models import FileUploadResponse +from onyx.server.documents.models import GDriveCallback +from onyx.server.documents.models import GmailCallback +from onyx.server.documents.models import GoogleAppCredentials +from onyx.server.documents.models import GoogleServiceAccountCredentialRequest +from onyx.server.documents.models import GoogleServiceAccountKey +from onyx.server.documents.models import IndexAttemptSnapshot +from onyx.server.documents.models import ObjectCreationIdResponse +from onyx.server.documents.models import RunConnectorRequest +from onyx.server.models import StatusResponse +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_ee_implementation_or_noop logger = setup_logger() @@ -314,7 +311,6 @@ def upsert_service_account_credential( credential_base = build_service_account_creds( DocumentSource.GOOGLE_DRIVE, primary_admin_email=service_account_credential_request.google_primary_admin, - name="Service Account (uploaded)", ) except KvKeyNotFoundError as e: raise HTTPException(status_code=400, detail=str(e)) @@ -323,9 +319,7 @@ def upsert_service_account_credential( delete_service_account_credentials(user, db_session, DocumentSource.GOOGLE_DRIVE) # `user=None` since this credential is not a personal credential credential = create_credential( - credential_data=credential_base, - user=user, - db_session=db_session, + credential_data=credential_base, user=user, db_session=db_session ) return ObjectCreationIdResponse(id=credential.id) @@ -500,38 +494,6 @@ def get_currently_failed_indexing_status( return indexing_statuses -@router.get("/admin/connector") -def get_connectors_by_credential( - _: User = Depends(current_curator_or_admin_user), - db_session: Session = Depends(get_session), - credential: int | None = None, -) -> list[ConnectorSnapshot]: - """Get a list of connectors. Allow filtering by a specific credential id.""" - - connectors = fetch_connectors(db_session) - - filtered_connectors = [] - for connector in connectors: - if connector.source == DocumentSource.INGESTION_API: - # don't include INGESTION_API, as it's a system level - # connector not manageable by the user - continue - - if credential is not None: - found = False - for cc_pair in connector.credentials: - if credential == cc_pair.credential_id: - found = True - break - - if not found: - continue - - filtered_connectors.append(ConnectorSnapshot.from_connector_db_model(connector)) - - return filtered_connectors - - @router.get("/admin/connector/indexing-status") def get_connector_indexing_status( secondary_index: bool = False, @@ -706,7 +668,7 @@ def create_connector_from_model( _validate_connector_allowed(connector_data.source) fetch_ee_implementation_or_noop( - "danswer.db.user_group", "validate_user_creation_permissions", None + "onyx.db.user_group", "validate_user_creation_permissions", None )( db_session=db_session, user=user, @@ -731,7 +693,7 @@ def create_connector_with_mock_credential( db_session: Session = Depends(get_session), ) -> StatusResponse: fetch_ee_implementation_or_noop( - "danswer.db.user_group", "validate_user_creation_permissions", None + "onyx.db.user_group", "validate_user_creation_permissions", None )( db_session=db_session, user=user, @@ -782,7 +744,7 @@ def update_connector_from_model( try: _validate_connector_allowed(connector_data.source) fetch_ee_implementation_or_noop( - "danswer.db.user_group", "validate_user_creation_permissions", None + "onyx.db.user_group", "validate_user_creation_permissions", None )( db_session=db_session, user=user, @@ -913,8 +875,8 @@ def connector_run_once( # run the beat task to pick up the triggers immediately primary_app.send_task( - DanswerCeleryTask.CHECK_FOR_INDEXING, - priority=DanswerCeleryPriority.HIGH, + OnyxCeleryTask.CHECK_FOR_INDEXING, + priority=OnyxCeleryPriority.HIGH, kwargs={"tenant_id": tenant_id}, ) @@ -974,12 +936,7 @@ def gmail_callback( credential_id = int(credential_id_cookie) verify_csrf(credential_id, callback.state) credentials: Credentials | None = update_credential_access_tokens( - callback.code, - credential_id, - user, - db_session, - DocumentSource.GMAIL, - GoogleOAuthAuthenticationMethod.UPLOADED, + callback.code, credential_id, user, db_session, DocumentSource.GMAIL ) if credentials is None: raise HTTPException( @@ -1005,12 +962,7 @@ def google_drive_callback( verify_csrf(credential_id, callback.state) credentials: Credentials | None = update_credential_access_tokens( - callback.code, - credential_id, - user, - db_session, - DocumentSource.GOOGLE_DRIVE, - GoogleOAuthAuthenticationMethod.UPLOADED, + callback.code, credential_id, user, db_session, DocumentSource.GOOGLE_DRIVE ) if credentials is None: raise HTTPException( diff --git a/backend/danswer/server/documents/credential.py b/backend/onyx/server/documents/credential.py similarity index 82% rename from backend/danswer/server/documents/credential.py rename to backend/onyx/server/documents/credential.py index 1cd118cd938..3a304976b2c 100644 --- a/backend/danswer/server/documents/credential.py +++ b/backend/onyx/server/documents/credential.py @@ -4,30 +4,31 @@ from fastapi import Query from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_curator_or_admin_user -from danswer.auth.users import current_user -from danswer.db.credentials import alter_credential -from danswer.db.credentials import cleanup_gmail_credentials -from danswer.db.credentials import create_credential -from danswer.db.credentials import CREDENTIAL_PERMISSIONS_TO_IGNORE -from danswer.db.credentials import delete_credential -from danswer.db.credentials import fetch_credential_by_id -from danswer.db.credentials import fetch_credentials -from danswer.db.credentials import fetch_credentials_by_source -from danswer.db.credentials import swap_credentials_connector -from danswer.db.credentials import update_credential -from danswer.db.engine import get_session -from danswer.db.models import DocumentSource -from danswer.db.models import User -from danswer.server.documents.models import CredentialBase -from danswer.server.documents.models import CredentialDataUpdateRequest -from danswer.server.documents.models import CredentialSnapshot -from danswer.server.documents.models import CredentialSwapRequest -from danswer.server.documents.models import ObjectCreationIdResponse -from danswer.server.models import StatusResponse -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_ee_implementation_or_noop +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_curator_or_admin_user +from onyx.auth.users import current_user +from onyx.db.credentials import alter_credential +from onyx.db.credentials import cleanup_gmail_credentials +from onyx.db.credentials import cleanup_google_drive_credentials +from onyx.db.credentials import create_credential +from onyx.db.credentials import CREDENTIAL_PERMISSIONS_TO_IGNORE +from onyx.db.credentials import delete_credential +from onyx.db.credentials import fetch_credential_by_id +from onyx.db.credentials import fetch_credentials +from onyx.db.credentials import fetch_credentials_by_source +from onyx.db.credentials import swap_credentials_connector +from onyx.db.credentials import update_credential +from onyx.db.engine import get_session +from onyx.db.models import DocumentSource +from onyx.db.models import User +from onyx.server.documents.models import CredentialBase +from onyx.server.documents.models import CredentialDataUpdateRequest +from onyx.server.documents.models import CredentialSnapshot +from onyx.server.documents.models import CredentialSwapRequest +from onyx.server.documents.models import ObjectCreationIdResponse +from onyx.server.models import StatusResponse +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_ee_implementation_or_noop logger = setup_logger() @@ -121,7 +122,7 @@ def create_credential_from_model( ) -> ObjectCreationIdResponse: if not _ignore_credential_permissions(credential_info.source): fetch_ee_implementation_or_noop( - "danswer.db.user_group", "validate_user_creation_permissions", None + "onyx.db.user_group", "validate_user_creation_permissions", None )( db_session=db_session, user=user, @@ -132,6 +133,8 @@ def create_credential_from_model( # Temporary fix for empty Google App credentials if credential_info.source == DocumentSource.GMAIL: cleanup_gmail_credentials(db_session=db_session) + if credential_info.source == DocumentSource.GOOGLE_DRIVE: + cleanup_google_drive_credentials(db_session=db_session) credential = create_credential(credential_info, user, db_session) return ObjectCreationIdResponse( diff --git a/backend/danswer/server/documents/document.py b/backend/onyx/server/documents/document.py similarity index 82% rename from backend/danswer/server/documents/document.py rename to backend/onyx/server/documents/document.py index 0b8d8e744bd..c682aedbed5 100644 --- a/backend/danswer/server/documents/document.py +++ b/backend/onyx/server/documents/document.py @@ -4,20 +4,20 @@ from fastapi import Query from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.context.search.models import IndexFilters -from danswer.context.search.preprocessing.access_filters import ( +from onyx.auth.users import current_user +from onyx.context.search.models import IndexFilters +from onyx.context.search.preprocessing.access_filters import ( build_access_filters_for_user, ) -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.search_settings import get_current_search_settings -from danswer.document_index.factory import get_default_document_index -from danswer.document_index.interfaces import VespaChunkRequest -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.prompts.prompt_utils import build_doc_context_str -from danswer.server.documents.models import ChunkInfo -from danswer.server.documents.models import DocumentInfo +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.search_settings import get_current_search_settings +from onyx.document_index.factory import get_default_document_index +from onyx.document_index.interfaces import VespaChunkRequest +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.prompts.prompt_utils import build_doc_context_str +from onyx.server.documents.models import ChunkInfo +from onyx.server.documents.models import DocumentInfo router = APIRouter(prefix="/document") diff --git a/backend/danswer/server/documents/indexing.py b/backend/onyx/server/documents/indexing.py similarity index 70% rename from backend/danswer/server/documents/indexing.py rename to backend/onyx/server/documents/indexing.py index 4d5081c3fe7..864d0898eb7 100644 --- a/backend/danswer/server/documents/indexing.py +++ b/backend/onyx/server/documents/indexing.py @@ -2,13 +2,13 @@ from fastapi import Depends from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.db.engine import get_session -from danswer.db.index_attempt import ( +from onyx.auth.users import current_admin_user +from onyx.db.engine import get_session +from onyx.db.index_attempt import ( get_index_attempt_errors, ) -from danswer.db.models import User -from danswer.server.documents.models import IndexAttemptError +from onyx.db.models import User +from onyx.server.documents.models import IndexAttemptError router = APIRouter(prefix="/manage") diff --git a/backend/danswer/server/documents/models.py b/backend/onyx/server/documents/models.py similarity index 94% rename from backend/danswer/server/documents/models.py rename to backend/onyx/server/documents/models.py index 2c4f509444f..1ae6a217b57 100644 --- a/backend/danswer/server/documents/models.py +++ b/backend/onyx/server/documents/models.py @@ -5,21 +5,21 @@ from pydantic import BaseModel from pydantic import Field -from danswer.configs.app_configs import MASK_CREDENTIAL_PREFIX -from danswer.configs.constants import DocumentSource -from danswer.connectors.models import DocumentErrorSummary -from danswer.connectors.models import InputType -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.models import Connector -from danswer.db.models import ConnectorCredentialPair -from danswer.db.models import Credential -from danswer.db.models import Document as DbDocument -from danswer.db.models import IndexAttempt -from danswer.db.models import IndexAttemptError as DbIndexAttemptError -from danswer.db.models import IndexingStatus -from danswer.db.models import TaskStatus -from danswer.server.utils import mask_credential_dict +from onyx.configs.app_configs import MASK_CREDENTIAL_PREFIX +from onyx.configs.constants import DocumentSource +from onyx.connectors.models import DocumentErrorSummary +from onyx.connectors.models import InputType +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.models import Connector +from onyx.db.models import ConnectorCredentialPair +from onyx.db.models import Credential +from onyx.db.models import Document as DbDocument +from onyx.db.models import IndexAttempt +from onyx.db.models import IndexAttemptError as DbIndexAttemptError +from onyx.db.models import IndexingStatus +from onyx.db.models import TaskStatus +from onyx.server.utils import mask_credential_dict class DocumentSyncStatus(BaseModel): diff --git a/backend/danswer/server/documents/standard_oauth.py b/backend/onyx/server/documents/standard_oauth.py similarity index 85% rename from backend/danswer/server/documents/standard_oauth.py rename to backend/onyx/server/documents/standard_oauth.py index 27b7964d6d3..961d0f2cb4d 100644 --- a/backend/danswer/server/documents/standard_oauth.py +++ b/backend/onyx/server/documents/standard_oauth.py @@ -9,18 +9,18 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.configs.constants import DocumentSource -from danswer.connectors.interfaces import OAuthConnector -from danswer.db.credentials import create_credential -from danswer.db.engine import get_current_tenant_id -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.redis.redis_pool import get_redis_client -from danswer.server.documents.models import CredentialBase -from danswer.utils.logger import setup_logger -from danswer.utils.subclasses import find_all_subclasses_in_dir +from onyx.auth.users import current_user +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.configs.constants import DocumentSource +from onyx.connectors.interfaces import OAuthConnector +from onyx.db.credentials import create_credential +from onyx.db.engine import get_current_tenant_id +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.redis.redis_pool import get_redis_client +from onyx.server.documents.models import CredentialBase +from onyx.utils.logger import setup_logger +from onyx.utils.subclasses import find_all_subclasses_in_dir logger = setup_logger() @@ -40,7 +40,7 @@ def _discover_oauth_connectors() -> dict[DocumentSource, type[OAuthConnector]]: return _OAUTH_CONNECTORS oauth_connectors = find_all_subclasses_in_dir( - cast(type[OAuthConnector], OAuthConnector), "danswer.connectors" + cast(type[OAuthConnector], OAuthConnector), "onyx.connectors" ) _OAUTH_CONNECTORS = {cls.oauth_id(): cls for cls in oauth_connectors} diff --git a/backend/ee/danswer/danswerbot/slack/handlers/__init__.py b/backend/onyx/server/features/__init__.py similarity index 100% rename from backend/ee/danswer/danswerbot/slack/handlers/__init__.py rename to backend/onyx/server/features/__init__.py diff --git a/backend/ee/danswer/db/__init__.py b/backend/onyx/server/features/document_set/__init__.py similarity index 100% rename from backend/ee/danswer/db/__init__.py rename to backend/onyx/server/features/document_set/__init__.py diff --git a/backend/danswer/server/features/document_set/api.py b/backend/onyx/server/features/document_set/api.py similarity index 73% rename from backend/danswer/server/features/document_set/api.py rename to backend/onyx/server/features/document_set/api.py index 26287d3f6e4..277db6b4891 100644 --- a/backend/danswer/server/features/document_set/api.py +++ b/backend/onyx/server/features/document_set/api.py @@ -4,21 +4,21 @@ from fastapi import Query from sqlalchemy.orm import Session -from danswer.auth.users import current_curator_or_admin_user -from danswer.auth.users import current_user -from danswer.db.document_set import check_document_sets_are_public -from danswer.db.document_set import fetch_all_document_sets_for_user -from danswer.db.document_set import insert_document_set -from danswer.db.document_set import mark_document_set_as_to_be_deleted -from danswer.db.document_set import update_document_set -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.server.features.document_set.models import CheckDocSetPublicRequest -from danswer.server.features.document_set.models import CheckDocSetPublicResponse -from danswer.server.features.document_set.models import DocumentSet -from danswer.server.features.document_set.models import DocumentSetCreationRequest -from danswer.server.features.document_set.models import DocumentSetUpdateRequest -from danswer.utils.variable_functionality import fetch_ee_implementation_or_noop +from onyx.auth.users import current_curator_or_admin_user +from onyx.auth.users import current_user +from onyx.db.document_set import check_document_sets_are_public +from onyx.db.document_set import fetch_all_document_sets_for_user +from onyx.db.document_set import insert_document_set +from onyx.db.document_set import mark_document_set_as_to_be_deleted +from onyx.db.document_set import update_document_set +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.server.features.document_set.models import CheckDocSetPublicRequest +from onyx.server.features.document_set.models import CheckDocSetPublicResponse +from onyx.server.features.document_set.models import DocumentSet +from onyx.server.features.document_set.models import DocumentSetCreationRequest +from onyx.server.features.document_set.models import DocumentSetUpdateRequest +from onyx.utils.variable_functionality import fetch_ee_implementation_or_noop router = APIRouter(prefix="/manage") @@ -31,7 +31,7 @@ def create_document_set( db_session: Session = Depends(get_session), ) -> int: fetch_ee_implementation_or_noop( - "danswer.db.user_group", "validate_user_creation_permissions", None + "onyx.db.user_group", "validate_user_creation_permissions", None )( db_session=db_session, user=user, @@ -56,7 +56,7 @@ def patch_document_set( db_session: Session = Depends(get_session), ) -> None: fetch_ee_implementation_or_noop( - "danswer.db.user_group", "validate_user_creation_permissions", None + "onyx.db.user_group", "validate_user_creation_permissions", None )( db_session=db_session, user=user, diff --git a/backend/danswer/server/features/document_set/models.py b/backend/onyx/server/features/document_set/models.py similarity index 89% rename from backend/danswer/server/features/document_set/models.py rename to backend/onyx/server/features/document_set/models.py index 696bf5c9177..82b54f33c17 100644 --- a/backend/danswer/server/features/document_set/models.py +++ b/backend/onyx/server/features/document_set/models.py @@ -3,10 +3,10 @@ from pydantic import BaseModel from pydantic import Field -from danswer.db.models import DocumentSet as DocumentSetDBModel -from danswer.server.documents.models import ConnectorCredentialPairDescriptor -from danswer.server.documents.models import ConnectorSnapshot -from danswer.server.documents.models import CredentialSnapshot +from onyx.db.models import DocumentSet as DocumentSetDBModel +from onyx.server.documents.models import ConnectorCredentialPairDescriptor +from onyx.server.documents.models import ConnectorSnapshot +from onyx.server.documents.models import CredentialSnapshot class DocumentSetCreationRequest(BaseModel): diff --git a/backend/ee/danswer/external_permissions/__init__.py b/backend/onyx/server/features/folder/__init__.py similarity index 100% rename from backend/ee/danswer/external_permissions/__init__.py rename to backend/onyx/server/features/folder/__init__.py diff --git a/backend/danswer/server/features/folder/api.py b/backend/onyx/server/features/folder/api.py similarity index 82% rename from backend/danswer/server/features/folder/api.py rename to backend/onyx/server/features/folder/api.py index 000207370d6..503c66258f9 100644 --- a/backend/danswer/server/features/folder/api.py +++ b/backend/onyx/server/features/folder/api.py @@ -4,25 +4,25 @@ from fastapi import Path from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.db.chat import get_chat_session_by_id -from danswer.db.engine import get_session -from danswer.db.folder import add_chat_to_folder -from danswer.db.folder import create_folder -from danswer.db.folder import delete_folder -from danswer.db.folder import get_user_folders -from danswer.db.folder import remove_chat_from_folder -from danswer.db.folder import rename_folder -from danswer.db.folder import update_folder_display_priority -from danswer.db.models import User -from danswer.server.features.folder.models import DeleteFolderOptions -from danswer.server.features.folder.models import FolderChatSessionRequest -from danswer.server.features.folder.models import FolderCreationRequest -from danswer.server.features.folder.models import FolderResponse -from danswer.server.features.folder.models import FolderUpdateRequest -from danswer.server.features.folder.models import GetUserFoldersResponse -from danswer.server.models import DisplayPriorityRequest -from danswer.server.query_and_chat.models import ChatSessionDetails +from onyx.auth.users import current_user +from onyx.db.chat import get_chat_session_by_id +from onyx.db.engine import get_session +from onyx.db.folder import add_chat_to_folder +from onyx.db.folder import create_folder +from onyx.db.folder import delete_folder +from onyx.db.folder import get_user_folders +from onyx.db.folder import remove_chat_from_folder +from onyx.db.folder import rename_folder +from onyx.db.folder import update_folder_display_priority +from onyx.db.models import User +from onyx.server.features.folder.models import DeleteFolderOptions +from onyx.server.features.folder.models import FolderChatSessionRequest +from onyx.server.features.folder.models import FolderCreationRequest +from onyx.server.features.folder.models import FolderResponse +from onyx.server.features.folder.models import FolderUpdateRequest +from onyx.server.features.folder.models import GetUserFoldersResponse +from onyx.server.models import DisplayPriorityRequest +from onyx.server.query_and_chat.models import ChatSessionDetails router = APIRouter(prefix="/folder") diff --git a/backend/danswer/server/features/folder/models.py b/backend/onyx/server/features/folder/models.py similarity index 89% rename from backend/danswer/server/features/folder/models.py rename to backend/onyx/server/features/folder/models.py index 3f7e1304cbc..acb3fa415a6 100644 --- a/backend/danswer/server/features/folder/models.py +++ b/backend/onyx/server/features/folder/models.py @@ -2,7 +2,7 @@ from pydantic import BaseModel -from danswer.server.query_and_chat.models import ChatSessionDetails +from onyx.server.query_and_chat.models import ChatSessionDetails class FolderResponse(BaseModel): diff --git a/backend/danswer/server/features/notifications/api.py b/backend/onyx/server/features/notifications/api.py similarity index 73% rename from backend/danswer/server/features/notifications/api.py rename to backend/onyx/server/features/notifications/api.py index a4f5415a6a1..a4d2e16e70e 100644 --- a/backend/danswer/server/features/notifications/api.py +++ b/backend/onyx/server/features/notifications/api.py @@ -3,14 +3,14 @@ from fastapi import HTTPException from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.notification import dismiss_notification -from danswer.db.notification import get_notification_by_id -from danswer.db.notification import get_notifications -from danswer.server.settings.models import Notification as NotificationModel -from danswer.utils.logger import setup_logger +from onyx.auth.users import current_user +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.notification import dismiss_notification +from onyx.db.notification import get_notification_by_id +from onyx.db.notification import get_notifications +from onyx.server.settings.models import Notification as NotificationModel +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/external_permissions/confluence/__init__.py b/backend/onyx/server/features/persona/__init__.py similarity index 100% rename from backend/ee/danswer/external_permissions/confluence/__init__.py rename to backend/onyx/server/features/persona/__init__.py diff --git a/backend/danswer/server/features/persona/api.py b/backend/onyx/server/features/persona/api.py similarity index 82% rename from backend/danswer/server/features/persona/api.py rename to backend/onyx/server/features/persona/api.py index f6cb3a2d296..497bbf0aacf 100644 --- a/backend/danswer/server/features/persona/api.py +++ b/backend/onyx/server/features/persona/api.py @@ -9,41 +9,41 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_curator_or_admin_user -from danswer.auth.users import current_limited_user -from danswer.auth.users import current_user -from danswer.chat.prompt_builder.utils import build_dummy_prompt -from danswer.configs.constants import FileOrigin -from danswer.configs.constants import NotificationType -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.notification import create_notification -from danswer.db.persona import create_assistant_category -from danswer.db.persona import create_update_persona -from danswer.db.persona import delete_persona_category -from danswer.db.persona import get_assistant_categories -from danswer.db.persona import get_persona_by_id -from danswer.db.persona import get_personas -from danswer.db.persona import mark_persona_as_deleted -from danswer.db.persona import mark_persona_as_not_deleted -from danswer.db.persona import update_all_personas_display_priority -from danswer.db.persona import update_persona_category -from danswer.db.persona import update_persona_public_status -from danswer.db.persona import update_persona_shared_users -from danswer.db.persona import update_persona_visibility -from danswer.file_store.file_store import get_default_file_store -from danswer.file_store.models import ChatFileType -from danswer.server.features.persona.models import CreatePersonaRequest -from danswer.server.features.persona.models import ImageGenerationToolStatus -from danswer.server.features.persona.models import PersonaCategoryCreate -from danswer.server.features.persona.models import PersonaCategoryResponse -from danswer.server.features.persona.models import PersonaSharedNotificationData -from danswer.server.features.persona.models import PersonaSnapshot -from danswer.server.features.persona.models import PromptTemplateResponse -from danswer.server.models import DisplayPriorityRequest -from danswer.tools.utils import is_image_generation_available -from danswer.utils.logger import setup_logger +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_curator_or_admin_user +from onyx.auth.users import current_limited_user +from onyx.auth.users import current_user +from onyx.chat.prompt_builder.utils import build_dummy_prompt +from onyx.configs.constants import FileOrigin +from onyx.configs.constants import NotificationType +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.notification import create_notification +from onyx.db.persona import create_assistant_category +from onyx.db.persona import create_update_persona +from onyx.db.persona import delete_persona_category +from onyx.db.persona import get_assistant_categories +from onyx.db.persona import get_persona_by_id +from onyx.db.persona import get_personas +from onyx.db.persona import mark_persona_as_deleted +from onyx.db.persona import mark_persona_as_not_deleted +from onyx.db.persona import update_all_personas_display_priority +from onyx.db.persona import update_persona_category +from onyx.db.persona import update_persona_public_status +from onyx.db.persona import update_persona_shared_users +from onyx.db.persona import update_persona_visibility +from onyx.file_store.file_store import get_default_file_store +from onyx.file_store.models import ChatFileType +from onyx.server.features.persona.models import CreatePersonaRequest +from onyx.server.features.persona.models import ImageGenerationToolStatus +from onyx.server.features.persona.models import PersonaCategoryCreate +from onyx.server.features.persona.models import PersonaCategoryResponse +from onyx.server.features.persona.models import PersonaSharedNotificationData +from onyx.server.features.persona.models import PersonaSnapshot +from onyx.server.features.persona.models import PromptTemplateResponse +from onyx.server.models import DisplayPriorityRequest +from onyx.tools.utils import is_image_generation_available +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/server/features/persona/models.py b/backend/onyx/server/features/persona/models.py similarity index 90% rename from backend/danswer/server/features/persona/models.py rename to backend/onyx/server/features/persona/models.py index f32a62090d2..e8417534324 100644 --- a/backend/danswer/server/features/persona/models.py +++ b/backend/onyx/server/features/persona/models.py @@ -4,15 +4,15 @@ from pydantic import BaseModel from pydantic import Field -from danswer.context.search.enums import RecencyBiasSetting -from danswer.db.models import Persona -from danswer.db.models import PersonaCategory -from danswer.db.models import StarterMessage -from danswer.server.features.document_set.models import DocumentSet -from danswer.server.features.prompt.models import PromptSnapshot -from danswer.server.features.tool.models import ToolSnapshot -from danswer.server.models import MinimalUserSnapshot -from danswer.utils.logger import setup_logger +from onyx.context.search.enums import RecencyBiasSetting +from onyx.db.models import Persona +from onyx.db.models import PersonaCategory +from onyx.db.models import StarterMessage +from onyx.server.features.document_set.models import DocumentSet +from onyx.server.features.prompt.models import PromptSnapshot +from onyx.server.features.tool.models import ToolSnapshot +from onyx.server.models import MinimalUserSnapshot +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/ee/danswer/external_permissions/google_drive/__init__.py b/backend/onyx/server/features/prompt/__init__.py similarity index 100% rename from backend/ee/danswer/external_permissions/google_drive/__init__.py rename to backend/onyx/server/features/prompt/__init__.py diff --git a/backend/danswer/server/features/prompt/api.py b/backend/onyx/server/features/prompt/api.py similarity index 88% rename from backend/danswer/server/features/prompt/api.py rename to backend/onyx/server/features/prompt/api.py index aebcbb8434d..5432fa96100 100644 --- a/backend/danswer/server/features/prompt/api.py +++ b/backend/onyx/server/features/prompt/api.py @@ -4,17 +4,17 @@ from sqlalchemy.orm import Session from starlette import status -from danswer.auth.users import current_user -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.persona import get_personas_by_ids -from danswer.db.persona import get_prompt_by_id -from danswer.db.persona import get_prompts -from danswer.db.persona import mark_prompt_as_deleted -from danswer.db.persona import upsert_prompt -from danswer.server.features.prompt.models import CreatePromptRequest -from danswer.server.features.prompt.models import PromptSnapshot -from danswer.utils.logger import setup_logger +from onyx.auth.users import current_user +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.persona import get_personas_by_ids +from onyx.db.persona import get_prompt_by_id +from onyx.db.persona import get_prompts +from onyx.db.persona import mark_prompt_as_deleted +from onyx.db.persona import upsert_prompt +from onyx.server.features.prompt.models import CreatePromptRequest +from onyx.server.features.prompt.models import PromptSnapshot +from onyx.utils.logger import setup_logger # Note: As prompts are fairly innocuous/harmless, there are no protections diff --git a/backend/danswer/server/features/prompt/models.py b/backend/onyx/server/features/prompt/models.py similarity index 96% rename from backend/danswer/server/features/prompt/models.py rename to backend/onyx/server/features/prompt/models.py index 1cc9452f435..c15127d5ed8 100644 --- a/backend/danswer/server/features/prompt/models.py +++ b/backend/onyx/server/features/prompt/models.py @@ -1,6 +1,6 @@ from pydantic import BaseModel -from danswer.db.models import Prompt +from onyx.db.models import Prompt class CreatePromptRequest(BaseModel): diff --git a/backend/danswer/server/features/tool/api.py b/backend/onyx/server/features/tool/api.py similarity index 79% rename from backend/danswer/server/features/tool/api.py rename to backend/onyx/server/features/tool/api.py index 48f857780ba..5aa085d6da3 100644 --- a/backend/danswer/server/features/tool/api.py +++ b/backend/onyx/server/features/tool/api.py @@ -6,29 +6,29 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_user -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.tools import create_tool -from danswer.db.tools import delete_tool -from danswer.db.tools import get_tool_by_id -from danswer.db.tools import get_tools -from danswer.db.tools import update_tool -from danswer.server.features.tool.models import CustomToolCreate -from danswer.server.features.tool.models import CustomToolUpdate -from danswer.server.features.tool.models import ToolSnapshot -from danswer.tools.tool_implementations.custom.openapi_parsing import MethodSpec -from danswer.tools.tool_implementations.custom.openapi_parsing import ( +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_user +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.tools import create_tool +from onyx.db.tools import delete_tool +from onyx.db.tools import get_tool_by_id +from onyx.db.tools import get_tools +from onyx.db.tools import update_tool +from onyx.server.features.tool.models import CustomToolCreate +from onyx.server.features.tool.models import CustomToolUpdate +from onyx.server.features.tool.models import ToolSnapshot +from onyx.tools.tool_implementations.custom.openapi_parsing import MethodSpec +from onyx.tools.tool_implementations.custom.openapi_parsing import ( openapi_to_method_specs, ) -from danswer.tools.tool_implementations.custom.openapi_parsing import ( +from onyx.tools.tool_implementations.custom.openapi_parsing import ( validate_openapi_schema, ) -from danswer.tools.tool_implementations.images.image_generation_tool import ( +from onyx.tools.tool_implementations.images.image_generation_tool import ( ImageGenerationTool, ) -from danswer.tools.utils import is_image_generation_available +from onyx.tools.utils import is_image_generation_available router = APIRouter(prefix="/tool") admin_router = APIRouter(prefix="/admin/tool") diff --git a/backend/danswer/server/features/tool/models.py b/backend/onyx/server/features/tool/models.py similarity index 96% rename from backend/danswer/server/features/tool/models.py rename to backend/onyx/server/features/tool/models.py index bf3e4d159b6..6316329ee82 100644 --- a/backend/danswer/server/features/tool/models.py +++ b/backend/onyx/server/features/tool/models.py @@ -2,7 +2,7 @@ from pydantic import BaseModel -from danswer.db.models import Tool +from onyx.db.models import Tool class ToolSnapshot(BaseModel): diff --git a/backend/danswer/server/gpts/api.py b/backend/onyx/server/gpts/api.py similarity index 87% rename from backend/danswer/server/gpts/api.py rename to backend/onyx/server/gpts/api.py index 1d0684cf61a..58796d6199b 100644 --- a/backend/danswer/server/gpts/api.py +++ b/backend/onyx/server/gpts/api.py @@ -6,13 +6,13 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.context.search.models import SearchRequest -from danswer.context.search.pipeline import SearchPipeline -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.llm.factory import get_default_llms -from danswer.server.danswer_api.ingestion import api_key_dep -from danswer.utils.logger import setup_logger +from onyx.context.search.models import SearchRequest +from onyx.context.search.pipeline import SearchPipeline +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.llm.factory import get_default_llms +from onyx.server.onyx_api.ingestion import api_key_dep +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/server/long_term_logs/long_term_logs_api.py b/backend/onyx/server/long_term_logs/long_term_logs_api.py similarity index 95% rename from backend/danswer/server/long_term_logs/long_term_logs_api.py rename to backend/onyx/server/long_term_logs/long_term_logs_api.py index ac7c42e5a0e..1c87290006a 100644 --- a/backend/danswer/server/long_term_logs/long_term_logs_api.py +++ b/backend/onyx/server/long_term_logs/long_term_logs_api.py @@ -11,9 +11,9 @@ from fastapi.responses import FileResponse from starlette.background import BackgroundTask -from danswer.auth.users import current_admin_user -from danswer.db.models import User -from danswer.utils.long_term_log import LongTermLogger +from onyx.auth.users import current_admin_user +from onyx.db.models import User +from onyx.utils.long_term_log import LongTermLogger router = APIRouter(prefix="/admin/long-term-logs") diff --git a/backend/ee/danswer/server/__init__.py b/backend/onyx/server/manage/__init__.py similarity index 100% rename from backend/ee/danswer/server/__init__.py rename to backend/onyx/server/manage/__init__.py diff --git a/backend/danswer/server/manage/administrative.py b/backend/onyx/server/manage/administrative.py similarity index 74% rename from backend/danswer/server/manage/administrative.py rename to backend/onyx/server/manage/administrative.py index cbf744500d4..82577f714ca 100644 --- a/backend/danswer/server/manage/administrative.py +++ b/backend/onyx/server/manage/administrative.py @@ -8,39 +8,39 @@ from fastapi import HTTPException from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_curator_or_admin_user -from danswer.background.celery.versioned_apps.primary import app as primary_app -from danswer.configs.app_configs import GENERATIVE_MODEL_ACCESS_CHECK_FREQ -from danswer.configs.constants import DanswerCeleryPriority -from danswer.configs.constants import DanswerCeleryTask -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import KV_GEN_AI_KEY_CHECK_TIME -from danswer.db.connector_credential_pair import get_connector_credential_pair -from danswer.db.connector_credential_pair import ( +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_curator_or_admin_user +from onyx.background.celery.versioned_apps.primary import app as primary_app +from onyx.configs.app_configs import GENERATIVE_MODEL_ACCESS_CHECK_FREQ +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import KV_GEN_AI_KEY_CHECK_TIME +from onyx.configs.constants import OnyxCeleryPriority +from onyx.configs.constants import OnyxCeleryTask +from onyx.db.connector_credential_pair import get_connector_credential_pair +from onyx.db.connector_credential_pair import ( update_connector_credential_pair_from_id, ) -from danswer.db.engine import get_current_tenant_id -from danswer.db.engine import get_session -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.db.feedback import fetch_docs_ranked_by_boost -from danswer.db.feedback import update_document_boost -from danswer.db.feedback import update_document_hidden -from danswer.db.index_attempt import cancel_indexing_attempts_for_ccpair -from danswer.db.models import User -from danswer.document_index.document_index_utils import get_both_index_names -from danswer.document_index.factory import get_default_document_index -from danswer.file_store.file_store import get_default_file_store -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.llm.factory import get_default_llms -from danswer.llm.utils import test_llm -from danswer.server.documents.models import ConnectorCredentialPairIdentifier -from danswer.server.manage.models import BoostDoc -from danswer.server.manage.models import BoostUpdateRequest -from danswer.server.manage.models import HiddenUpdateRequest -from danswer.server.models import StatusResponse -from danswer.utils.logger import setup_logger +from onyx.db.engine import get_current_tenant_id +from onyx.db.engine import get_session +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.db.feedback import fetch_docs_ranked_by_boost +from onyx.db.feedback import update_document_boost +from onyx.db.feedback import update_document_hidden +from onyx.db.index_attempt import cancel_indexing_attempts_for_ccpair +from onyx.db.models import User +from onyx.document_index.document_index_utils import get_both_index_names +from onyx.document_index.factory import get_default_document_index +from onyx.file_store.file_store import get_default_file_store +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.llm.factory import get_default_llms +from onyx.llm.utils import test_llm +from onyx.server.documents.models import ConnectorCredentialPairIdentifier +from onyx.server.manage.models import BoostDoc +from onyx.server.manage.models import BoostUpdateRequest +from onyx.server.manage.models import HiddenUpdateRequest +from onyx.server.models import StatusResponse +from onyx.utils.logger import setup_logger router = APIRouter(prefix="/manage") logger = setup_logger() @@ -200,8 +200,8 @@ def create_deletion_attempt_for_connector_id( # run the beat task to pick up this deletion from the db immediately primary_app.send_task( - DanswerCeleryTask.CHECK_FOR_CONNECTOR_DELETION, - priority=DanswerCeleryPriority.HIGH, + OnyxCeleryTask.CHECK_FOR_CONNECTOR_DELETION, + priority=OnyxCeleryPriority.HIGH, kwargs={"tenant_id": tenant_id}, ) diff --git a/backend/danswer/server/manage/embedding/api.py b/backend/onyx/server/manage/embedding/api.py similarity index 79% rename from backend/danswer/server/manage/embedding/api.py rename to backend/onyx/server/manage/embedding/api.py index 5d6e55e7a6d..0cd836eb717 100644 --- a/backend/danswer/server/manage/embedding/api.py +++ b/backend/onyx/server/manage/embedding/api.py @@ -3,20 +3,20 @@ from fastapi import HTTPException from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.db.engine import get_session -from danswer.db.llm import fetch_existing_embedding_providers -from danswer.db.llm import remove_embedding_provider -from danswer.db.llm import upsert_cloud_embedding_provider -from danswer.db.models import User -from danswer.db.search_settings import get_all_search_settings -from danswer.db.search_settings import get_current_db_embedding_provider -from danswer.indexing.models import EmbeddingModelDetail -from danswer.natural_language_processing.search_nlp_models import EmbeddingModel -from danswer.server.manage.embedding.models import CloudEmbeddingProvider -from danswer.server.manage.embedding.models import CloudEmbeddingProviderCreationRequest -from danswer.server.manage.embedding.models import TestEmbeddingRequest -from danswer.utils.logger import setup_logger +from onyx.auth.users import current_admin_user +from onyx.db.engine import get_session +from onyx.db.llm import fetch_existing_embedding_providers +from onyx.db.llm import remove_embedding_provider +from onyx.db.llm import upsert_cloud_embedding_provider +from onyx.db.models import User +from onyx.db.search_settings import get_all_search_settings +from onyx.db.search_settings import get_current_db_embedding_provider +from onyx.indexing.models import EmbeddingModelDetail +from onyx.natural_language_processing.search_nlp_models import EmbeddingModel +from onyx.server.manage.embedding.models import CloudEmbeddingProvider +from onyx.server.manage.embedding.models import CloudEmbeddingProviderCreationRequest +from onyx.server.manage.embedding.models import TestEmbeddingRequest +from onyx.utils.logger import setup_logger from shared_configs.configs import MODEL_SERVER_HOST from shared_configs.configs import MODEL_SERVER_PORT from shared_configs.enums import EmbeddingProvider diff --git a/backend/danswer/server/manage/embedding/models.py b/backend/onyx/server/manage/embedding/models.py similarity index 94% rename from backend/danswer/server/manage/embedding/models.py rename to backend/onyx/server/manage/embedding/models.py index a7e7cc8e1ac..3f191cdb630 100644 --- a/backend/danswer/server/manage/embedding/models.py +++ b/backend/onyx/server/manage/embedding/models.py @@ -5,7 +5,7 @@ from shared_configs.enums import EmbeddingProvider if TYPE_CHECKING: - from danswer.db.models import CloudEmbeddingProvider as CloudEmbeddingProviderModel + from onyx.db.models import CloudEmbeddingProvider as CloudEmbeddingProviderModel class SearchSettingsDeleteRequest(BaseModel): diff --git a/backend/danswer/server/manage/get_state.py b/backend/onyx/server/manage/get_state.py similarity index 60% rename from backend/danswer/server/manage/get_state.py rename to backend/onyx/server/manage/get_state.py index 3ca47841b64..97748fe8620 100644 --- a/backend/danswer/server/manage/get_state.py +++ b/backend/onyx/server/manage/get_state.py @@ -1,11 +1,11 @@ from fastapi import APIRouter -from danswer import __version__ -from danswer.auth.users import user_needs_to_be_verified -from danswer.configs.app_configs import AUTH_TYPE -from danswer.server.manage.models import AuthTypeResponse -from danswer.server.manage.models import VersionResponse -from danswer.server.models import StatusResponse +from onyx import __version__ +from onyx.auth.users import user_needs_to_be_verified +from onyx.configs.app_configs import AUTH_TYPE +from onyx.server.manage.models import AuthTypeResponse +from onyx.server.manage.models import VersionResponse +from onyx.server.models import StatusResponse router = APIRouter() diff --git a/backend/danswer/server/manage/llm/api.py b/backend/onyx/server/manage/llm/api.py similarity index 83% rename from backend/danswer/server/manage/llm/api.py rename to backend/onyx/server/manage/llm/api.py index f52877d919a..e37b7951f39 100644 --- a/backend/danswer/server/manage/llm/api.py +++ b/backend/onyx/server/manage/llm/api.py @@ -6,27 +6,27 @@ from fastapi import Query from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_user -from danswer.db.engine import get_session -from danswer.db.llm import fetch_existing_llm_providers -from danswer.db.llm import fetch_provider -from danswer.db.llm import remove_llm_provider -from danswer.db.llm import update_default_provider -from danswer.db.llm import upsert_llm_provider -from danswer.db.models import User -from danswer.llm.factory import get_default_llms -from danswer.llm.factory import get_llm -from danswer.llm.llm_provider_options import fetch_available_well_known_llms -from danswer.llm.llm_provider_options import WellKnownLLMProviderDescriptor -from danswer.llm.utils import litellm_exception_to_error_msg -from danswer.llm.utils import test_llm -from danswer.server.manage.llm.models import FullLLMProvider -from danswer.server.manage.llm.models import LLMProviderDescriptor -from danswer.server.manage.llm.models import LLMProviderUpsertRequest -from danswer.server.manage.llm.models import TestLLMRequest -from danswer.utils.logger import setup_logger -from danswer.utils.threadpool_concurrency import run_functions_tuples_in_parallel +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_user +from onyx.db.engine import get_session +from onyx.db.llm import fetch_existing_llm_providers +from onyx.db.llm import fetch_provider +from onyx.db.llm import remove_llm_provider +from onyx.db.llm import update_default_provider +from onyx.db.llm import upsert_llm_provider +from onyx.db.models import User +from onyx.llm.factory import get_default_llms +from onyx.llm.factory import get_llm +from onyx.llm.llm_provider_options import fetch_available_well_known_llms +from onyx.llm.llm_provider_options import WellKnownLLMProviderDescriptor +from onyx.llm.utils import litellm_exception_to_error_msg +from onyx.llm.utils import test_llm +from onyx.server.manage.llm.models import FullLLMProvider +from onyx.server.manage.llm.models import LLMProviderDescriptor +from onyx.server.manage.llm.models import LLMProviderUpsertRequest +from onyx.server.manage.llm.models import TestLLMRequest +from onyx.utils.logger import setup_logger +from onyx.utils.threadpool_concurrency import run_functions_tuples_in_parallel logger = setup_logger() diff --git a/backend/danswer/server/manage/llm/models.py b/backend/onyx/server/manage/llm/models.py similarity index 96% rename from backend/danswer/server/manage/llm/models.py rename to backend/onyx/server/manage/llm/models.py index 9b371099c57..91c59fb15d4 100644 --- a/backend/danswer/server/manage/llm/models.py +++ b/backend/onyx/server/manage/llm/models.py @@ -3,11 +3,11 @@ from pydantic import BaseModel from pydantic import Field -from danswer.llm.llm_provider_options import fetch_models_for_provider +from onyx.llm.llm_provider_options import fetch_models_for_provider if TYPE_CHECKING: - from danswer.db.models import LLMProvider as LLMProviderModel + from onyx.db.models import LLMProvider as LLMProviderModel class TestLLMRequest(BaseModel): diff --git a/backend/danswer/server/manage/models.py b/backend/onyx/server/manage/models.py similarity index 90% rename from backend/danswer/server/manage/models.py rename to backend/onyx/server/manage/models.py index 0e37fc89191..85951a1ba64 100644 --- a/backend/danswer/server/manage/models.py +++ b/backend/onyx/server/manage/models.py @@ -8,20 +8,20 @@ from pydantic import field_validator from pydantic import model_validator -from danswer.auth.schemas import UserRole -from danswer.configs.app_configs import TRACK_EXTERNAL_IDP_EXPIRY -from danswer.configs.constants import AuthType -from danswer.context.search.models import SavedSearchSettings -from danswer.danswerbot.slack.config import VALID_SLACK_FILTERS -from danswer.db.models import AllowedAnswerFilters -from danswer.db.models import ChannelConfig -from danswer.db.models import SlackBot as SlackAppModel -from danswer.db.models import SlackChannelConfig as SlackChannelConfigModel -from danswer.db.models import User -from danswer.server.features.persona.models import PersonaSnapshot -from danswer.server.models import FullUserSnapshot -from danswer.server.models import InvitedUserSnapshot -from ee.danswer.server.manage.models import StandardAnswerCategory +from ee.onyx.server.manage.models import StandardAnswerCategory +from onyx.auth.schemas import UserRole +from onyx.configs.app_configs import TRACK_EXTERNAL_IDP_EXPIRY +from onyx.configs.constants import AuthType +from onyx.context.search.models import SavedSearchSettings +from onyx.db.models import AllowedAnswerFilters +from onyx.db.models import ChannelConfig +from onyx.db.models import SlackBot as SlackAppModel +from onyx.db.models import SlackChannelConfig as SlackChannelConfigModel +from onyx.db.models import User +from onyx.onyxbot.slack.config import VALID_SLACK_FILTERS +from onyx.server.features.persona.models import PersonaSnapshot +from onyx.server.models import FullUserSnapshot +from onyx.server.models import InvitedUserSnapshot if TYPE_CHECKING: diff --git a/backend/danswer/server/manage/search_settings.py b/backend/onyx/server/manage/search_settings.py similarity index 80% rename from backend/danswer/server/manage/search_settings.py rename to backend/onyx/server/manage/search_settings.py index 5b8d7d8e1bb..ae28bbbf7ce 100644 --- a/backend/danswer/server/manage/search_settings.py +++ b/backend/onyx/server/manage/search_settings.py @@ -4,33 +4,33 @@ from fastapi import status from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_user -from danswer.configs.app_configs import DISABLE_INDEX_UPDATE_ON_SWAP -from danswer.context.search.models import SavedSearchSettings -from danswer.context.search.models import SearchSettingsCreationRequest -from danswer.db.connector_credential_pair import get_connector_credential_pairs -from danswer.db.connector_credential_pair import resync_cc_pair -from danswer.db.engine import get_session -from danswer.db.index_attempt import expire_index_attempts -from danswer.db.models import IndexModelStatus -from danswer.db.models import User -from danswer.db.search_settings import create_search_settings -from danswer.db.search_settings import delete_search_settings -from danswer.db.search_settings import get_current_search_settings -from danswer.db.search_settings import get_embedding_provider_from_provider_type -from danswer.db.search_settings import get_secondary_search_settings -from danswer.db.search_settings import update_current_search_settings -from danswer.db.search_settings import update_search_settings_status -from danswer.document_index.factory import get_default_document_index -from danswer.file_processing.unstructured import delete_unstructured_api_key -from danswer.file_processing.unstructured import get_unstructured_api_key -from danswer.file_processing.unstructured import update_unstructured_api_key -from danswer.natural_language_processing.search_nlp_models import clean_model_name -from danswer.server.manage.embedding.models import SearchSettingsDeleteRequest -from danswer.server.manage.models import FullModelVersionResponse -from danswer.server.models import IdReturn -from danswer.utils.logger import setup_logger +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_user +from onyx.configs.app_configs import DISABLE_INDEX_UPDATE_ON_SWAP +from onyx.context.search.models import SavedSearchSettings +from onyx.context.search.models import SearchSettingsCreationRequest +from onyx.db.connector_credential_pair import get_connector_credential_pairs +from onyx.db.connector_credential_pair import resync_cc_pair +from onyx.db.engine import get_session +from onyx.db.index_attempt import expire_index_attempts +from onyx.db.models import IndexModelStatus +from onyx.db.models import User +from onyx.db.search_settings import create_search_settings +from onyx.db.search_settings import delete_search_settings +from onyx.db.search_settings import get_current_search_settings +from onyx.db.search_settings import get_embedding_provider_from_provider_type +from onyx.db.search_settings import get_secondary_search_settings +from onyx.db.search_settings import update_current_search_settings +from onyx.db.search_settings import update_search_settings_status +from onyx.document_index.factory import get_default_document_index +from onyx.file_processing.unstructured import delete_unstructured_api_key +from onyx.file_processing.unstructured import get_unstructured_api_key +from onyx.file_processing.unstructured import update_unstructured_api_key +from onyx.natural_language_processing.search_nlp_models import clean_model_name +from onyx.server.manage.embedding.models import SearchSettingsDeleteRequest +from onyx.server.manage.models import FullModelVersionResponse +from onyx.server.models import IdReturn +from onyx.utils.logger import setup_logger from shared_configs.configs import ALT_INDEX_SUFFIX router = APIRouter(prefix="/search-settings") diff --git a/backend/danswer/server/manage/slack_bot.py b/backend/onyx/server/manage/slack_bot.py similarity index 87% rename from backend/danswer/server/manage/slack_bot.py rename to backend/onyx/server/manage/slack_bot.py index 10c5a1ac236..e84529ef066 100644 --- a/backend/danswer/server/manage/slack_bot.py +++ b/backend/onyx/server/manage/slack_bot.py @@ -3,28 +3,28 @@ from fastapi import HTTPException from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.danswerbot.slack.config import validate_channel_name -from danswer.db.constants import SLACK_BOT_PERSONA_PREFIX -from danswer.db.engine import get_session -from danswer.db.models import ChannelConfig -from danswer.db.models import User -from danswer.db.persona import get_persona_by_id -from danswer.db.slack_bot import fetch_slack_bot -from danswer.db.slack_bot import fetch_slack_bots -from danswer.db.slack_bot import insert_slack_bot -from danswer.db.slack_bot import remove_slack_bot -from danswer.db.slack_bot import update_slack_bot -from danswer.db.slack_channel_config import create_slack_channel_persona -from danswer.db.slack_channel_config import fetch_slack_channel_config -from danswer.db.slack_channel_config import fetch_slack_channel_configs -from danswer.db.slack_channel_config import insert_slack_channel_config -from danswer.db.slack_channel_config import remove_slack_channel_config -from danswer.db.slack_channel_config import update_slack_channel_config -from danswer.server.manage.models import SlackBot -from danswer.server.manage.models import SlackBotCreationRequest -from danswer.server.manage.models import SlackChannelConfig -from danswer.server.manage.models import SlackChannelConfigCreationRequest +from onyx.auth.users import current_admin_user +from onyx.db.constants import SLACK_BOT_PERSONA_PREFIX +from onyx.db.engine import get_session +from onyx.db.models import ChannelConfig +from onyx.db.models import User +from onyx.db.persona import get_persona_by_id +from onyx.db.slack_bot import fetch_slack_bot +from onyx.db.slack_bot import fetch_slack_bots +from onyx.db.slack_bot import insert_slack_bot +from onyx.db.slack_bot import remove_slack_bot +from onyx.db.slack_bot import update_slack_bot +from onyx.db.slack_channel_config import create_slack_channel_persona +from onyx.db.slack_channel_config import fetch_slack_channel_config +from onyx.db.slack_channel_config import fetch_slack_channel_configs +from onyx.db.slack_channel_config import insert_slack_channel_config +from onyx.db.slack_channel_config import remove_slack_channel_config +from onyx.db.slack_channel_config import update_slack_channel_config +from onyx.onyxbot.slack.config import validate_channel_name +from onyx.server.manage.models import SlackBot +from onyx.server.manage.models import SlackBotCreationRequest +from onyx.server.manage.models import SlackChannelConfig +from onyx.server.manage.models import SlackChannelConfigCreationRequest router = APIRouter(prefix="/manage") @@ -64,7 +64,7 @@ def _form_channel_config( if respond_tag_only and respond_member_group_list: raise ValueError( - "Cannot set DanswerBot to only respond to tags only and " + "Cannot set OnyxBot to only respond to tags only and " "also respond to a predetermined set of users." ) @@ -163,7 +163,7 @@ def patch_slack_channel_config( if not persona.name.startswith(SLACK_BOT_PERSONA_PREFIX): # Don't update actual non-slackbot specific personas # Since this one specified document sets, we have to create a new persona - # for this DanswerBot config + # for this OnyxBot config existing_persona_id = None else: existing_persona_id = existing_slack_channel_config.persona_id diff --git a/backend/danswer/server/manage/users.py b/backend/onyx/server/manage/users.py similarity index 88% rename from backend/danswer/server/manage/users.py rename to backend/onyx/server/manage/users.py index 75fd9dfe3a8..d75b48441e1 100644 --- a/backend/danswer/server/manage/users.py +++ b/backend/onyx/server/manage/users.py @@ -20,50 +20,50 @@ from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import Session -from danswer.auth.invited_users import get_invited_users -from danswer.auth.invited_users import write_invited_users -from danswer.auth.noauth_user import fetch_no_auth_user -from danswer.auth.noauth_user import set_no_auth_user_preferences -from danswer.auth.schemas import UserRole -from danswer.auth.schemas import UserStatus -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_curator_or_admin_user -from danswer.auth.users import current_user -from danswer.auth.users import optional_user -from danswer.configs.app_configs import AUTH_TYPE -from danswer.configs.app_configs import ENABLE_EMAIL_INVITES -from danswer.configs.app_configs import SESSION_EXPIRE_TIME_SECONDS -from danswer.configs.app_configs import VALID_EMAIL_DOMAINS -from danswer.configs.constants import AuthType -from danswer.db.api_key import is_api_key_email_address -from danswer.db.auth import get_total_users_count -from danswer.db.engine import CURRENT_TENANT_ID_CONTEXTVAR -from danswer.db.engine import get_session -from danswer.db.models import AccessToken -from danswer.db.models import DocumentSet__User -from danswer.db.models import Persona__User -from danswer.db.models import SamlAccount -from danswer.db.models import User -from danswer.db.models import User__UserGroup -from danswer.db.users import get_user_by_email -from danswer.db.users import list_users -from danswer.db.users import validate_user_role_update -from danswer.key_value_store.factory import get_kv_store -from danswer.server.manage.models import AllUsersResponse -from danswer.server.manage.models import AutoScrollRequest -from danswer.server.manage.models import UserByEmail -from danswer.server.manage.models import UserInfo -from danswer.server.manage.models import UserPreferences -from danswer.server.manage.models import UserRoleResponse -from danswer.server.manage.models import UserRoleUpdateRequest -from danswer.server.models import FullUserSnapshot -from danswer.server.models import InvitedUserSnapshot -from danswer.server.models import MinimalUserSnapshot -from danswer.server.utils import BasicAuthenticationError -from danswer.server.utils import send_user_email_invite -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_ee_implementation_or_noop -from ee.danswer.configs.app_configs import SUPER_USERS +from ee.onyx.configs.app_configs import SUPER_USERS +from onyx.auth.invited_users import get_invited_users +from onyx.auth.invited_users import write_invited_users +from onyx.auth.noauth_user import fetch_no_auth_user +from onyx.auth.noauth_user import set_no_auth_user_preferences +from onyx.auth.schemas import UserRole +from onyx.auth.schemas import UserStatus +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_curator_or_admin_user +from onyx.auth.users import current_user +from onyx.auth.users import optional_user +from onyx.configs.app_configs import AUTH_TYPE +from onyx.configs.app_configs import ENABLE_EMAIL_INVITES +from onyx.configs.app_configs import SESSION_EXPIRE_TIME_SECONDS +from onyx.configs.app_configs import VALID_EMAIL_DOMAINS +from onyx.configs.constants import AuthType +from onyx.db.api_key import is_api_key_email_address +from onyx.db.auth import get_total_users_count +from onyx.db.engine import CURRENT_TENANT_ID_CONTEXTVAR +from onyx.db.engine import get_session +from onyx.db.models import AccessToken +from onyx.db.models import DocumentSet__User +from onyx.db.models import Persona__User +from onyx.db.models import SamlAccount +from onyx.db.models import User +from onyx.db.models import User__UserGroup +from onyx.db.users import get_user_by_email +from onyx.db.users import list_users +from onyx.db.users import validate_user_role_update +from onyx.key_value_store.factory import get_kv_store +from onyx.server.manage.models import AllUsersResponse +from onyx.server.manage.models import AutoScrollRequest +from onyx.server.manage.models import UserByEmail +from onyx.server.manage.models import UserInfo +from onyx.server.manage.models import UserPreferences +from onyx.server.manage.models import UserRoleResponse +from onyx.server.manage.models import UserRoleUpdateRequest +from onyx.server.models import FullUserSnapshot +from onyx.server.models import InvitedUserSnapshot +from onyx.server.models import MinimalUserSnapshot +from onyx.server.utils import BasicAuthenticationError +from onyx.server.utils import send_user_email_invite +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_ee_implementation_or_noop from shared_configs.configs import MULTI_TENANT logger = setup_logger() @@ -106,7 +106,7 @@ def set_user_role( if requested_role == UserRole.CURATOR: # Remove all curator db relationships before changing role fetch_ee_implementation_or_noop( - "danswer.db.user_group", + "onyx.db.user_group", "remove_curator_status__no_commit", )(db_session, user_to_update) @@ -242,14 +242,14 @@ def bulk_invite_users( if MULTI_TENANT: try: fetch_ee_implementation_or_noop( - "danswer.server.tenants.provisioning", "add_users_to_tenant", None + "onyx.server.tenants.provisioning", "add_users_to_tenant", None )(new_invited_emails, tenant_id) except IntegrityError as e: if isinstance(e.orig, UniqueViolation): raise HTTPException( status_code=400, - detail="User has already been invited to a Danswer organization", + detail="User has already been invited to a Onyx organization", ) raise except Exception as e: @@ -265,7 +265,7 @@ def bulk_invite_users( try: logger.info("Registering tenant users") fetch_ee_implementation_or_noop( - "danswer.server.tenants.billing", "register_tenant_users", None + "onyx.server.tenants.billing", "register_tenant_users", None )(CURRENT_TENANT_ID_CONTEXTVAR.get(), get_total_users_count(db_session)) if ENABLE_EMAIL_INVITES: try: @@ -282,7 +282,7 @@ def bulk_invite_users( ) write_invited_users(initial_invited_users) # Reset to original state fetch_ee_implementation_or_noop( - "danswer.server.tenants.user_mapping", "remove_users_from_tenant", None + "onyx.server.tenants.user_mapping", "remove_users_from_tenant", None )(new_invited_emails, tenant_id) raise e @@ -298,14 +298,14 @@ def remove_invited_user( tenant_id = CURRENT_TENANT_ID_CONTEXTVAR.get() fetch_ee_implementation_or_noop( - "danswer.server.tenants.user_mapping", "remove_users_from_tenant", None + "onyx.server.tenants.user_mapping", "remove_users_from_tenant", None )([user_email.user_email], tenant_id) number_of_invited_users = write_invited_users(remaining_users) try: if MULTI_TENANT: fetch_ee_implementation_or_noop( - "danswer.server.tenants.billing", "register_tenant_users", None + "onyx.server.tenants.billing", "register_tenant_users", None )(CURRENT_TENANT_ID_CONTEXTVAR.get(), get_total_users_count(db_session)) except Exception: logger.error( @@ -374,7 +374,7 @@ async def delete_user( db_session.delete(oauth_account) fetch_ee_implementation_or_noop( - "danswer.db.external_perm", + "onyx.db.external_perm", "delete_user__ext_group_for_user__no_commit", )( db_session=db_session, @@ -540,7 +540,7 @@ def verify_user_logged_in( None if MULTI_TENANT else get_current_token_creation(user, db_session) ) organization_name = fetch_ee_implementation_or_noop( - "danswer.server.tenants.user_mapping", "get_tenant_id_for_email", None + "onyx.server.tenants.user_mapping", "get_tenant_id_for_email", None )(user.email) user_info = UserInfo.from_model( diff --git a/backend/danswer/server/middleware/latency_logging.py b/backend/onyx/server/middleware/latency_logging.py similarity index 100% rename from backend/danswer/server/middleware/latency_logging.py rename to backend/onyx/server/middleware/latency_logging.py diff --git a/backend/danswer/server/models.py b/backend/onyx/server/models.py similarity index 89% rename from backend/danswer/server/models.py rename to backend/onyx/server/models.py index 9c78851eb06..6e1c95b653d 100644 --- a/backend/danswer/server/models.py +++ b/backend/onyx/server/models.py @@ -5,8 +5,8 @@ from pydantic import BaseModel -from danswer.auth.schemas import UserRole -from danswer.auth.schemas import UserStatus +from onyx.auth.schemas import UserRole +from onyx.auth.schemas import UserStatus DataT = TypeVar("DataT") diff --git a/backend/danswer/server/oauth.py b/backend/onyx/server/oauth.py similarity index 93% rename from backend/danswer/server/oauth.py rename to backend/onyx/server/oauth.py index f126fb60b3e..66630d8750d 100644 --- a/backend/danswer/server/oauth.py +++ b/backend/onyx/server/oauth.py @@ -12,36 +12,36 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.configs.constants import DocumentSource -from danswer.connectors.google_utils.google_auth import get_google_oauth_creds -from danswer.connectors.google_utils.google_auth import sanitize_oauth_credentials -from danswer.connectors.google_utils.shared_constants import ( +from ee.onyx.configs.app_configs import OAUTH_CONFLUENCE_CLIENT_ID +from ee.onyx.configs.app_configs import OAUTH_CONFLUENCE_CLIENT_SECRET +from ee.onyx.configs.app_configs import OAUTH_GOOGLE_DRIVE_CLIENT_ID +from ee.onyx.configs.app_configs import OAUTH_GOOGLE_DRIVE_CLIENT_SECRET +from ee.onyx.configs.app_configs import OAUTH_SLACK_CLIENT_ID +from ee.onyx.configs.app_configs import OAUTH_SLACK_CLIENT_SECRET +from onyx.auth.users import current_user +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.configs.constants import DocumentSource +from onyx.connectors.google_utils.google_auth import get_google_oauth_creds +from onyx.connectors.google_utils.google_auth import sanitize_oauth_credentials +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_AUTHENTICATION_METHOD, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_TOKEN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_PRIMARY_ADMIN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( GoogleOAuthAuthenticationMethod, ) -from danswer.db.credentials import create_credential -from danswer.db.engine import get_current_tenant_id -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.redis.redis_pool import get_redis_client -from danswer.server.documents.models import CredentialBase -from danswer.utils.logger import setup_logger -from ee.danswer.configs.app_configs import OAUTH_CONFLUENCE_CLIENT_ID -from ee.danswer.configs.app_configs import OAUTH_CONFLUENCE_CLIENT_SECRET -from ee.danswer.configs.app_configs import OAUTH_GOOGLE_DRIVE_CLIENT_ID -from ee.danswer.configs.app_configs import OAUTH_GOOGLE_DRIVE_CLIENT_SECRET -from ee.danswer.configs.app_configs import OAUTH_SLACK_CLIENT_ID -from ee.danswer.configs.app_configs import OAUTH_SLACK_CLIENT_SECRET +from onyx.db.credentials import create_credential +from onyx.db.engine import get_current_tenant_id +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.redis.redis_pool import get_redis_client +from onyx.server.documents.models import CredentialBase +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -64,7 +64,7 @@ class OAuthSession(BaseModel): TOKEN_URL = "https://slack.com/api/oauth.v2.access" - # SCOPE is per https://docs.danswer.dev/connectors/slack + # SCOPE is per https://docs.onyx.app/connectors/slack BOT_SCOPE = ( "channels:history," "channels:read," @@ -211,7 +211,7 @@ class OAuthSession(BaseModel): TOKEN_URL = "https://oauth2.googleapis.com/token" - # SCOPE is per https://docs.danswer.dev/connectors/google-drive + # SCOPE is per https://docs.onyx.app/connectors/google-drive # TODO: Merge with or use google_utils.GOOGLE_SCOPES SCOPE = ( "https://www.googleapis.com/auth/drive.readonly%20" diff --git a/backend/ee/danswer/server/query_and_chat/__init__.py b/backend/onyx/server/onyx_api/__init__.py similarity index 100% rename from backend/ee/danswer/server/query_and_chat/__init__.py rename to backend/onyx/server/onyx_api/__init__.py diff --git a/backend/danswer/server/danswer_api/ingestion.py b/backend/onyx/server/onyx_api/ingestion.py similarity index 77% rename from backend/danswer/server/danswer_api/ingestion.py rename to backend/onyx/server/onyx_api/ingestion.py index c65c870d461..1c606b0fc68 100644 --- a/backend/danswer/server/danswer_api/ingestion.py +++ b/backend/onyx/server/onyx_api/ingestion.py @@ -3,31 +3,31 @@ from fastapi import HTTPException from sqlalchemy.orm import Session -from danswer.auth.users import api_key_dep -from danswer.configs.constants import DocumentSource -from danswer.connectors.models import Document -from danswer.connectors.models import IndexAttemptMetadata -from danswer.db.connector_credential_pair import get_connector_credential_pair_from_id -from danswer.db.document import get_documents_by_cc_pair -from danswer.db.document import get_ingestion_documents -from danswer.db.engine import get_current_tenant_id -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.search_settings import get_current_search_settings -from danswer.db.search_settings import get_secondary_search_settings -from danswer.document_index.document_index_utils import get_both_index_names -from danswer.document_index.factory import get_default_document_index -from danswer.indexing.embedder import DefaultIndexingEmbedder -from danswer.indexing.indexing_pipeline import build_indexing_pipeline -from danswer.server.danswer_api.models import DocMinimalInfo -from danswer.server.danswer_api.models import IngestionDocument -from danswer.server.danswer_api.models import IngestionResult -from danswer.utils.logger import setup_logger +from onyx.auth.users import api_key_dep +from onyx.configs.constants import DocumentSource +from onyx.connectors.models import Document +from onyx.connectors.models import IndexAttemptMetadata +from onyx.db.connector_credential_pair import get_connector_credential_pair_from_id +from onyx.db.document import get_documents_by_cc_pair +from onyx.db.document import get_ingestion_documents +from onyx.db.engine import get_current_tenant_id +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.search_settings import get_current_search_settings +from onyx.db.search_settings import get_secondary_search_settings +from onyx.document_index.document_index_utils import get_both_index_names +from onyx.document_index.factory import get_default_document_index +from onyx.indexing.embedder import DefaultIndexingEmbedder +from onyx.indexing.indexing_pipeline import build_indexing_pipeline +from onyx.server.onyx_api.models import DocMinimalInfo +from onyx.server.onyx_api.models import IngestionDocument +from onyx.server.onyx_api.models import IngestionResult +from onyx.utils.logger import setup_logger logger = setup_logger() # not using /api to avoid confusion with nginx api path routing -router = APIRouter(prefix="/danswer-api") +router = APIRouter(prefix="/onyx-api") @router.get("/connector-docs/{cc_pair_id}") diff --git a/backend/danswer/server/danswer_api/models.py b/backend/onyx/server/onyx_api/models.py similarity index 86% rename from backend/danswer/server/danswer_api/models.py rename to backend/onyx/server/onyx_api/models.py index 17d6a32c05f..2cbf6ff6d34 100644 --- a/backend/danswer/server/danswer_api/models.py +++ b/backend/onyx/server/onyx_api/models.py @@ -1,6 +1,6 @@ from pydantic import BaseModel -from danswer.connectors.models import DocumentBase +from onyx.connectors.models import DocumentBase class IngestionDocument(BaseModel): diff --git a/backend/danswer/server/openai_assistants_api/asssistants_api.py b/backend/onyx/server/openai_assistants_api/asssistants_api.py similarity index 93% rename from backend/danswer/server/openai_assistants_api/asssistants_api.py rename to backend/onyx/server/openai_assistants_api/asssistants_api.py index 000944213da..53bd228258e 100644 --- a/backend/danswer/server/openai_assistants_api/asssistants_api.py +++ b/backend/onyx/server/openai_assistants_api/asssistants_api.py @@ -9,18 +9,18 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.context.search.enums import RecencyBiasSetting -from danswer.db.engine import get_session -from danswer.db.models import Persona -from danswer.db.models import User -from danswer.db.persona import get_persona_by_id -from danswer.db.persona import get_personas -from danswer.db.persona import mark_persona_as_deleted -from danswer.db.persona import upsert_persona -from danswer.db.persona import upsert_prompt -from danswer.db.tools import get_tool_by_name -from danswer.utils.logger import setup_logger +from onyx.auth.users import current_user +from onyx.context.search.enums import RecencyBiasSetting +from onyx.db.engine import get_session +from onyx.db.models import Persona +from onyx.db.models import User +from onyx.db.persona import get_persona_by_id +from onyx.db.persona import get_personas +from onyx.db.persona import mark_persona_as_deleted +from onyx.db.persona import upsert_persona +from onyx.db.persona import upsert_prompt +from onyx.db.tools import get_tool_by_name +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/server/openai_assistants_api/full_openai_assistants_api.py b/backend/onyx/server/openai_assistants_api/full_openai_assistants_api.py similarity index 53% rename from backend/danswer/server/openai_assistants_api/full_openai_assistants_api.py rename to backend/onyx/server/openai_assistants_api/full_openai_assistants_api.py index 2b2fe93e96e..3e717e95a3d 100644 --- a/backend/danswer/server/openai_assistants_api/full_openai_assistants_api.py +++ b/backend/onyx/server/openai_assistants_api/full_openai_assistants_api.py @@ -1,11 +1,11 @@ from fastapi import APIRouter -from danswer.server.openai_assistants_api.asssistants_api import ( +from onyx.server.openai_assistants_api.asssistants_api import ( router as assistants_router, ) -from danswer.server.openai_assistants_api.messages_api import router as messages_router -from danswer.server.openai_assistants_api.runs_api import router as runs_router -from danswer.server.openai_assistants_api.threads_api import router as threads_router +from onyx.server.openai_assistants_api.messages_api import router as messages_router +from onyx.server.openai_assistants_api.runs_api import router as runs_router +from onyx.server.openai_assistants_api.threads_api import router as threads_router def get_full_openai_assistants_api_router() -> APIRouter: diff --git a/backend/danswer/server/openai_assistants_api/messages_api.py b/backend/onyx/server/openai_assistants_api/messages_api.py similarity index 93% rename from backend/danswer/server/openai_assistants_api/messages_api.py rename to backend/onyx/server/openai_assistants_api/messages_api.py index c28c349f277..2dc9ca0e265 100644 --- a/backend/danswer/server/openai_assistants_api/messages_api.py +++ b/backend/onyx/server/openai_assistants_api/messages_api.py @@ -11,16 +11,16 @@ from pydantic import Field from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.configs.constants import MessageType -from danswer.db.chat import create_new_chat_message -from danswer.db.chat import get_chat_message -from danswer.db.chat import get_chat_messages_by_session -from danswer.db.chat import get_chat_session_by_id -from danswer.db.chat import get_or_create_root_message -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.llm.utils import check_number_of_tokens +from onyx.auth.users import current_user +from onyx.configs.constants import MessageType +from onyx.db.chat import create_new_chat_message +from onyx.db.chat import get_chat_message +from onyx.db.chat import get_chat_messages_by_session +from onyx.db.chat import get_chat_session_by_id +from onyx.db.chat import get_or_create_root_message +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.llm.utils import check_number_of_tokens router = APIRouter(prefix="") diff --git a/backend/danswer/server/openai_assistants_api/runs_api.py b/backend/onyx/server/openai_assistants_api/runs_api.py similarity index 92% rename from backend/danswer/server/openai_assistants_api/runs_api.py rename to backend/onyx/server/openai_assistants_api/runs_api.py index 74fa6fa0497..2d0010e0724 100644 --- a/backend/danswer/server/openai_assistants_api/runs_api.py +++ b/backend/onyx/server/openai_assistants_api/runs_api.py @@ -9,22 +9,22 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.chat.process_message import stream_chat_message_objects -from danswer.configs.constants import MessageType -from danswer.context.search.models import RetrievalDetails -from danswer.db.chat import create_new_chat_message -from danswer.db.chat import get_chat_message -from danswer.db.chat import get_chat_messages_by_session -from danswer.db.chat import get_chat_session_by_id -from danswer.db.chat import get_or_create_root_message -from danswer.db.engine import get_session -from danswer.db.models import ChatMessage -from danswer.db.models import User -from danswer.server.query_and_chat.models import ChatMessageDetail -from danswer.server.query_and_chat.models import CreateChatMessageRequest -from danswer.tools.tool_implementations.search.search_tool import SearchTool -from danswer.utils.logger import setup_logger +from onyx.auth.users import current_user +from onyx.chat.process_message import stream_chat_message_objects +from onyx.configs.constants import MessageType +from onyx.context.search.models import RetrievalDetails +from onyx.db.chat import create_new_chat_message +from onyx.db.chat import get_chat_message +from onyx.db.chat import get_chat_messages_by_session +from onyx.db.chat import get_chat_session_by_id +from onyx.db.chat import get_or_create_root_message +from onyx.db.engine import get_session +from onyx.db.models import ChatMessage +from onyx.db.models import User +from onyx.server.query_and_chat.models import ChatMessageDetail +from onyx.server.query_and_chat.models import CreateChatMessageRequest +from onyx.tools.tool_implementations.search.search_tool import SearchTool +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/server/openai_assistants_api/threads_api.py b/backend/onyx/server/openai_assistants_api/threads_api.py similarity index 88% rename from backend/danswer/server/openai_assistants_api/threads_api.py rename to backend/onyx/server/openai_assistants_api/threads_api.py index ffc3a3016dc..a487b6ca99f 100644 --- a/backend/danswer/server/openai_assistants_api/threads_api.py +++ b/backend/onyx/server/openai_assistants_api/threads_api.py @@ -7,16 +7,16 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.db.chat import create_chat_session -from danswer.db.chat import delete_chat_session -from danswer.db.chat import get_chat_session_by_id -from danswer.db.chat import get_chat_sessions_by_user -from danswer.db.chat import update_chat_session -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.server.query_and_chat.models import ChatSessionDetails -from danswer.server.query_and_chat.models import ChatSessionsResponse +from onyx.auth.users import current_user +from onyx.db.chat import create_chat_session +from onyx.db.chat import delete_chat_session +from onyx.db.chat import get_chat_session_by_id +from onyx.db.chat import get_chat_sessions_by_user +from onyx.db.chat import update_chat_session +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.server.query_and_chat.models import ChatSessionDetails +from onyx.server.query_and_chat.models import ChatSessionsResponse router = APIRouter(prefix="/threads") diff --git a/backend/ee/danswer/server/tenants/__init__.py b/backend/onyx/server/query_and_chat/__init__.py similarity index 100% rename from backend/ee/danswer/server/tenants/__init__.py rename to backend/onyx/server/query_and_chat/__init__.py diff --git a/backend/danswer/server/query_and_chat/chat_backend.py b/backend/onyx/server/query_and_chat/chat_backend.py similarity index 86% rename from backend/danswer/server/query_and_chat/chat_backend.py rename to backend/onyx/server/query_and_chat/chat_backend.py index 6d62a7bfc66..4291004a51d 100644 --- a/backend/danswer/server/query_and_chat/chat_backend.py +++ b/backend/onyx/server/query_and_chat/chat_backend.py @@ -19,68 +19,68 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.auth.users import current_limited_user -from danswer.auth.users import current_user -from danswer.chat.chat_utils import create_chat_chain -from danswer.chat.chat_utils import extract_headers -from danswer.chat.process_message import stream_chat_message -from danswer.chat.prompt_builder.citations_prompt import ( +from onyx.auth.users import current_limited_user +from onyx.auth.users import current_user +from onyx.chat.chat_utils import create_chat_chain +from onyx.chat.chat_utils import extract_headers +from onyx.chat.process_message import stream_chat_message +from onyx.chat.prompt_builder.citations_prompt import ( compute_max_document_tokens_for_persona, ) -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.configs.constants import FileOrigin -from danswer.configs.constants import MessageType -from danswer.configs.model_configs import LITELLM_PASS_THROUGH_HEADERS -from danswer.db.chat import add_chats_to_session_from_slack_thread -from danswer.db.chat import create_chat_session -from danswer.db.chat import create_new_chat_message -from danswer.db.chat import delete_chat_session -from danswer.db.chat import duplicate_chat_session_for_user_from_slack -from danswer.db.chat import get_chat_message -from danswer.db.chat import get_chat_messages_by_session -from danswer.db.chat import get_chat_session_by_id -from danswer.db.chat import get_chat_sessions_by_user -from danswer.db.chat import get_or_create_root_message -from danswer.db.chat import set_as_latest_chat_message -from danswer.db.chat import translate_db_message_to_chat_message_detail -from danswer.db.chat import update_chat_session -from danswer.db.engine import get_session -from danswer.db.feedback import create_chat_message_feedback -from danswer.db.feedback import create_doc_retrieval_feedback -from danswer.db.models import User -from danswer.db.persona import get_persona_by_id -from danswer.document_index.document_index_utils import get_both_index_names -from danswer.document_index.factory import get_default_document_index -from danswer.file_processing.extract_file_text import docx_to_txt_filename -from danswer.file_processing.extract_file_text import extract_file_text -from danswer.file_store.file_store import get_default_file_store -from danswer.file_store.models import ChatFileType -from danswer.file_store.models import FileDescriptor -from danswer.llm.exceptions import GenAIDisabledException -from danswer.llm.factory import get_default_llms -from danswer.llm.factory import get_llms_for_persona -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.secondary_llm_flows.chat_session_naming import ( +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.configs.constants import FileOrigin +from onyx.configs.constants import MessageType +from onyx.configs.model_configs import LITELLM_PASS_THROUGH_HEADERS +from onyx.db.chat import add_chats_to_session_from_slack_thread +from onyx.db.chat import create_chat_session +from onyx.db.chat import create_new_chat_message +from onyx.db.chat import delete_chat_session +from onyx.db.chat import duplicate_chat_session_for_user_from_slack +from onyx.db.chat import get_chat_message +from onyx.db.chat import get_chat_messages_by_session +from onyx.db.chat import get_chat_session_by_id +from onyx.db.chat import get_chat_sessions_by_user +from onyx.db.chat import get_or_create_root_message +from onyx.db.chat import set_as_latest_chat_message +from onyx.db.chat import translate_db_message_to_chat_message_detail +from onyx.db.chat import update_chat_session +from onyx.db.engine import get_session +from onyx.db.feedback import create_chat_message_feedback +from onyx.db.feedback import create_doc_retrieval_feedback +from onyx.db.models import User +from onyx.db.persona import get_persona_by_id +from onyx.document_index.document_index_utils import get_both_index_names +from onyx.document_index.factory import get_default_document_index +from onyx.file_processing.extract_file_text import docx_to_txt_filename +from onyx.file_processing.extract_file_text import extract_file_text +from onyx.file_store.file_store import get_default_file_store +from onyx.file_store.models import ChatFileType +from onyx.file_store.models import FileDescriptor +from onyx.llm.exceptions import GenAIDisabledException +from onyx.llm.factory import get_default_llms +from onyx.llm.factory import get_llms_for_persona +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.secondary_llm_flows.chat_session_naming import ( get_renamed_conversation_name, ) -from danswer.server.query_and_chat.models import ChatFeedbackRequest -from danswer.server.query_and_chat.models import ChatMessageIdentifier -from danswer.server.query_and_chat.models import ChatRenameRequest -from danswer.server.query_and_chat.models import ChatSessionCreationRequest -from danswer.server.query_and_chat.models import ChatSessionDetailResponse -from danswer.server.query_and_chat.models import ChatSessionDetails -from danswer.server.query_and_chat.models import ChatSessionsResponse -from danswer.server.query_and_chat.models import ChatSessionUpdateRequest -from danswer.server.query_and_chat.models import CreateChatMessageRequest -from danswer.server.query_and_chat.models import CreateChatSessionID -from danswer.server.query_and_chat.models import LLMOverride -from danswer.server.query_and_chat.models import PromptOverride -from danswer.server.query_and_chat.models import RenameChatSessionResponse -from danswer.server.query_and_chat.models import SearchFeedbackRequest -from danswer.server.query_and_chat.models import UpdateChatSessionThreadRequest -from danswer.server.query_and_chat.token_limit import check_token_rate_limits -from danswer.utils.headers import get_custom_tool_additional_request_headers -from danswer.utils.logger import setup_logger +from onyx.server.query_and_chat.models import ChatFeedbackRequest +from onyx.server.query_and_chat.models import ChatMessageIdentifier +from onyx.server.query_and_chat.models import ChatRenameRequest +from onyx.server.query_and_chat.models import ChatSessionCreationRequest +from onyx.server.query_and_chat.models import ChatSessionDetailResponse +from onyx.server.query_and_chat.models import ChatSessionDetails +from onyx.server.query_and_chat.models import ChatSessionsResponse +from onyx.server.query_and_chat.models import ChatSessionUpdateRequest +from onyx.server.query_and_chat.models import CreateChatMessageRequest +from onyx.server.query_and_chat.models import CreateChatSessionID +from onyx.server.query_and_chat.models import LLMOverride +from onyx.server.query_and_chat.models import PromptOverride +from onyx.server.query_and_chat.models import RenameChatSessionResponse +from onyx.server.query_and_chat.models import SearchFeedbackRequest +from onyx.server.query_and_chat.models import UpdateChatSessionThreadRequest +from onyx.server.query_and_chat.token_limit import check_token_rate_limits +from onyx.utils.headers import get_custom_tool_additional_request_headers +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/server/query_and_chat/models.py b/backend/onyx/server/query_and_chat/models.py similarity index 87% rename from backend/danswer/server/query_and_chat/models.py rename to backend/onyx/server/query_and_chat/models.py index 34ef556daff..16b7d1b061f 100644 --- a/backend/danswer/server/query_and_chat/models.py +++ b/backend/onyx/server/query_and_chat/models.py @@ -6,22 +6,22 @@ from pydantic import BaseModel from pydantic import model_validator -from danswer.chat.models import PersonaOverrideConfig -from danswer.chat.models import RetrievalDocs -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import MessageType -from danswer.configs.constants import SearchFeedbackType -from danswer.context.search.models import BaseFilters -from danswer.context.search.models import ChunkContext -from danswer.context.search.models import RerankingDetails -from danswer.context.search.models import RetrievalDetails -from danswer.context.search.models import SearchDoc -from danswer.context.search.models import Tag -from danswer.db.enums import ChatSessionSharedStatus -from danswer.file_store.models import FileDescriptor -from danswer.llm.override_models import LLMOverride -from danswer.llm.override_models import PromptOverride -from danswer.tools.models import ToolCallFinalResult +from onyx.chat.models import PersonaOverrideConfig +from onyx.chat.models import RetrievalDocs +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import MessageType +from onyx.configs.constants import SearchFeedbackType +from onyx.context.search.models import BaseFilters +from onyx.context.search.models import ChunkContext +from onyx.context.search.models import RerankingDetails +from onyx.context.search.models import RetrievalDetails +from onyx.context.search.models import SearchDoc +from onyx.context.search.models import Tag +from onyx.db.enums import ChatSessionSharedStatus +from onyx.file_store.models import FileDescriptor +from onyx.llm.override_models import LLMOverride +from onyx.llm.override_models import PromptOverride +from onyx.tools.models import ToolCallFinalResult if TYPE_CHECKING: pass @@ -36,13 +36,13 @@ class TagResponse(BaseModel): class UpdateChatSessionThreadRequest(BaseModel): - # If not specified, use Danswer default persona + # If not specified, use Onyx default persona chat_session_id: UUID new_alternate_model: str class ChatSessionCreationRequest(BaseModel): - # If not specified, use Danswer default persona + # If not specified, use Onyx default persona persona_id: int = 0 description: str | None = None diff --git a/backend/danswer/server/query_and_chat/query_backend.py b/backend/onyx/server/query_and_chat/query_backend.py similarity index 79% rename from backend/danswer/server/query_and_chat/query_backend.py rename to backend/onyx/server/query_and_chat/query_backend.py index 65e7889dd39..9d304d82356 100644 --- a/backend/danswer/server/query_and_chat/query_backend.py +++ b/backend/onyx/server/query_and_chat/query_backend.py @@ -5,37 +5,37 @@ from fastapi import HTTPException from sqlalchemy.orm import Session -from danswer.auth.users import current_curator_or_admin_user -from danswer.auth.users import current_user -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import MessageType -from danswer.context.search.models import IndexFilters -from danswer.context.search.models import SearchDoc -from danswer.context.search.preprocessing.access_filters import ( +from onyx.auth.users import current_curator_or_admin_user +from onyx.auth.users import current_user +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import MessageType +from onyx.context.search.models import IndexFilters +from onyx.context.search.models import SearchDoc +from onyx.context.search.preprocessing.access_filters import ( build_access_filters_for_user, ) -from danswer.context.search.utils import chunks_or_sections_to_search_docs -from danswer.db.chat import get_chat_messages_by_session -from danswer.db.chat import get_chat_session_by_id -from danswer.db.chat import get_chat_sessions_by_user -from danswer.db.chat import get_search_docs_for_chat_message -from danswer.db.chat import get_valid_messages_from_query_sessions -from danswer.db.chat import translate_db_message_to_chat_message_detail -from danswer.db.chat import translate_db_search_doc_to_server_search_doc -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.search_settings import get_current_search_settings -from danswer.db.tag import find_tags -from danswer.document_index.factory import get_default_document_index -from danswer.document_index.vespa.index import VespaIndex -from danswer.server.query_and_chat.models import AdminSearchRequest -from danswer.server.query_and_chat.models import AdminSearchResponse -from danswer.server.query_and_chat.models import ChatSessionDetails -from danswer.server.query_and_chat.models import ChatSessionsResponse -from danswer.server.query_and_chat.models import SearchSessionDetailResponse -from danswer.server.query_and_chat.models import SourceTag -from danswer.server.query_and_chat.models import TagResponse -from danswer.utils.logger import setup_logger +from onyx.context.search.utils import chunks_or_sections_to_search_docs +from onyx.db.chat import get_chat_messages_by_session +from onyx.db.chat import get_chat_session_by_id +from onyx.db.chat import get_chat_sessions_by_user +from onyx.db.chat import get_search_docs_for_chat_message +from onyx.db.chat import get_valid_messages_from_query_sessions +from onyx.db.chat import translate_db_message_to_chat_message_detail +from onyx.db.chat import translate_db_search_doc_to_server_search_doc +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.search_settings import get_current_search_settings +from onyx.db.tag import find_tags +from onyx.document_index.factory import get_default_document_index +from onyx.document_index.vespa.index import VespaIndex +from onyx.server.query_and_chat.models import AdminSearchRequest +from onyx.server.query_and_chat.models import AdminSearchResponse +from onyx.server.query_and_chat.models import ChatSessionDetails +from onyx.server.query_and_chat.models import ChatSessionsResponse +from onyx.server.query_and_chat.models import SearchSessionDetailResponse +from onyx.server.query_and_chat.models import SourceTag +from onyx.server.query_and_chat.models import TagResponse +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/server/query_and_chat/token_limit.py b/backend/onyx/server/query_and_chat/token_limit.py similarity index 86% rename from backend/danswer/server/query_and_chat/token_limit.py rename to backend/onyx/server/query_and_chat/token_limit.py index 0f47ef7266f..c450410f21f 100644 --- a/backend/danswer/server/query_and_chat/token_limit.py +++ b/backend/onyx/server/query_and_chat/token_limit.py @@ -11,16 +11,16 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.auth.users import current_user -from danswer.db.engine import get_session_context_manager -from danswer.db.engine import get_session_with_tenant -from danswer.db.models import ChatMessage -from danswer.db.models import ChatSession -from danswer.db.models import TokenRateLimit -from danswer.db.models import User -from danswer.db.token_limit import fetch_all_global_token_rate_limits -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_versioned_implementation +from onyx.auth.users import current_user +from onyx.db.engine import get_session_context_manager +from onyx.db.engine import get_session_with_tenant +from onyx.db.models import ChatMessage +from onyx.db.models import ChatSession +from onyx.db.models import TokenRateLimit +from onyx.db.models import User +from onyx.db.token_limit import fetch_all_global_token_rate_limits +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_versioned_implementation from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR @@ -39,7 +39,7 @@ def check_token_rate_limits( return versioned_rate_limit_strategy = fetch_versioned_implementation( - "danswer.server.query_and_chat.token_limit", "_check_token_rate_limits" + "onyx.server.query_and_chat.token_limit", "_check_token_rate_limits" ) return versioned_rate_limit_strategy(user, CURRENT_TENANT_ID_CONTEXTVAR.get()) diff --git a/backend/danswer/server/settings/api.py b/backend/onyx/server/settings/api.py similarity index 77% rename from backend/danswer/server/settings/api.py rename to backend/onyx/server/settings/api.py index c453c2fb51e..d748ceb096a 100644 --- a/backend/danswer/server/settings/api.py +++ b/backend/onyx/server/settings/api.py @@ -5,25 +5,25 @@ from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.auth.users import current_user -from danswer.auth.users import is_user_admin -from danswer.configs.constants import KV_REINDEX_KEY -from danswer.configs.constants import NotificationType -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.notification import create_notification -from danswer.db.notification import dismiss_all_notifications -from danswer.db.notification import get_notifications -from danswer.db.notification import update_notification_last_shown -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.server.settings.models import Notification -from danswer.server.settings.models import Settings -from danswer.server.settings.models import UserSettings -from danswer.server.settings.store import load_settings -from danswer.server.settings.store import store_settings -from danswer.utils.logger import setup_logger +from onyx.auth.users import current_admin_user +from onyx.auth.users import current_user +from onyx.auth.users import is_user_admin +from onyx.configs.constants import KV_REINDEX_KEY +from onyx.configs.constants import NotificationType +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.notification import create_notification +from onyx.db.notification import dismiss_all_notifications +from onyx.db.notification import get_notifications +from onyx.db.notification import update_notification_last_shown +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.server.settings.models import Notification +from onyx.server.settings.models import Settings +from onyx.server.settings.models import UserSettings +from onyx.server.settings.store import load_settings +from onyx.server.settings.store import store_settings +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/server/settings/models.py b/backend/onyx/server/settings/models.py similarity index 91% rename from backend/danswer/server/settings/models.py rename to backend/onyx/server/settings/models.py index 55571536d4e..7f0e03ffe11 100644 --- a/backend/danswer/server/settings/models.py +++ b/backend/onyx/server/settings/models.py @@ -3,8 +3,8 @@ from pydantic import BaseModel -from danswer.configs.constants import NotificationType -from danswer.db.models import Notification as NotificationDBModel +from onyx.configs.constants import NotificationType +from onyx.db.models import Notification as NotificationDBModel class PageType(str, Enum): diff --git a/backend/danswer/server/settings/store.py b/backend/onyx/server/settings/store.py similarity index 67% rename from backend/danswer/server/settings/store.py rename to backend/onyx/server/settings/store.py index c3875c6aecb..17a2dd8a9f2 100644 --- a/backend/danswer/server/settings/store.py +++ b/backend/onyx/server/settings/store.py @@ -1,9 +1,9 @@ from typing import cast -from danswer.configs.constants import KV_SETTINGS_KEY -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.server.settings.models import Settings +from onyx.configs.constants import KV_SETTINGS_KEY +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.server.settings.models import Settings def load_settings() -> Settings: diff --git a/backend/danswer/server/token_rate_limits/api.py b/backend/onyx/server/token_rate_limits/api.py similarity index 76% rename from backend/danswer/server/token_rate_limits/api.py rename to backend/onyx/server/token_rate_limits/api.py index 16755e06e7d..d50ec2cf156 100644 --- a/backend/danswer/server/token_rate_limits/api.py +++ b/backend/onyx/server/token_rate_limits/api.py @@ -2,16 +2,16 @@ from fastapi import Depends from sqlalchemy.orm import Session -from danswer.auth.users import current_admin_user -from danswer.db.engine import get_session -from danswer.db.models import User -from danswer.db.token_limit import delete_token_rate_limit -from danswer.db.token_limit import fetch_all_global_token_rate_limits -from danswer.db.token_limit import insert_global_token_rate_limit -from danswer.db.token_limit import update_token_rate_limit -from danswer.server.query_and_chat.token_limit import any_rate_limit_exists -from danswer.server.token_rate_limits.models import TokenRateLimitArgs -from danswer.server.token_rate_limits.models import TokenRateLimitDisplay +from onyx.auth.users import current_admin_user +from onyx.db.engine import get_session +from onyx.db.models import User +from onyx.db.token_limit import delete_token_rate_limit +from onyx.db.token_limit import fetch_all_global_token_rate_limits +from onyx.db.token_limit import insert_global_token_rate_limit +from onyx.db.token_limit import update_token_rate_limit +from onyx.server.query_and_chat.token_limit import any_rate_limit_exists +from onyx.server.token_rate_limits.models import TokenRateLimitArgs +from onyx.server.token_rate_limits.models import TokenRateLimitDisplay router = APIRouter(prefix="/admin/token-rate-limits") diff --git a/backend/danswer/server/token_rate_limits/models.py b/backend/onyx/server/token_rate_limits/models.py similarity index 92% rename from backend/danswer/server/token_rate_limits/models.py rename to backend/onyx/server/token_rate_limits/models.py index 351abe92e7e..78ae312e340 100644 --- a/backend/danswer/server/token_rate_limits/models.py +++ b/backend/onyx/server/token_rate_limits/models.py @@ -1,6 +1,6 @@ from pydantic import BaseModel -from danswer.db.models import TokenRateLimit +from onyx.db.models import TokenRateLimit class TokenRateLimitArgs(BaseModel): diff --git a/backend/danswer/server/utils.py b/backend/onyx/server/utils.py similarity index 65% rename from backend/danswer/server/utils.py rename to backend/onyx/server/utils.py index 4170faf2975..82f31ec2870 100644 --- a/backend/danswer/server/utils.py +++ b/backend/onyx/server/utils.py @@ -9,15 +9,12 @@ from fastapi import HTTPException from fastapi import status -from danswer.configs.app_configs import SMTP_PASS -from danswer.configs.app_configs import SMTP_PORT -from danswer.configs.app_configs import SMTP_SERVER -from danswer.configs.app_configs import SMTP_USER -from danswer.configs.app_configs import WEB_DOMAIN -from danswer.connectors.google_utils.shared_constants import ( - DB_CREDENTIALS_AUTHENTICATION_METHOD, -) -from danswer.db.models import User +from onyx.configs.app_configs import SMTP_PASS +from onyx.configs.app_configs import SMTP_PORT +from onyx.configs.app_configs import SMTP_SERVER +from onyx.configs.app_configs import SMTP_USER +from onyx.configs.app_configs import WEB_DOMAIN +from onyx.db.models import User class BasicAuthenticationError(HTTPException): @@ -57,26 +54,19 @@ def mask_string(sensitive_str: str) -> str: def mask_credential_dict(credential_dict: dict[str, Any]) -> dict[str, str]: masked_creds = {} for key, val in credential_dict.items(): - if isinstance(val, str): - # we want to pass the authentication_method field through so the frontend - # can disambiguate credentials created by different methods - if key == DB_CREDENTIALS_AUTHENTICATION_METHOD: - masked_creds[key] = val - else: - masked_creds[key] = mask_string(val) - continue - - raise ValueError( - f"Unable to mask credentials of type other than string, cannot process request." - f"Recieved type: {type(val)}" - ) + if not isinstance(val, str): + raise ValueError( + f"Unable to mask credentials of type other than string, cannot process request." + f"Recieved type: {type(val)}" + ) + masked_creds[key] = mask_string(val) return masked_creds def send_user_email_invite(user_email: str, current_user: User) -> None: msg = MIMEMultipart() - msg["Subject"] = "Invitation to Join Danswer Workspace" + msg["Subject"] = "Invitation to Join Onyx Workspace" msg["From"] = current_user.email msg["To"] = user_email @@ -84,14 +74,14 @@ def send_user_email_invite(user_email: str, current_user: User) -> None: f"""\ Hello, - You have been invited to join a workspace on Danswer. + You have been invited to join a workspace on Onyx. To join the workspace, please visit the following link: {WEB_DOMAIN}/auth/login Best regards, - The Danswer Team + The Onyx Team """ ) diff --git a/backend/danswer/setup.py b/backend/onyx/setup.py similarity index 78% rename from backend/danswer/setup.py rename to backend/onyx/setup.py index db9cdce85d1..b0c6e6453d6 100644 --- a/backend/danswer/setup.py +++ b/backend/onyx/setup.py @@ -2,53 +2,52 @@ from sqlalchemy.orm import Session -from danswer.configs.app_configs import DISABLE_INDEX_UPDATE_ON_SWAP -from danswer.configs.app_configs import MANAGED_VESPA -from danswer.configs.app_configs import VESPA_NUM_ATTEMPTS_ON_STARTUP -from danswer.configs.constants import KV_REINDEX_KEY -from danswer.configs.constants import KV_SEARCH_SETTINGS -from danswer.configs.model_configs import FAST_GEN_AI_MODEL_VERSION -from danswer.configs.model_configs import GEN_AI_API_KEY -from danswer.configs.model_configs import GEN_AI_MODEL_VERSION -from danswer.context.search.models import SavedSearchSettings -from danswer.context.search.retrieval.search_runner import download_nltk_data -from danswer.db.connector import check_connectors_exist -from danswer.db.connector import create_initial_default_connector -from danswer.db.connector_credential_pair import associate_default_cc_pair -from danswer.db.connector_credential_pair import get_connector_credential_pairs -from danswer.db.connector_credential_pair import resync_cc_pair -from danswer.db.credentials import create_initial_public_credential -from danswer.db.document import check_docs_exist -from danswer.db.index_attempt import cancel_indexing_attempts_past_model -from danswer.db.index_attempt import expire_index_attempts -from danswer.db.llm import fetch_default_provider -from danswer.db.llm import update_default_provider -from danswer.db.llm import upsert_llm_provider -from danswer.db.persona import delete_old_default_personas -from danswer.db.search_settings import get_current_search_settings -from danswer.db.search_settings import get_secondary_search_settings -from danswer.db.search_settings import update_current_search_settings -from danswer.db.search_settings import update_secondary_search_settings -from danswer.db.swap_index import check_index_swap -from danswer.document_index.factory import get_default_document_index -from danswer.document_index.interfaces import DocumentIndex -from danswer.document_index.vespa.index import VespaIndex -from danswer.indexing.models import IndexingSetting -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError -from danswer.natural_language_processing.search_nlp_models import EmbeddingModel -from danswer.natural_language_processing.search_nlp_models import warm_up_bi_encoder -from danswer.natural_language_processing.search_nlp_models import warm_up_cross_encoder -from danswer.seeding.load_docs import seed_initial_documents -from danswer.seeding.load_yamls import load_chat_yamls -from danswer.server.manage.llm.models import LLMProviderUpsertRequest -from danswer.server.settings.store import load_settings -from danswer.server.settings.store import store_settings -from danswer.tools.built_in_tools import auto_add_search_tool_to_personas -from danswer.tools.built_in_tools import load_builtin_tools -from danswer.tools.built_in_tools import refresh_built_in_tools_cache -from danswer.utils.gpu_utils import gpu_status_request -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import DISABLE_INDEX_UPDATE_ON_SWAP +from onyx.configs.app_configs import MANAGED_VESPA +from onyx.configs.app_configs import VESPA_NUM_ATTEMPTS_ON_STARTUP +from onyx.configs.constants import KV_REINDEX_KEY +from onyx.configs.constants import KV_SEARCH_SETTINGS +from onyx.configs.model_configs import FAST_GEN_AI_MODEL_VERSION +from onyx.configs.model_configs import GEN_AI_API_KEY +from onyx.configs.model_configs import GEN_AI_MODEL_VERSION +from onyx.context.search.models import SavedSearchSettings +from onyx.context.search.retrieval.search_runner import download_nltk_data +from onyx.db.connector import check_connectors_exist +from onyx.db.connector import create_initial_default_connector +from onyx.db.connector_credential_pair import associate_default_cc_pair +from onyx.db.connector_credential_pair import get_connector_credential_pairs +from onyx.db.connector_credential_pair import resync_cc_pair +from onyx.db.credentials import create_initial_public_credential +from onyx.db.document import check_docs_exist +from onyx.db.index_attempt import cancel_indexing_attempts_past_model +from onyx.db.index_attempt import expire_index_attempts +from onyx.db.llm import fetch_default_provider +from onyx.db.llm import update_default_provider +from onyx.db.llm import upsert_llm_provider +from onyx.db.persona import delete_old_default_personas +from onyx.db.search_settings import get_current_search_settings +from onyx.db.search_settings import get_secondary_search_settings +from onyx.db.search_settings import update_current_search_settings +from onyx.db.search_settings import update_secondary_search_settings +from onyx.db.swap_index import check_index_swap +from onyx.document_index.factory import get_default_document_index +from onyx.document_index.interfaces import DocumentIndex +from onyx.document_index.vespa.index import VespaIndex +from onyx.indexing.models import IndexingSetting +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.natural_language_processing.search_nlp_models import EmbeddingModel +from onyx.natural_language_processing.search_nlp_models import warm_up_bi_encoder +from onyx.natural_language_processing.search_nlp_models import warm_up_cross_encoder +from onyx.seeding.load_yamls import load_chat_yamls +from onyx.server.manage.llm.models import LLMProviderUpsertRequest +from onyx.server.settings.store import load_settings +from onyx.server.settings.store import store_settings +from onyx.tools.built_in_tools import auto_add_search_tool_to_personas +from onyx.tools.built_in_tools import load_builtin_tools +from onyx.tools.built_in_tools import refresh_built_in_tools_cache +from onyx.utils.gpu_utils import gpu_status_request +from onyx.utils.logger import setup_logger from shared_configs.configs import ALT_INDEX_SUFFIX from shared_configs.configs import MODEL_SERVER_HOST from shared_configs.configs import MODEL_SERVER_PORT @@ -60,11 +59,11 @@ logger = setup_logger() -def setup_danswer( +def setup_onyx( db_session: Session, tenant_id: str | None, cohere_enabled: bool = False ) -> None: """ - Setup Danswer for a particular tenant. In the Single Tenant case, it will set it up for the default schema + Setup Onyx for a particular tenant. In the Single Tenant case, it will set it up for the default schema on server startup. In the MT case, it will be called when the tenant is created. The Tenant Service calls the tenants/create endpoint which runs this. @@ -151,7 +150,7 @@ def setup_danswer( # update multipass indexing setting based on GPU availability update_default_multipass_indexing(db_session) - seed_initial_documents(db_session, tenant_id, cohere_enabled) + # seed_initial_documents(db_session, tenant_id, cohere_enabled) def translate_saved_search_settings(db_session: Session) -> None: @@ -325,7 +324,7 @@ def update_default_multipass_indexing(db_session: Session) -> None: ) -def setup_multitenant_danswer() -> None: +def setup_multitenant_onyx() -> None: # For Managed Vespa, the schema is sent over via the Vespa Console manually. if not MANAGED_VESPA: setup_vespa_multitenant(SUPPORTED_EMBEDDING_MODELS) diff --git a/backend/danswer/tools/base_tool.py b/backend/onyx/tools/base_tool.py similarity index 80% rename from backend/danswer/tools/base_tool.py rename to backend/onyx/tools/base_tool.py index ebacf687aab..5a434c33e34 100644 --- a/backend/danswer/tools/base_tool.py +++ b/backend/onyx/tools/base_tool.py @@ -3,16 +3,16 @@ from langchain_core.messages import HumanMessage -from danswer.llm.utils import message_to_prompt_and_imgs -from danswer.tools.tool import Tool +from onyx.llm.utils import message_to_prompt_and_imgs +from onyx.tools.tool import Tool if TYPE_CHECKING: - from danswer.chat.prompt_builder.build import AnswerPromptBuilder - from danswer.tools.tool_implementations.custom.custom_tool import ( + from onyx.chat.prompt_builder.build import AnswerPromptBuilder + from onyx.tools.tool_implementations.custom.custom_tool import ( CustomToolCallSummary, ) - from danswer.tools.message import ToolCallSummary - from danswer.tools.models import ToolResponse + from onyx.tools.message import ToolCallSummary + from onyx.tools.models import ToolResponse def build_user_message_for_non_tool_calling_llm( diff --git a/backend/danswer/tools/built_in_tools.py b/backend/onyx/tools/built_in_tools.py similarity index 93% rename from backend/danswer/tools/built_in_tools.py rename to backend/onyx/tools/built_in_tools.py index fb64381f1d0..a8ce0e10eb5 100644 --- a/backend/danswer/tools/built_in_tools.py +++ b/backend/onyx/tools/built_in_tools.py @@ -7,17 +7,17 @@ from sqlalchemy import select from sqlalchemy.orm import Session -from danswer.db.models import Persona -from danswer.db.models import Tool as ToolDBModel -from danswer.tools.tool_implementations.images.image_generation_tool import ( +from onyx.db.models import Persona +from onyx.db.models import Tool as ToolDBModel +from onyx.tools.tool_implementations.images.image_generation_tool import ( ImageGenerationTool, ) -from danswer.tools.tool_implementations.internet_search.internet_search_tool import ( +from onyx.tools.tool_implementations.internet_search.internet_search_tool import ( InternetSearchTool, ) -from danswer.tools.tool_implementations.search.search_tool import SearchTool -from danswer.tools.tool import Tool -from danswer.utils.logger import setup_logger +from onyx.tools.tool_implementations.search.search_tool import SearchTool +from onyx.tools.tool import Tool +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/tools/force.py b/backend/onyx/tools/force.py similarity index 95% rename from backend/danswer/tools/force.py rename to backend/onyx/tools/force.py index 445175f3e72..25747747e3d 100644 --- a/backend/danswer/tools/force.py +++ b/backend/onyx/tools/force.py @@ -2,7 +2,7 @@ from pydantic import BaseModel -from danswer.tools.tool import Tool +from onyx.tools.tool import Tool class ForceUseTool(BaseModel): diff --git a/backend/danswer/tools/message.py b/backend/onyx/tools/message.py similarity index 94% rename from backend/danswer/tools/message.py rename to backend/onyx/tools/message.py index b0259c29b2a..d5590111623 100644 --- a/backend/danswer/tools/message.py +++ b/backend/onyx/tools/message.py @@ -6,7 +6,7 @@ from langchain_core.messages.tool import ToolMessage from pydantic.v1 import BaseModel as BaseModel__v1 -from danswer.natural_language_processing.utils import BaseTokenizer +from onyx.natural_language_processing.utils import BaseTokenizer # Langchain has their own version of pydantic which is version 1 diff --git a/backend/danswer/tools/models.py b/backend/onyx/tools/models.py similarity index 100% rename from backend/danswer/tools/models.py rename to backend/onyx/tools/models.py diff --git a/backend/danswer/tools/tool.py b/backend/onyx/tools/tool.py similarity index 86% rename from backend/danswer/tools/tool.py rename to backend/onyx/tools/tool.py index 210a8028645..814ccd9b391 100644 --- a/backend/danswer/tools/tool.py +++ b/backend/onyx/tools/tool.py @@ -3,15 +3,15 @@ from typing import Any from typing import TYPE_CHECKING -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.utils.special_types import JSON_ro +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.utils.special_types import JSON_ro if TYPE_CHECKING: - from danswer.chat.prompt_builder.build import AnswerPromptBuilder - from danswer.tools.message import ToolCallSummary - from danswer.tools.models import ToolResponse + from onyx.chat.prompt_builder.build import AnswerPromptBuilder + from onyx.tools.message import ToolCallSummary + from onyx.tools.models import ToolResponse class Tool(abc.ABC): diff --git a/backend/danswer/tools/tool_constructor.py b/backend/onyx/tools/tool_constructor.py similarity index 81% rename from backend/danswer/tools/tool_constructor.py rename to backend/onyx/tools/tool_constructor.py index 6f371793551..0c72d3513e0 100644 --- a/backend/danswer/tools/tool_constructor.py +++ b/backend/onyx/tools/tool_constructor.py @@ -5,44 +5,44 @@ from pydantic import Field from sqlalchemy.orm import Session -from danswer.chat.models import AnswerStyleConfig -from danswer.chat.models import CitationConfig -from danswer.chat.models import DocumentPruningConfig -from danswer.chat.models import PromptConfig -from danswer.configs.app_configs import AZURE_DALLE_API_BASE -from danswer.configs.app_configs import AZURE_DALLE_API_KEY -from danswer.configs.app_configs import AZURE_DALLE_API_VERSION -from danswer.configs.app_configs import AZURE_DALLE_DEPLOYMENT_NAME -from danswer.configs.chat_configs import BING_API_KEY -from danswer.configs.model_configs import GEN_AI_TEMPERATURE -from danswer.context.search.enums import LLMEvaluationType -from danswer.context.search.models import InferenceSection -from danswer.context.search.models import RerankingDetails -from danswer.context.search.models import RetrievalDetails -from danswer.db.llm import fetch_existing_llm_providers -from danswer.db.models import Persona -from danswer.db.models import User -from danswer.file_store.models import InMemoryChatFile -from danswer.llm.interfaces import LLM -from danswer.llm.interfaces import LLMConfig -from danswer.natural_language_processing.utils import get_tokenizer -from danswer.tools.built_in_tools import get_built_in_tool_by_id -from danswer.tools.models import DynamicSchemaInfo -from danswer.tools.tool import Tool -from danswer.tools.tool_implementations.custom.custom_tool import ( +from onyx.chat.models import AnswerStyleConfig +from onyx.chat.models import CitationConfig +from onyx.chat.models import DocumentPruningConfig +from onyx.chat.models import PromptConfig +from onyx.configs.app_configs import AZURE_DALLE_API_BASE +from onyx.configs.app_configs import AZURE_DALLE_API_KEY +from onyx.configs.app_configs import AZURE_DALLE_API_VERSION +from onyx.configs.app_configs import AZURE_DALLE_DEPLOYMENT_NAME +from onyx.configs.chat_configs import BING_API_KEY +from onyx.configs.model_configs import GEN_AI_TEMPERATURE +from onyx.context.search.enums import LLMEvaluationType +from onyx.context.search.models import InferenceSection +from onyx.context.search.models import RerankingDetails +from onyx.context.search.models import RetrievalDetails +from onyx.db.llm import fetch_existing_llm_providers +from onyx.db.models import Persona +from onyx.db.models import User +from onyx.file_store.models import InMemoryChatFile +from onyx.llm.interfaces import LLM +from onyx.llm.interfaces import LLMConfig +from onyx.natural_language_processing.utils import get_tokenizer +from onyx.tools.built_in_tools import get_built_in_tool_by_id +from onyx.tools.models import DynamicSchemaInfo +from onyx.tools.tool import Tool +from onyx.tools.tool_implementations.custom.custom_tool import ( build_custom_tools_from_openapi_schema_and_headers, ) -from danswer.tools.tool_implementations.images.image_generation_tool import ( +from onyx.tools.tool_implementations.images.image_generation_tool import ( ImageGenerationTool, ) -from danswer.tools.tool_implementations.internet_search.internet_search_tool import ( +from onyx.tools.tool_implementations.internet_search.internet_search_tool import ( InternetSearchTool, ) -from danswer.tools.tool_implementations.search.search_tool import SearchTool -from danswer.tools.utils import compute_all_tool_tokens -from danswer.tools.utils import explicit_tool_calling_supported -from danswer.utils.headers import header_dict_to_header_list -from danswer.utils.logger import setup_logger +from onyx.tools.tool_implementations.search.search_tool import SearchTool +from onyx.tools.utils import compute_all_tool_tokens +from onyx.tools.utils import explicit_tool_calling_supported +from onyx.utils.headers import header_dict_to_header_list +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -109,7 +109,7 @@ class SearchToolConfig(BaseModel): chunks_below: int = 0 full_doc: bool = False latest_query_files: list[InMemoryChatFile] | None = None - # Use with care, should only be used for DanswerBot in channels with multiple users + # Use with care, should only be used for OnyxBot in channels with multiple users bypass_acl: bool = False @@ -205,7 +205,7 @@ def construct_tools( if not BING_API_KEY: raise ValueError( - "Internet search tool requires a Bing API key, please contact your Danswer admin to get it added!" + "Internet search tool requires a Bing API key, please contact your Onyx admin to get it added!" ) tool_dict[db_tool_model.id] = [ InternetSearchTool( diff --git a/backend/danswer/tools/tool_implementations/custom/base_tool_types.py b/backend/onyx/tools/tool_implementations/custom/base_tool_types.py similarity index 100% rename from backend/danswer/tools/tool_implementations/custom/base_tool_types.py rename to backend/onyx/tools/tool_implementations/custom/base_tool_types.py diff --git a/backend/danswer/tools/tool_implementations/custom/custom_tool.py b/backend/onyx/tools/tool_implementations/custom/custom_tool.py similarity index 88% rename from backend/danswer/tools/tool_implementations/custom/custom_tool.py rename to backend/onyx/tools/tool_implementations/custom/custom_tool.py index b874a2164a5..892bea97268 100644 --- a/backend/danswer/tools/tool_implementations/custom/custom_tool.py +++ b/backend/onyx/tools/tool_implementations/custom/custom_tool.py @@ -15,49 +15,49 @@ from pydantic import BaseModel from requests import JSONDecodeError -from danswer.chat.prompt_builder.build import AnswerPromptBuilder -from danswer.configs.constants import FileOrigin -from danswer.db.engine import get_session_with_default_tenant -from danswer.file_store.file_store import get_default_file_store -from danswer.file_store.models import ChatFileType -from danswer.file_store.models import InMemoryChatFile -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.tools.base_tool import BaseTool -from danswer.tools.message import ToolCallSummary -from danswer.tools.models import CHAT_SESSION_ID_PLACEHOLDER -from danswer.tools.models import DynamicSchemaInfo -from danswer.tools.models import MESSAGE_ID_PLACEHOLDER -from danswer.tools.models import ToolResponse -from danswer.tools.tool_implementations.custom.custom_tool_prompts import ( +from onyx.chat.prompt_builder.build import AnswerPromptBuilder +from onyx.configs.constants import FileOrigin +from onyx.db.engine import get_session_with_default_tenant +from onyx.file_store.file_store import get_default_file_store +from onyx.file_store.models import ChatFileType +from onyx.file_store.models import InMemoryChatFile +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.tools.base_tool import BaseTool +from onyx.tools.message import ToolCallSummary +from onyx.tools.models import CHAT_SESSION_ID_PLACEHOLDER +from onyx.tools.models import DynamicSchemaInfo +from onyx.tools.models import MESSAGE_ID_PLACEHOLDER +from onyx.tools.models import ToolResponse +from onyx.tools.tool_implementations.custom.custom_tool_prompts import ( SHOULD_USE_CUSTOM_TOOL_SYSTEM_PROMPT, ) -from danswer.tools.tool_implementations.custom.custom_tool_prompts import ( +from onyx.tools.tool_implementations.custom.custom_tool_prompts import ( SHOULD_USE_CUSTOM_TOOL_USER_PROMPT, ) -from danswer.tools.tool_implementations.custom.custom_tool_prompts import ( +from onyx.tools.tool_implementations.custom.custom_tool_prompts import ( TOOL_ARG_SYSTEM_PROMPT, ) -from danswer.tools.tool_implementations.custom.custom_tool_prompts import ( +from onyx.tools.tool_implementations.custom.custom_tool_prompts import ( TOOL_ARG_USER_PROMPT, ) -from danswer.tools.tool_implementations.custom.custom_tool_prompts import USE_TOOL -from danswer.tools.tool_implementations.custom.openapi_parsing import MethodSpec -from danswer.tools.tool_implementations.custom.openapi_parsing import ( +from onyx.tools.tool_implementations.custom.custom_tool_prompts import USE_TOOL +from onyx.tools.tool_implementations.custom.openapi_parsing import MethodSpec +from onyx.tools.tool_implementations.custom.openapi_parsing import ( openapi_to_method_specs, ) -from danswer.tools.tool_implementations.custom.openapi_parsing import openapi_to_url -from danswer.tools.tool_implementations.custom.openapi_parsing import REQUEST_BODY -from danswer.tools.tool_implementations.custom.openapi_parsing import ( +from onyx.tools.tool_implementations.custom.openapi_parsing import openapi_to_url +from onyx.tools.tool_implementations.custom.openapi_parsing import REQUEST_BODY +from onyx.tools.tool_implementations.custom.openapi_parsing import ( validate_openapi_schema, ) -from danswer.tools.tool_implementations.custom.prompt import ( +from onyx.tools.tool_implementations.custom.prompt import ( build_custom_image_generation_user_prompt, ) -from danswer.utils.headers import header_list_to_header_dict -from danswer.utils.headers import HeaderItemDict -from danswer.utils.logger import setup_logger -from danswer.utils.special_types import JSON_ro +from onyx.utils.headers import header_list_to_header_dict +from onyx.utils.headers import HeaderItemDict +from onyx.utils.logger import setup_logger +from onyx.utils.special_types import JSON_ro logger = setup_logger() diff --git a/backend/danswer/tools/tool_implementations/custom/custom_tool_prompts.py b/backend/onyx/tools/tool_implementations/custom/custom_tool_prompts.py similarity index 96% rename from backend/danswer/tools/tool_implementations/custom/custom_tool_prompts.py rename to backend/onyx/tools/tool_implementations/custom/custom_tool_prompts.py index 14e8b007ef0..8f6c6941727 100644 --- a/backend/danswer/tools/tool_implementations/custom/custom_tool_prompts.py +++ b/backend/onyx/tools/tool_implementations/custom/custom_tool_prompts.py @@ -1,4 +1,4 @@ -from danswer.prompts.constants import GENERAL_SEP_PAT +from onyx.prompts.constants import GENERAL_SEP_PAT DONT_USE_TOOL = "Don't use tool" USE_TOOL = "Use tool" diff --git a/backend/danswer/tools/tool_implementations/custom/openapi_parsing.py b/backend/onyx/tools/tool_implementations/custom/openapi_parsing.py similarity index 100% rename from backend/danswer/tools/tool_implementations/custom/openapi_parsing.py rename to backend/onyx/tools/tool_implementations/custom/openapi_parsing.py diff --git a/backend/danswer/tools/tool_implementations/custom/prompt.py b/backend/onyx/tools/tool_implementations/custom/prompt.py similarity index 81% rename from backend/danswer/tools/tool_implementations/custom/prompt.py rename to backend/onyx/tools/tool_implementations/custom/prompt.py index 9911594a917..c1c0e30b47c 100644 --- a/backend/danswer/tools/tool_implementations/custom/prompt.py +++ b/backend/onyx/tools/tool_implementations/custom/prompt.py @@ -1,8 +1,8 @@ from langchain_core.messages import HumanMessage -from danswer.file_store.models import ChatFileType -from danswer.file_store.models import InMemoryChatFile -from danswer.llm.utils import build_content_with_imgs +from onyx.file_store.models import ChatFileType +from onyx.file_store.models import InMemoryChatFile +from onyx.llm.utils import build_content_with_imgs CUSTOM_IMG_GENERATION_SUMMARY_PROMPT = """ diff --git a/backend/danswer/tools/tool_implementations/images/image_generation_tool.py b/backend/onyx/tools/tool_implementations/images/image_generation_tool.py similarity index 91% rename from backend/danswer/tools/tool_implementations/images/image_generation_tool.py rename to backend/onyx/tools/tool_implementations/images/image_generation_tool.py index d8d3d754316..7f2863bd712 100644 --- a/backend/danswer/tools/tool_implementations/images/image_generation_tool.py +++ b/backend/onyx/tools/tool_implementations/images/image_generation_tool.py @@ -8,25 +8,25 @@ from litellm import image_generation # type: ignore from pydantic import BaseModel -from danswer.chat.chat_utils import combine_message_chain -from danswer.chat.prompt_builder.build import AnswerPromptBuilder -from danswer.configs.model_configs import GEN_AI_HISTORY_CUTOFF -from danswer.configs.tool_configs import IMAGE_GENERATION_OUTPUT_FORMAT -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.llm.utils import build_content_with_imgs -from danswer.llm.utils import message_to_string -from danswer.prompts.constants import GENERAL_SEP_PAT -from danswer.tools.message import ToolCallSummary -from danswer.tools.models import ToolResponse -from danswer.tools.tool import Tool -from danswer.tools.tool_implementations.images.prompt import ( +from onyx.chat.chat_utils import combine_message_chain +from onyx.chat.prompt_builder.build import AnswerPromptBuilder +from onyx.configs.model_configs import GEN_AI_HISTORY_CUTOFF +from onyx.configs.tool_configs import IMAGE_GENERATION_OUTPUT_FORMAT +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.llm.utils import build_content_with_imgs +from onyx.llm.utils import message_to_string +from onyx.prompts.constants import GENERAL_SEP_PAT +from onyx.tools.message import ToolCallSummary +from onyx.tools.models import ToolResponse +from onyx.tools.tool import Tool +from onyx.tools.tool_implementations.images.prompt import ( build_image_generation_user_prompt, ) -from danswer.utils.headers import build_llm_extra_headers -from danswer.utils.logger import setup_logger -from danswer.utils.special_types import JSON_ro -from danswer.utils.threadpool_concurrency import run_functions_tuples_in_parallel +from onyx.utils.headers import build_llm_extra_headers +from onyx.utils.logger import setup_logger +from onyx.utils.special_types import JSON_ro +from onyx.utils.threadpool_concurrency import run_functions_tuples_in_parallel logger = setup_logger() diff --git a/backend/danswer/tools/tool_implementations/images/prompt.py b/backend/onyx/tools/tool_implementations/images/prompt.py similarity index 92% rename from backend/danswer/tools/tool_implementations/images/prompt.py rename to backend/onyx/tools/tool_implementations/images/prompt.py index e5f11ba62d1..c5bd7928c19 100644 --- a/backend/danswer/tools/tool_implementations/images/prompt.py +++ b/backend/onyx/tools/tool_implementations/images/prompt.py @@ -1,6 +1,6 @@ from langchain_core.messages import HumanMessage -from danswer.llm.utils import build_content_with_imgs +from onyx.llm.utils import build_content_with_imgs IMG_GENERATION_SUMMARY_PROMPT = """ diff --git a/backend/danswer/tools/tool_implementations/internet_search/internet_search_tool.py b/backend/onyx/tools/tool_implementations/internet_search/internet_search_tool.py similarity index 85% rename from backend/danswer/tools/tool_implementations/internet_search/internet_search_tool.py rename to backend/onyx/tools/tool_implementations/internet_search/internet_search_tool.py index cdd52f7633d..0229eef4a5c 100644 --- a/backend/danswer/tools/tool_implementations/internet_search/internet_search_tool.py +++ b/backend/onyx/tools/tool_implementations/internet_search/internet_search_tool.py @@ -6,37 +6,37 @@ import httpx -from danswer.chat.chat_utils import combine_message_chain -from danswer.chat.models import AnswerStyleConfig -from danswer.chat.models import LlmDoc -from danswer.chat.models import PromptConfig -from danswer.chat.prompt_builder.build import AnswerPromptBuilder -from danswer.configs.constants import DocumentSource -from danswer.configs.model_configs import GEN_AI_HISTORY_CUTOFF -from danswer.context.search.models import SearchDoc -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.llm.utils import message_to_string -from danswer.prompts.chat_prompts import INTERNET_SEARCH_QUERY_REPHRASE -from danswer.prompts.constants import GENERAL_SEP_PAT -from danswer.secondary_llm_flows.query_expansion import history_based_query_rephrase -from danswer.tools.message import ToolCallSummary -from danswer.tools.models import ToolResponse -from danswer.tools.tool import Tool -from danswer.tools.tool_implementations.internet_search.models import ( +from onyx.chat.chat_utils import combine_message_chain +from onyx.chat.models import AnswerStyleConfig +from onyx.chat.models import LlmDoc +from onyx.chat.models import PromptConfig +from onyx.chat.prompt_builder.build import AnswerPromptBuilder +from onyx.configs.constants import DocumentSource +from onyx.configs.model_configs import GEN_AI_HISTORY_CUTOFF +from onyx.context.search.models import SearchDoc +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.llm.utils import message_to_string +from onyx.prompts.chat_prompts import INTERNET_SEARCH_QUERY_REPHRASE +from onyx.prompts.constants import GENERAL_SEP_PAT +from onyx.secondary_llm_flows.query_expansion import history_based_query_rephrase +from onyx.tools.message import ToolCallSummary +from onyx.tools.models import ToolResponse +from onyx.tools.tool import Tool +from onyx.tools.tool_implementations.internet_search.models import ( InternetSearchResponse, ) -from danswer.tools.tool_implementations.internet_search.models import ( +from onyx.tools.tool_implementations.internet_search.models import ( InternetSearchResult, ) -from danswer.tools.tool_implementations.search_like_tool_utils import ( +from onyx.tools.tool_implementations.search_like_tool_utils import ( build_next_prompt_for_search_like_tool, ) -from danswer.tools.tool_implementations.search_like_tool_utils import ( +from onyx.tools.tool_implementations.search_like_tool_utils import ( FINAL_CONTEXT_DOCUMENTS_ID, ) -from danswer.utils.logger import setup_logger -from danswer.utils.special_types import JSON_ro +from onyx.utils.logger import setup_logger +from onyx.utils.special_types import JSON_ro logger = setup_logger() diff --git a/backend/danswer/tools/tool_implementations/internet_search/models.py b/backend/onyx/tools/tool_implementations/internet_search/models.py similarity index 100% rename from backend/danswer/tools/tool_implementations/internet_search/models.py rename to backend/onyx/tools/tool_implementations/internet_search/models.py diff --git a/backend/danswer/tools/tool_implementations/search/search_tool.py b/backend/onyx/tools/tool_implementations/search/search_tool.py similarity index 84% rename from backend/danswer/tools/tool_implementations/search/search_tool.py rename to backend/onyx/tools/tool_implementations/search/search_tool.py index a0c686bd6cf..368111ca46f 100644 --- a/backend/danswer/tools/tool_implementations/search/search_tool.py +++ b/backend/onyx/tools/tool_implementations/search/search_tool.py @@ -6,53 +6,53 @@ from pydantic import BaseModel from sqlalchemy.orm import Session -from danswer.chat.chat_utils import llm_doc_from_inference_section -from danswer.chat.llm_response_handler import LLMCall -from danswer.chat.models import AnswerStyleConfig -from danswer.chat.models import ContextualPruningConfig -from danswer.chat.models import DanswerContext -from danswer.chat.models import DanswerContexts -from danswer.chat.models import DocumentPruningConfig -from danswer.chat.models import LlmDoc -from danswer.chat.models import PromptConfig -from danswer.chat.models import SectionRelevancePiece -from danswer.chat.prompt_builder.build import AnswerPromptBuilder -from danswer.chat.prompt_builder.citations_prompt import compute_max_llm_input_tokens -from danswer.chat.prune_and_merge import prune_and_merge_sections -from danswer.chat.prune_and_merge import prune_sections -from danswer.configs.chat_configs import CONTEXT_CHUNKS_ABOVE -from danswer.configs.chat_configs import CONTEXT_CHUNKS_BELOW -from danswer.configs.model_configs import GEN_AI_MODEL_FALLBACK_MAX_TOKENS -from danswer.context.search.enums import LLMEvaluationType -from danswer.context.search.enums import QueryFlow -from danswer.context.search.enums import SearchType -from danswer.context.search.models import IndexFilters -from danswer.context.search.models import InferenceSection -from danswer.context.search.models import RerankingDetails -from danswer.context.search.models import RetrievalDetails -from danswer.context.search.models import SearchRequest -from danswer.context.search.pipeline import SearchPipeline -from danswer.db.models import Persona -from danswer.db.models import User -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.secondary_llm_flows.choose_search import check_if_need_search -from danswer.secondary_llm_flows.query_expansion import history_based_query_rephrase -from danswer.tools.message import ToolCallSummary -from danswer.tools.models import ToolResponse -from danswer.tools.tool import Tool -from danswer.tools.tool_implementations.search.search_utils import llm_doc_to_dict -from danswer.tools.tool_implementations.search_like_tool_utils import ( +from onyx.chat.chat_utils import llm_doc_from_inference_section +from onyx.chat.llm_response_handler import LLMCall +from onyx.chat.models import AnswerStyleConfig +from onyx.chat.models import ContextualPruningConfig +from onyx.chat.models import DocumentPruningConfig +from onyx.chat.models import LlmDoc +from onyx.chat.models import OnyxContext +from onyx.chat.models import OnyxContexts +from onyx.chat.models import PromptConfig +from onyx.chat.models import SectionRelevancePiece +from onyx.chat.prompt_builder.build import AnswerPromptBuilder +from onyx.chat.prompt_builder.citations_prompt import compute_max_llm_input_tokens +from onyx.chat.prune_and_merge import prune_and_merge_sections +from onyx.chat.prune_and_merge import prune_sections +from onyx.configs.chat_configs import CONTEXT_CHUNKS_ABOVE +from onyx.configs.chat_configs import CONTEXT_CHUNKS_BELOW +from onyx.configs.model_configs import GEN_AI_MODEL_FALLBACK_MAX_TOKENS +from onyx.context.search.enums import LLMEvaluationType +from onyx.context.search.enums import QueryFlow +from onyx.context.search.enums import SearchType +from onyx.context.search.models import IndexFilters +from onyx.context.search.models import InferenceSection +from onyx.context.search.models import RerankingDetails +from onyx.context.search.models import RetrievalDetails +from onyx.context.search.models import SearchRequest +from onyx.context.search.pipeline import SearchPipeline +from onyx.db.models import Persona +from onyx.db.models import User +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.secondary_llm_flows.choose_search import check_if_need_search +from onyx.secondary_llm_flows.query_expansion import history_based_query_rephrase +from onyx.tools.message import ToolCallSummary +from onyx.tools.models import ToolResponse +from onyx.tools.tool import Tool +from onyx.tools.tool_implementations.search.search_utils import llm_doc_to_dict +from onyx.tools.tool_implementations.search_like_tool_utils import ( build_next_prompt_for_search_like_tool, ) -from danswer.tools.tool_implementations.search_like_tool_utils import ( +from onyx.tools.tool_implementations.search_like_tool_utils import ( FINAL_CONTEXT_DOCUMENTS_ID, ) -from danswer.tools.tool_implementations.search_like_tool_utils import ( +from onyx.tools.tool_implementations.search_like_tool_utils import ( ORIGINAL_CONTEXT_DOCUMENTS_ID, ) -from danswer.utils.logger import setup_logger -from danswer.utils.special_types import JSON_ro +from onyx.utils.logger import setup_logger +from onyx.utils.special_types import JSON_ro logger = setup_logger() @@ -332,9 +332,9 @@ def run(self, **kwargs: str) -> Generator[ToolResponse, None, None]: yield ToolResponse( id=SEARCH_DOC_CONTENT_ID, - response=DanswerContexts( + response=OnyxContexts( contexts=[ - DanswerContext( + OnyxContext( content=section.combined_content, document_id=section.center_chunk.document_id, semantic_identifier=section.center_chunk.semantic_identifier, diff --git a/backend/danswer/tools/tool_implementations/search/search_utils.py b/backend/onyx/tools/tool_implementations/search/search_utils.py similarity index 86% rename from backend/danswer/tools/tool_implementations/search/search_utils.py rename to backend/onyx/tools/tool_implementations/search/search_utils.py index 5eef0b891f0..dd44ca0338d 100644 --- a/backend/danswer/tools/tool_implementations/search/search_utils.py +++ b/backend/onyx/tools/tool_implementations/search/search_utils.py @@ -1,6 +1,6 @@ -from danswer.chat.models import LlmDoc -from danswer.context.search.models import InferenceSection -from danswer.prompts.prompt_utils import clean_up_source +from onyx.chat.models import LlmDoc +from onyx.context.search.models import InferenceSection +from onyx.prompts.prompt_utils import clean_up_source def llm_doc_to_dict(llm_doc: LlmDoc, doc_num: int) -> dict: diff --git a/backend/danswer/tools/tool_implementations/search_like_tool_utils.py b/backend/onyx/tools/tool_implementations/search_like_tool_utils.py similarity index 82% rename from backend/danswer/tools/tool_implementations/search_like_tool_utils.py rename to backend/onyx/tools/tool_implementations/search_like_tool_utils.py index 7edb22fc144..44dc8f2c33c 100644 --- a/backend/danswer/tools/tool_implementations/search_like_tool_utils.py +++ b/backend/onyx/tools/tool_implementations/search_like_tool_utils.py @@ -2,17 +2,17 @@ from langchain_core.messages import HumanMessage -from danswer.chat.models import AnswerStyleConfig -from danswer.chat.models import LlmDoc -from danswer.chat.models import PromptConfig -from danswer.chat.prompt_builder.build import AnswerPromptBuilder -from danswer.chat.prompt_builder.citations_prompt import ( +from onyx.chat.models import AnswerStyleConfig +from onyx.chat.models import LlmDoc +from onyx.chat.models import PromptConfig +from onyx.chat.prompt_builder.build import AnswerPromptBuilder +from onyx.chat.prompt_builder.citations_prompt import ( build_citations_system_message, ) -from danswer.chat.prompt_builder.citations_prompt import build_citations_user_message -from danswer.chat.prompt_builder.quotes_prompt import build_quotes_user_message -from danswer.tools.message import ToolCallSummary -from danswer.tools.models import ToolResponse +from onyx.chat.prompt_builder.citations_prompt import build_citations_user_message +from onyx.chat.prompt_builder.quotes_prompt import build_quotes_user_message +from onyx.tools.message import ToolCallSummary +from onyx.tools.models import ToolResponse ORIGINAL_CONTEXT_DOCUMENTS_ID = "search_doc_content" diff --git a/backend/danswer/tools/tool_runner.py b/backend/onyx/tools/tool_runner.py similarity index 82% rename from backend/danswer/tools/tool_runner.py rename to backend/onyx/tools/tool_runner.py index 55ae7022ef5..af124da4c43 100644 --- a/backend/danswer/tools/tool_runner.py +++ b/backend/onyx/tools/tool_runner.py @@ -2,13 +2,13 @@ from collections.abc import Generator from typing import Any -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.tools.models import ToolCallFinalResult -from danswer.tools.models import ToolCallKickoff -from danswer.tools.models import ToolResponse -from danswer.tools.tool import Tool -from danswer.utils.threadpool_concurrency import run_functions_tuples_in_parallel +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.tools.models import ToolCallFinalResult +from onyx.tools.models import ToolCallKickoff +from onyx.tools.models import ToolResponse +from onyx.tools.tool import Tool +from onyx.utils.threadpool_concurrency import run_functions_tuples_in_parallel class ToolRunner: diff --git a/backend/danswer/tools/tool_selection.py b/backend/onyx/tools/tool_selection.py similarity index 83% rename from backend/danswer/tools/tool_selection.py rename to backend/onyx/tools/tool_selection.py index f9fbaf9c064..c036609af64 100644 --- a/backend/danswer/tools/tool_selection.py +++ b/backend/onyx/tools/tool_selection.py @@ -1,14 +1,14 @@ import re from typing import Any -from danswer.chat.chat_utils import combine_message_chain -from danswer.configs.model_configs import GEN_AI_HISTORY_CUTOFF -from danswer.llm.interfaces import LLM -from danswer.llm.models import PreviousMessage -from danswer.llm.utils import message_to_string -from danswer.prompts.constants import GENERAL_SEP_PAT -from danswer.tools.tool import Tool -from danswer.utils.logger import setup_logger +from onyx.chat.chat_utils import combine_message_chain +from onyx.configs.model_configs import GEN_AI_HISTORY_CUTOFF +from onyx.llm.interfaces import LLM +from onyx.llm.models import PreviousMessage +from onyx.llm.utils import message_to_string +from onyx.prompts.constants import GENERAL_SEP_PAT +from onyx.tools.tool import Tool +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/tools/utils.py b/backend/onyx/tools/utils.py similarity index 78% rename from backend/danswer/tools/utils.py rename to backend/onyx/tools/utils.py index 52d60feb912..f70e6591b41 100644 --- a/backend/danswer/tools/utils.py +++ b/backend/onyx/tools/utils.py @@ -2,12 +2,12 @@ from sqlalchemy.orm import Session -from danswer.configs.app_configs import AZURE_DALLE_API_KEY -from danswer.db.connector import check_connectors_exist -from danswer.db.document import check_docs_exist -from danswer.db.models import LLMProvider -from danswer.natural_language_processing.utils import BaseTokenizer -from danswer.tools.tool import Tool +from onyx.configs.app_configs import AZURE_DALLE_API_KEY +from onyx.db.connector import check_connectors_exist +from onyx.db.document import check_docs_exist +from onyx.db.models import LLMProvider +from onyx.natural_language_processing.utils import BaseTokenizer +from onyx.tools.tool import Tool OPEN_AI_TOOL_CALLING_MODELS = { diff --git a/backend/ee/danswer/utils/__init__.py b/backend/onyx/utils/__init__.py similarity index 100% rename from backend/ee/danswer/utils/__init__.py rename to backend/onyx/utils/__init__.py diff --git a/backend/danswer/utils/b64.py b/backend/onyx/utils/b64.py similarity index 100% rename from backend/danswer/utils/b64.py rename to backend/onyx/utils/b64.py diff --git a/backend/danswer/utils/batching.py b/backend/onyx/utils/batching.py similarity index 100% rename from backend/danswer/utils/batching.py rename to backend/onyx/utils/batching.py diff --git a/backend/danswer/utils/callbacks.py b/backend/onyx/utils/callbacks.py similarity index 100% rename from backend/danswer/utils/callbacks.py rename to backend/onyx/utils/callbacks.py diff --git a/backend/danswer/utils/encryption.py b/backend/onyx/utils/encryption.py similarity index 60% rename from backend/danswer/utils/encryption.py rename to backend/onyx/utils/encryption.py index 0f21d84d092..2edea41951f 100644 --- a/backend/danswer/utils/encryption.py +++ b/backend/onyx/utils/encryption.py @@ -1,31 +1,31 @@ -from danswer.configs.app_configs import ENCRYPTION_KEY_SECRET -from danswer.utils.logger import setup_logger -from danswer.utils.variable_functionality import fetch_versioned_implementation +from onyx.configs.app_configs import ENCRYPTION_KEY_SECRET +from onyx.utils.logger import setup_logger +from onyx.utils.variable_functionality import fetch_versioned_implementation logger = setup_logger() def _encrypt_string(input_str: str) -> bytes: if ENCRYPTION_KEY_SECRET: - logger.warning("MIT version of Danswer does not support encryption of secrets.") + logger.warning("MIT version of Onyx does not support encryption of secrets.") return input_str.encode() def _decrypt_bytes(input_bytes: bytes) -> str: # No need to double warn. If you wish to learn more about encryption features - # refer to the Danswer EE code + # refer to the Onyx EE code return input_bytes.decode() def encrypt_string_to_bytes(intput_str: str) -> bytes: versioned_encryption_fn = fetch_versioned_implementation( - "danswer.utils.encryption", "_encrypt_string" + "onyx.utils.encryption", "_encrypt_string" ) return versioned_encryption_fn(intput_str) def decrypt_bytes_to_string(intput_bytes: bytes) -> str: versioned_decryption_fn = fetch_versioned_implementation( - "danswer.utils.encryption", "_decrypt_bytes" + "onyx.utils.encryption", "_decrypt_bytes" ) return versioned_decryption_fn(intput_bytes) diff --git a/backend/danswer/utils/errors.py b/backend/onyx/utils/errors.py similarity index 100% rename from backend/danswer/utils/errors.py rename to backend/onyx/utils/errors.py diff --git a/backend/danswer/utils/gpu_utils.py b/backend/onyx/utils/gpu_utils.py similarity index 95% rename from backend/danswer/utils/gpu_utils.py rename to backend/onyx/utils/gpu_utils.py index 70a3dbc2c95..75acc0232b9 100644 --- a/backend/danswer/utils/gpu_utils.py +++ b/backend/onyx/utils/gpu_utils.py @@ -1,7 +1,7 @@ import requests from retry import retry -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger from shared_configs.configs import INDEXING_MODEL_SERVER_HOST from shared_configs.configs import INDEXING_MODEL_SERVER_PORT from shared_configs.configs import MODEL_SERVER_HOST diff --git a/backend/danswer/utils/headers.py b/backend/onyx/utils/headers.py similarity index 90% rename from backend/danswer/utils/headers.py rename to backend/onyx/utils/headers.py index 5ccf61a51e1..6e67e50f1db 100644 --- a/backend/danswer/utils/headers.py +++ b/backend/onyx/utils/headers.py @@ -2,10 +2,10 @@ from fastapi.datastructures import Headers -from danswer.configs.model_configs import LITELLM_EXTRA_HEADERS -from danswer.configs.model_configs import LITELLM_PASS_THROUGH_HEADERS -from danswer.configs.tool_configs import CUSTOM_TOOL_PASS_THROUGH_HEADERS -from danswer.utils.logger import setup_logger +from onyx.configs.model_configs import LITELLM_EXTRA_HEADERS +from onyx.configs.model_configs import LITELLM_PASS_THROUGH_HEADERS +from onyx.configs.tool_configs import CUSTOM_TOOL_PASS_THROUGH_HEADERS +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/utils/logger.py b/backend/onyx/utils/logger.py similarity index 97% rename from backend/danswer/utils/logger.py rename to backend/onyx/utils/logger.py index b9c335be9c6..d4aa6c251b9 100644 --- a/backend/danswer/utils/logger.py +++ b/backend/onyx/utils/logger.py @@ -64,7 +64,7 @@ def get_log_level_from_str(log_level_str: str = LOG_LEVEL) -> int: return log_level_dict.get(log_level_str.upper(), logging.getLevelName("NOTICE")) -class DanswerLoggingAdapter(logging.LoggerAdapter): +class OnyxLoggingAdapter(logging.LoggerAdapter): def process( self, msg: str, kwargs: MutableMapping[str, Any] ) -> tuple[str, MutableMapping[str, Any]]: @@ -172,12 +172,12 @@ def setup_logger( name: str = __name__, log_level: int = get_log_level_from_str(), extra: MutableMapping[str, Any] | None = None, -) -> DanswerLoggingAdapter: +) -> OnyxLoggingAdapter: logger = logging.getLogger(name) # If the logger already has handlers, assume it was already configured and return it. if logger.handlers: - return DanswerLoggingAdapter(logger, extra=extra) + return OnyxLoggingAdapter(logger, extra=extra) logger.setLevel(log_level) @@ -218,7 +218,7 @@ def setup_logger( logger.notice = lambda msg, *args, **kwargs: logger.log(logging.getLevelName("NOTICE"), msg, *args, **kwargs) # type: ignore - return DanswerLoggingAdapter(logger, extra=extra) + return OnyxLoggingAdapter(logger, extra=extra) def print_loggers() -> None: diff --git a/backend/danswer/utils/long_term_log.py b/backend/onyx/utils/long_term_log.py similarity index 95% rename from backend/danswer/utils/long_term_log.py rename to backend/onyx/utils/long_term_log.py index 4faef454340..f9b8fdc35c6 100644 --- a/backend/danswer/utils/long_term_log.py +++ b/backend/onyx/utils/long_term_log.py @@ -5,8 +5,8 @@ from pathlib import Path from typing import Any -from danswer.utils.logger import setup_logger -from danswer.utils.special_types import JSON_ro +from onyx.utils.logger import setup_logger +from onyx.utils.special_types import JSON_ro logger = setup_logger() @@ -80,7 +80,7 @@ def record(self, message: JSON_ro, category: str = "default") -> None: ) thread.start() except Exception: - # Should never interfere with normal functions of Danswer + # Should never interfere with normal functions of Onyx pass def fetch_category( diff --git a/backend/danswer/utils/retry_wrapper.py b/backend/onyx/utils/retry_wrapper.py similarity index 95% rename from backend/danswer/utils/retry_wrapper.py rename to backend/onyx/utils/retry_wrapper.py index 2d6d79ca5eb..1d62e7dc502 100644 --- a/backend/danswer/utils/retry_wrapper.py +++ b/backend/onyx/utils/retry_wrapper.py @@ -6,7 +6,7 @@ from retry import retry -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/utils/sitemap.py b/backend/onyx/utils/sitemap.py similarity index 98% rename from backend/danswer/utils/sitemap.py rename to backend/onyx/utils/sitemap.py index 551b2bb3bf0..38a11c4a965 100644 --- a/backend/danswer/utils/sitemap.py +++ b/backend/onyx/utils/sitemap.py @@ -5,7 +5,7 @@ import requests -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/utils/special_types.py b/backend/onyx/utils/special_types.py similarity index 100% rename from backend/danswer/utils/special_types.py rename to backend/onyx/utils/special_types.py diff --git a/backend/danswer/utils/subclasses.py b/backend/onyx/utils/subclasses.py similarity index 100% rename from backend/danswer/utils/subclasses.py rename to backend/onyx/utils/subclasses.py diff --git a/backend/danswer/utils/telemetry.py b/backend/onyx/utils/telemetry.py similarity index 82% rename from backend/danswer/utils/telemetry.py rename to backend/onyx/utils/telemetry.py index f5fb23ef86f..33727cd5c2e 100644 --- a/backend/danswer/utils/telemetry.py +++ b/backend/onyx/utils/telemetry.py @@ -6,16 +6,16 @@ import requests from sqlalchemy.orm import Session -from danswer.configs.app_configs import DISABLE_TELEMETRY -from danswer.configs.app_configs import ENTERPRISE_EDITION_ENABLED -from danswer.configs.constants import KV_CUSTOMER_UUID_KEY -from danswer.configs.constants import KV_INSTANCE_DOMAIN_KEY -from danswer.db.engine import get_sqlalchemy_engine -from danswer.db.models import User -from danswer.key_value_store.factory import get_kv_store -from danswer.key_value_store.interface import KvKeyNotFoundError - -_DANSWER_TELEMETRY_ENDPOINT = "https://telemetry.danswer.ai/anonymous_telemetry" +from onyx.configs.app_configs import DISABLE_TELEMETRY +from onyx.configs.app_configs import ENTERPRISE_EDITION_ENABLED +from onyx.configs.constants import KV_CUSTOMER_UUID_KEY +from onyx.configs.constants import KV_INSTANCE_DOMAIN_KEY +from onyx.db.engine import get_sqlalchemy_engine +from onyx.db.models import User +from onyx.key_value_store.factory import get_kv_store +from onyx.key_value_store.interface import KvKeyNotFoundError + +_DANSWER_TELEMETRY_ENDPOINT = "https://telemetry.onyx.app/anonymous_telemetry" _CACHED_UUID: str | None = None _CACHED_INSTANCE_DOMAIN: str | None = None @@ -101,5 +101,5 @@ def telemetry_logic() -> None: thread = threading.Thread(target=telemetry_logic, daemon=True) thread.start() except Exception: - # Should never interfere with normal functions of Danswer + # Should never interfere with normal functions of Onyx pass diff --git a/backend/danswer/utils/text_processing.py b/backend/onyx/utils/text_processing.py similarity index 99% rename from backend/danswer/utils/text_processing.py rename to backend/onyx/utils/text_processing.py index d26b5f357fb..059d62bf34a 100644 --- a/backend/danswer/utils/text_processing.py +++ b/backend/onyx/utils/text_processing.py @@ -4,7 +4,7 @@ import string from urllib.parse import quote -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger(__name__) diff --git a/backend/danswer/utils/threadpool_concurrency.py b/backend/onyx/utils/threadpool_concurrency.py similarity index 98% rename from backend/danswer/utils/threadpool_concurrency.py rename to backend/onyx/utils/threadpool_concurrency.py index d8fc40a7d94..6628ad86286 100644 --- a/backend/danswer/utils/threadpool_concurrency.py +++ b/backend/onyx/utils/threadpool_concurrency.py @@ -6,7 +6,7 @@ from typing import Generic from typing import TypeVar -from danswer.utils.logger import setup_logger +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/danswer/utils/timing.py b/backend/onyx/utils/timing.py similarity index 94% rename from backend/danswer/utils/timing.py rename to backend/onyx/utils/timing.py index 0d4eb7a14d4..b8be85cd1fe 100644 --- a/backend/danswer/utils/timing.py +++ b/backend/onyx/utils/timing.py @@ -7,9 +7,9 @@ from typing import cast from typing import TypeVar -from danswer.utils.logger import setup_logger -from danswer.utils.telemetry import optional_telemetry -from danswer.utils.telemetry import RecordType +from onyx.utils.logger import setup_logger +from onyx.utils.telemetry import optional_telemetry +from onyx.utils.telemetry import RecordType logger = setup_logger() diff --git a/backend/danswer/utils/variable_functionality.py b/backend/onyx/utils/variable_functionality.py similarity index 94% rename from backend/danswer/utils/variable_functionality.py rename to backend/onyx/utils/variable_functionality.py index 66cb4c3582a..8d4f6be8d69 100644 --- a/backend/danswer/utils/variable_functionality.py +++ b/backend/onyx/utils/variable_functionality.py @@ -4,13 +4,13 @@ from typing import Any from typing import TypeVar -from danswer.configs.app_configs import ENTERPRISE_EDITION_ENABLED -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import ENTERPRISE_EDITION_ENABLED +from onyx.utils.logger import setup_logger logger = setup_logger() -class DanswerVersion: +class OnyxVersion: def __init__(self) -> None: self._is_ee = False @@ -21,7 +21,7 @@ def is_ee_version(self) -> bool: return self._is_ee -global_version = DanswerVersion() +global_version = OnyxVersion() def set_is_ee_based_on_env_variable() -> None: @@ -69,8 +69,8 @@ def fetch_versioned_implementation(module: str, attribute: str) -> Any: ) if is_ee: - if "ee.danswer" not in str(e): - # If it's a non Danswer related import failure, this is likely because + if "ee.onyx" not in str(e): + # If it's a non Onyx related import failure, this is likely because # a dependent library has not been installed. Should raise this failure # instead of letting the server start up raise e diff --git a/backend/scripts/add_connector_creation_script.py b/backend/scripts/add_connector_creation_script.py index 9a1944080c0..96ea6f9d967 100644 --- a/backend/scripts/add_connector_creation_script.py +++ b/backend/scripts/add_connector_creation_script.py @@ -3,9 +3,9 @@ import requests -API_SERVER_URL = "http://localhost:3000" # Adjust this to your Danswer server URL +API_SERVER_URL = "http://localhost:3000" # Adjust this to your Onyx server URL HEADERS = {"Content-Type": "application/json"} -API_KEY = "danswer-api-key" # API key here, if auth is enabled +API_KEY = "onyx-api-key" # API key here, if auth is enabled def create_connector( diff --git a/backend/scripts/api_inference_sample.py b/backend/scripts/api_inference_sample.py index 9a93fdb73dd..301c720f947 100644 --- a/backend/scripts/api_inference_sample.py +++ b/backend/scripts/api_inference_sample.py @@ -1,5 +1,5 @@ # This file is used to demonstrate how to use the backend APIs directly -# In this case, the equivalent of asking a question in Danswer Chat in a new chat session +# In this case, the equivalent of asking a question in Onyx Chat in a new chat session import argparse import json import os @@ -7,9 +7,9 @@ import requests -def create_new_chat_session(danswer_url: str, api_key: str | None) -> int: +def create_new_chat_session(onyx_url: str, api_key: str | None) -> int: headers = {"Authorization": f"Bearer {api_key}"} if api_key else None - session_endpoint = danswer_url + "/api/chat/create-chat-session" + session_endpoint = onyx_url + "/api/chat/create-chat-session" response = requests.post( session_endpoint, @@ -22,10 +22,10 @@ def create_new_chat_session(danswer_url: str, api_key: str | None) -> int: return new_session_id -def process_question(danswer_url: str, question: str, api_key: str | None) -> None: - message_endpoint = danswer_url + "/api/chat/send-message" +def process_question(onyx_url: str, question: str, api_key: str | None) -> None: + message_endpoint = onyx_url + "/api/chat/send-message" - chat_session_id = create_new_chat_session(danswer_url, api_key) + chat_session_id = create_new_chat_session(onyx_url, api_key) headers = {"Authorization": f"Bearer {api_key}"} if api_key else None @@ -65,23 +65,23 @@ def process_question(danswer_url: str, question: str, api_key: str | None) -> No if __name__ == "__main__": parser = argparse.ArgumentParser(description="Sample API Usage") parser.add_argument( - "--danswer-url", + "--onyx-url", type=str, default="http://localhost:80", - help="Danswer URL, should point to Danswer nginx.", + help="Onyx URL, should point to Onyx nginx.", ) parser.add_argument( "--test-question", type=str, - default="What is Danswer?", + default="What is Onyx?", help="Test question for new Chat Session.", ) # Not needed if Auth is disabled - # Or for Danswer MIT API key must be replaced with session cookie + # Or for Onyx MIT API key must be replaced with session cookie api_key = os.environ.get("DANSWER_API_KEY") args = parser.parse_args() process_question( - danswer_url=args.danswer_url, question=args.test_question, api_key=api_key + onyx_url=args.onyx_url, question=args.test_question, api_key=api_key ) diff --git a/backend/scripts/chat_feedback_dump.py b/backend/scripts/chat_feedback_dump.py index f0d6d3cbb37..a5889e5b7de 100644 --- a/backend/scripts/chat_feedback_dump.py +++ b/backend/scripts/chat_feedback_dump.py @@ -8,9 +8,9 @@ import requests -from danswer.server.manage.models import AllUsersResponse -from danswer.server.query_and_chat.models import ChatSessionsResponse -from ee.danswer.server.query_history.api import ChatSessionSnapshot +from ee.onyx.server.query_history.api import ChatSessionSnapshot +from onyx.server.manage.models import AllUsersResponse +from onyx.server.query_and_chat.models import ChatSessionsResponse # Configure the logger logging.basicConfig( @@ -132,9 +132,9 @@ # flow_type: SessionType -def create_new_chat_session(danswer_url: str, api_key: str | None) -> int: +def create_new_chat_session(onyx_url: str, api_key: str | None) -> int: headers = {"Authorization": f"Bearer {api_key}"} if api_key else None - session_endpoint = danswer_url + "/api/chat/create-chat-session" + session_endpoint = onyx_url + "/api/chat/create-chat-session" response = requests.get(session_endpoint, headers=headers) response.raise_for_status() @@ -143,8 +143,8 @@ def create_new_chat_session(danswer_url: str, api_key: str | None) -> int: return new_session_id -def manage_users(danswer_url: str, headers: dict[str, str] | None) -> AllUsersResponse: - endpoint = danswer_url + "/manage/users" +def manage_users(onyx_url: str, headers: dict[str, str] | None) -> AllUsersResponse: + endpoint = onyx_url + "/manage/users" response = requests.get( endpoint, @@ -157,9 +157,9 @@ def manage_users(danswer_url: str, headers: dict[str, str] | None) -> AllUsersRe def get_chat_sessions( - danswer_url: str, headers: dict[str, str] | None, user_id: UUID + onyx_url: str, headers: dict[str, str] | None, user_id: UUID ) -> ChatSessionsResponse: - endpoint = danswer_url + "/admin/chat-sessions" + endpoint = onyx_url + "/admin/chat-sessions" params: dict[str, Any] = {"user_id": user_id} response = requests.get( @@ -174,9 +174,9 @@ def get_chat_sessions( def get_session_history( - danswer_url: str, headers: dict[str, str] | None, session_id: UUID + onyx_url: str, headers: dict[str, str] | None, session_id: UUID ) -> ChatSessionSnapshot: - endpoint = danswer_url + f"/admin/chat-session-history/{session_id}" + endpoint = onyx_url + f"/admin/chat-session-history/{session_id}" response = requests.get( endpoint, @@ -188,10 +188,10 @@ def get_session_history( return sessions -def process_all_chat_feedback(danswer_url: str, api_key: str | None) -> None: +def process_all_chat_feedback(onyx_url: str, api_key: str | None) -> None: headers = {"Authorization": f"Bearer {api_key}"} if api_key else None - all_users = manage_users(danswer_url, headers) + all_users = manage_users(onyx_url, headers) if not all_users: raise RuntimeError("manage_users returned None") @@ -200,11 +200,11 @@ def process_all_chat_feedback(danswer_url: str, api_key: str | None) -> None: user_ids: list[UUID] = [user.id for user in all_users.accepted] for user_id in user_ids: - r_sessions = get_chat_sessions(danswer_url, headers, user_id) + r_sessions = get_chat_sessions(onyx_url, headers, user_id) logger.info(f"user={user_id} num_sessions={len(r_sessions.sessions)}") for session in r_sessions.sessions: try: - s = get_session_history(danswer_url, headers, session.id) + s = get_session_history(onyx_url, headers, session.id) except requests.exceptions.HTTPError: logger.exception("get_session_history failed.") @@ -224,16 +224,16 @@ def process_all_chat_feedback(danswer_url: str, api_key: str | None) -> None: "--url", type=str, default="http://localhost:8080", - help="Danswer URL, should point to Danswer nginx.", + help="Onyx URL, should point to Onyx nginx.", ) # Not needed if Auth is disabled? - # Or for Danswer MIT Edition API key must be replaced with session cookie + # Or for Onyx MIT Edition API key must be replaced with session cookie parser.add_argument( "--api-key", type=str, - help="Danswer Admin Level API key", + help="Onyx Admin Level API key", ) args = parser.parse_args() - process_all_chat_feedback(danswer_url=args.url, api_key=args.api_key) + process_all_chat_feedback(onyx_url=args.url, api_key=args.api_key) diff --git a/backend/scripts/chat_loadtest.py b/backend/scripts/chat_loadtest.py index e34cd23e6e0..72d6fc65306 100644 --- a/backend/scripts/chat_loadtest.py +++ b/backend/scripts/chat_loadtest.py @@ -1,6 +1,6 @@ """Basic Usage: -python scripts/chat_loadtest.py --api-key --url /api +python scripts/chat_loadtest.py --api-key --url /api to run from the container itself, copy this file in and run: @@ -190,12 +190,12 @@ def main() -> None: "--url", type=str, default="http://localhost:3000/api", - help="Danswer URL", + help="Onyx URL", ) parser.add_argument( "--api-key", type=str, - help="Danswer Basic/Admin Level API key", + help="Onyx Basic/Admin Level API key", ) parser.add_argument( "--concurrent", diff --git a/backend/scripts/dev_run_background_jobs.py b/backend/scripts/dev_run_background_jobs.py index 6abb5fad8a1..96f4e448a57 100644 --- a/backend/scripts/dev_run_background_jobs.py +++ b/backend/scripts/dev_run_background_jobs.py @@ -20,7 +20,7 @@ def run_jobs() -> None: cmd_worker_primary = [ "celery", "-A", - "danswer.background.celery.versioned_apps.primary", + "onyx.background.celery.versioned_apps.primary", "worker", "--pool=threads", "--concurrency=6", @@ -34,7 +34,7 @@ def run_jobs() -> None: cmd_worker_light = [ "celery", "-A", - "danswer.background.celery.versioned_apps.light", + "onyx.background.celery.versioned_apps.light", "worker", "--pool=threads", "--concurrency=16", @@ -48,7 +48,7 @@ def run_jobs() -> None: cmd_worker_heavy = [ "celery", "-A", - "danswer.background.celery.versioned_apps.heavy", + "onyx.background.celery.versioned_apps.heavy", "worker", "--pool=threads", "--concurrency=6", @@ -62,7 +62,7 @@ def run_jobs() -> None: cmd_worker_indexing = [ "celery", "-A", - "danswer.background.celery.versioned_apps.indexing", + "onyx.background.celery.versioned_apps.indexing", "worker", "--pool=threads", "--concurrency=1", @@ -75,7 +75,7 @@ def run_jobs() -> None: cmd_beat = [ "celery", "-A", - "danswer.background.celery.versioned_apps.beat", + "onyx.background.celery.versioned_apps.beat", "beat", "--loglevel=INFO", ] diff --git a/backend/scripts/document_seeding_prep.py b/backend/scripts/document_seeding_prep.py index d853b68ccb4..ab77ade8130 100644 --- a/backend/scripts/document_seeding_prep.py +++ b/backend/scripts/document_seeding_prep.py @@ -22,33 +22,33 @@ class SeedPresaveDocument(BaseModel): # This is easier than cleaning up the crawl, needs to be updated if the sites are changed overview_title = "Use Cases Overview" overview = ( - "How to leverage Danswer in your organization\n\n" - "Danswer Overview\n" - "Danswer is the AI Assistant connected to your organization's docs, apps, and people. " - "Danswer makes Generative AI more versatile for work by enabling new types of questions like " + "How to leverage Onyx in your organization\n\n" + "Onyx Overview\n" + "Onyx is the AI Assistant connected to your organization's docs, apps, and people. " + "Onyx makes Generative AI more versatile for work by enabling new types of questions like " '"What is the most common feature request we\'ve heard from customers this month". ' "Whereas other AI systems have no context of your team and are generally unhelpful with work related questions, " - "Danswer makes it possible to ask these questions in natural language and get back answers in seconds.\n\n" - "Danswer can connect to +30 different tools and the use cases are not limited to the ones in the following pages. " + "Onyx makes it possible to ask these questions in natural language and get back answers in seconds.\n\n" + "Onyx can connect to +30 different tools and the use cases are not limited to the ones in the following pages. " "The highlighted use cases are for inspiration and come from feedback gathered from our users and customers.\n\n\n" "Common Getting Started Questions:\n\n" - "Why are these docs connected in my Danswer deployment?\n" - "Answer: This is just an example of how connectors work in Danswer. You can connect up your own team's knowledge " - "and you will be able to ask questions unique to your organization. Danswer will keep all of the knowledge up to date " + "Why are these docs connected in my Onyx deployment?\n" + "Answer: This is just an example of how connectors work in Onyx. You can connect up your own team's knowledge " + "and you will be able to ask questions unique to your organization. Onyx will keep all of the knowledge up to date " "and in sync with your connected applications.\n\n" - "Is my data being sent anywhere when I connect it up to Danswer?\n" - "Answer: No! Danswer is built with data security as our highest priority. We open sourced it so our users can know " - "exactly what is going on with their data. By default all of the document processing happens within Danswer. " + "Is my data being sent anywhere when I connect it up to Onyx?\n" + "Answer: No! Onyx is built with data security as our highest priority. We open sourced it so our users can know " + "exactly what is going on with their data. By default all of the document processing happens within Onyx. " "The only time it is sent outward is for the GenAI call to generate answers.\n\n" "Where is the feature for auto sync-ing document level access permissions from all connected sources?\n" - "Answer: This falls under the Enterprise Edition set of Danswer features built on top of the MIT/community edition. " - "If you are on Danswer Cloud, you have access to them by default. If you're running it yourself, reach out to the " - "Danswer team to receive access." + "Answer: This falls under the Enterprise Edition set of Onyx features built on top of the MIT/community edition. " + "If you are on Onyx Cloud, you have access to them by default. If you're running it yourself, reach out to the " + "Onyx team to receive access." ) enterprise_search_title = "Enterprise Search" enterprise_search_1 = ( - "Value of Enterprise Search with Danswer\n\n" + "Value of Enterprise Search with Onyx\n\n" "What is Enterprise Search and why is it Important?\n" "An Enterprise Search system gives team members a single place to access all of the disparate knowledge " "of an organization. Critical information is saved across a host of channels like call transcripts with " @@ -56,7 +56,7 @@ class SeedPresaveDocument(BaseModel): "tickets, and more. As fast moving teams scale up, information gets spread out and more disorganized.\n\n" "Since it quickly becomes infeasible to check across every source, decisions get made on incomplete " "information, employee satisfaction decreases, and the most valuable members of your team are tied up " - "with constant distractions as junior teammates are unable to unblock themselves. Danswer solves this " + "with constant distractions as junior teammates are unable to unblock themselves. Onyx solves this " "problem by letting anyone on the team access all of the knowledge across your organization in a " "permissioned and secure way. Users can ask questions in natural language and get back answers and " "documents across all of the connected sources instantly.\n\n" @@ -74,15 +74,15 @@ class SeedPresaveDocument(BaseModel): enterprise_search_2 = ( "More than Search\n" "When analyzing the entire corpus of knowledge within your company is as easy as asking a question " - "in a search bar, your entire team can stay informed and up to date. Danswer also makes it trivial " + "in a search bar, your entire team can stay informed and up to date. Onyx also makes it trivial " "to identify where knowledge is well documented and where it is lacking. Team members who are centers " "of knowledge can begin to effectively document their expertise since it is no longer being thrown into " "a black hole. All of this allows the organization to achieve higher efficiency and drive business outcomes.\n\n" "With Generative AI, the entire user experience has evolved as well. For example, instead of just finding similar " - "cases for your customer support team to reference, Danswer breaks down the issue and explains it so that even " + "cases for your customer support team to reference, Onyx breaks down the issue and explains it so that even " "the most junior members can understand it. This in turn lets them give the most holistic and technically accurate " "response possible to your customers. On the other end, even the super stars of your sales team will not be able " - "to review 10 hours of transcripts before hopping on that critical call, but Danswer can easily parse through it " + "to review 10 hours of transcripts before hopping on that critical call, but Onyx can easily parse through it " "in mere seconds and give crucial context to help your team close." ) @@ -91,12 +91,12 @@ class SeedPresaveDocument(BaseModel): "Build AI Agents powered by the knowledge and workflows specific to your organization.\n\n" "Beyond Answers\n" "Agents enabled by generative AI and reasoning capable models are helping teams to automate their work. " - "Danswer is helping teams make it happen. Danswer provides out of the box user chat sessions, attaching custom tools, " + "Onyx is helping teams make it happen. Onyx provides out of the box user chat sessions, attaching custom tools, " "handling LLM reasoning, code execution, data analysis, referencing internal knowledge, and much more.\n\n" - "Danswer as a platform is not a no-code agent builder. We are made by developers for developers and this gives your " + "Onyx as a platform is not a no-code agent builder. We are made by developers for developers and this gives your " "team the full flexibility and power to create agents not constrained by blocks and simple logic paths.\n\n" "Flexibility and Extensibility\n" - "Danswer is open source and completely whitebox. This not only gives transparency to what happens within the system " + "Onyx is open source and completely whitebox. This not only gives transparency to what happens within the system " "but also means that your team can directly modify the source code to suit your unique needs." ) @@ -116,7 +116,7 @@ class SeedPresaveDocument(BaseModel): "pull requests in a code repository. The second critical component is the ability of the AI system to break down " "difficult concepts and convoluted processes into more digestible descriptions and for your team members to be able " "to chat back and forth with the system to build a better understanding.\n\n" - "Danswer takes care of both of these. The system connects up to over 30+ different applications and the knowledge is " + "Onyx takes care of both of these. The system connects up to over 30+ different applications and the knowledge is " "pulled in constantly so that the information access is always up to date." ) @@ -126,16 +126,16 @@ class SeedPresaveDocument(BaseModel): "Recall Every Detail\n" "Being able to instantly revisit every detail of any call without reading transcripts is helping Sales teams provide " "more tailored pitches, build stronger relationships, and close more deals. Instead of searching and reading through " - 'hours of transcripts in preparation for a call, your team can now ask Danswer "What specific features was ACME ' + 'hours of transcripts in preparation for a call, your team can now ask Onyx "What specific features was ACME ' "interested in seeing for the demo\". Since your team doesn't have time to read every transcript prior to a call, " - "Danswer provides a more thorough summary because it can instantly parse hundreds of pages and distill out the relevant " + "Onyx provides a more thorough summary because it can instantly parse hundreds of pages and distill out the relevant " "information. Even for fast lookups it becomes much more convenient - for example to brush up on connection building " 'topics by asking "What rapport building topic did we chat about in the last call with ACME".\n\n' "Know Every Product Update\n" "It is impossible for Sales teams to keep up with every product update. Because of this, when a prospect has a question " "that the Sales team does not know, they have no choice but to rely on the Product and Engineering orgs to get an " "authoritative answer. Not only is this distracting to the other teams, it also slows down the time to respond to the " - "prospect (and as we know, time is the biggest killer of deals). With Danswer, it is even possible to get answers live " + "prospect (and as we know, time is the biggest killer of deals). With Onyx, it is even possible to get answers live " 'on call because of how fast accessing information becomes. A question like "Have we shipped the Microsoft AD ' 'integration yet?" can now be answered in seconds meaning that prospects can get answers while on the call instead of ' "asynchronously and sales cycles are reduced as a result." @@ -146,19 +146,19 @@ class SeedPresaveDocument(BaseModel): "Double the productivity of your Ops teams like IT, HR, etc.\n\n" "Automatically Resolve Tickets\n" "Modern teams are leveraging AI to auto-resolve up to 50% of tickets. Whether it is an employee asking about benefits " - "details or how to set up the VPN for remote work, Danswer can help your team help themselves. This frees up your team to " + "details or how to set up the VPN for remote work, Onyx can help your team help themselves. This frees up your team to " "do the real impactful work of landing star candidates or improving your internal processes.\n\n" "AI Aided Onboarding\n" "One of the periods where your team needs the most help is when they're just ramping up. Instead of feeling lost in dozens " - "of new tools, Danswer gives them a single place where they can ask about anything in natural language. Whether it's how to " - "set up their work environment or what their onboarding goals are, Danswer can walk them through every step with the help " + "of new tools, Onyx gives them a single place where they can ask about anything in natural language. Whether it's how to " + "set up their work environment or what their onboarding goals are, Onyx can walk them through every step with the help " "of Generative AI. This lets your team feel more empowered and gives time back to the more seasoned members of your team to " "focus on moving the needle." ) # For simplicity, we're not adding any metadata suffix here. Generally there is none for the Web connector anyway overview_doc = SeedPresaveDocument( - url="https://docs.danswer.dev/more/use_cases/overview", + url="https://docs.onyx.app/more/use_cases/overview", title=overview_title, content=overview, title_embedding=model.encode(f"search_document: {overview_title}"), @@ -166,7 +166,7 @@ class SeedPresaveDocument(BaseModel): ) enterprise_search_doc = SeedPresaveDocument( - url="https://docs.danswer.dev/more/use_cases/enterprise_search", + url="https://docs.onyx.app/more/use_cases/enterprise_search", title=enterprise_search_title, content=enterprise_search_1, title_embedding=model.encode(f"search_document: {enterprise_search_title}"), @@ -176,7 +176,7 @@ class SeedPresaveDocument(BaseModel): ) enterprise_search_doc_2 = SeedPresaveDocument( - url="https://docs.danswer.dev/more/use_cases/enterprise_search", + url="https://docs.onyx.app/more/use_cases/enterprise_search", title=enterprise_search_title, content=enterprise_search_2, title_embedding=model.encode(f"search_document: {enterprise_search_title}"), @@ -187,7 +187,7 @@ class SeedPresaveDocument(BaseModel): ) ai_platform_doc = SeedPresaveDocument( - url="https://docs.danswer.dev/more/use_cases/ai_platform", + url="https://docs.onyx.app/more/use_cases/ai_platform", title=ai_platform_title, content=ai_platform, title_embedding=model.encode(f"search_document: {ai_platform_title}"), @@ -197,7 +197,7 @@ class SeedPresaveDocument(BaseModel): ) customer_support_doc = SeedPresaveDocument( - url="https://docs.danswer.dev/more/use_cases/customer_support", + url="https://docs.onyx.app/more/use_cases/customer_support", title=customer_support_title, content=customer_support, title_embedding=model.encode(f"search_document: {customer_support_title}"), @@ -207,7 +207,7 @@ class SeedPresaveDocument(BaseModel): ) sales_doc = SeedPresaveDocument( - url="https://docs.danswer.dev/more/use_cases/sales", + url="https://docs.onyx.app/more/use_cases/sales", title=sales_title, content=sales, title_embedding=model.encode(f"search_document: {sales_title}"), @@ -215,7 +215,7 @@ class SeedPresaveDocument(BaseModel): ) operations_doc = SeedPresaveDocument( - url="https://docs.danswer.dev/more/use_cases/operations", + url="https://docs.onyx.app/more/use_cases/operations", title=operations_title, content=operations, title_embedding=model.encode(f"search_document: {operations_title}"), @@ -236,5 +236,5 @@ class SeedPresaveDocument(BaseModel): documents_dict = [doc.model_dump() for doc in documents] -with open("./backend/danswer/seeding/initial_docs.json", "w") as json_file: +with open("./backend/onyx/seeding/initial_docs.json", "w") as json_file: json.dump(documents_dict, json_file, indent=4) diff --git a/backend/scripts/force_delete_connector_by_id.py b/backend/scripts/force_delete_connector_by_id.py index 241242f4a23..3a791c6fda7 100755 --- a/backend/scripts/force_delete_connector_by_id.py +++ b/backend/scripts/force_delete_connector_by_id.py @@ -5,7 +5,7 @@ from sqlalchemy import delete from sqlalchemy.orm import Session -from danswer.db.enums import ConnectorCredentialPairStatus +from onyx.db.enums import ConnectorCredentialPairStatus # Modify sys.path current_dir = os.path.dirname(os.path.abspath(__file__)) @@ -15,30 +15,30 @@ # pylint: disable=E402 # flake8: noqa: E402 -# Now import Danswer modules -from danswer.db.models import ( +# Now import Onyx modules +from onyx.db.models import ( DocumentSet__ConnectorCredentialPair, UserGroup__ConnectorCredentialPair, ) -from danswer.db.connector import fetch_connector_by_id -from danswer.db.document import get_documents_for_connector_credential_pair -from danswer.db.index_attempt import ( +from onyx.db.connector import fetch_connector_by_id +from onyx.db.document import get_documents_for_connector_credential_pair +from onyx.db.index_attempt import ( delete_index_attempts, cancel_indexing_attempts_for_ccpair, ) -from danswer.db.models import ConnectorCredentialPair -from danswer.document_index.interfaces import DocumentIndex -from danswer.utils.logger import setup_logger -from danswer.configs.constants import DocumentSource -from danswer.db.connector_credential_pair import ( +from onyx.db.models import ConnectorCredentialPair +from onyx.document_index.interfaces import DocumentIndex +from onyx.utils.logger import setup_logger +from onyx.configs.constants import DocumentSource +from onyx.db.connector_credential_pair import ( get_connector_credential_pair_from_id, get_connector_credential_pair, ) -from danswer.db.engine import get_session_context_manager -from danswer.document_index.factory import get_default_document_index -from danswer.file_store.file_store import get_default_file_store -from danswer.document_index.document_index_utils import get_both_index_names -from danswer.db.document import delete_documents_complete__no_commit +from onyx.db.engine import get_session_context_manager +from onyx.document_index.factory import get_default_document_index +from onyx.file_store.file_store import get_default_file_store +from onyx.document_index.document_index_utils import get_both_index_names +from onyx.db.document import delete_documents_complete__no_commit # pylint: enable=E402 # flake8: noqa: E402 @@ -128,7 +128,7 @@ def _unsafe_deletion( def _delete_connector(cc_pair_id: int, db_session: Session) -> None: user_input = input( "DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. \ - IT MAY CAUSE ISSUES with your Danswer instance! \ + IT MAY CAUSE ISSUES with your Onyx instance! \ Are you SURE you want to continue? (enter 'Y' to continue): " ) if user_input != "Y": diff --git a/backend/scripts/orphan_doc_cleanup_script.py b/backend/scripts/orphan_doc_cleanup_script.py index 4007123ca3c..da05f5d4aaf 100644 --- a/backend/scripts/orphan_doc_cleanup_script.py +++ b/backend/scripts/orphan_doc_cleanup_script.py @@ -8,11 +8,11 @@ parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(parent_dir) -from danswer.db.engine import get_session_context_manager # noqa: E402 -from danswer.db.document import delete_documents_complete__no_commit # noqa: E402 -from danswer.db.search_settings import get_current_search_settings # noqa: E402 -from danswer.document_index.vespa.index import VespaIndex # noqa: E402 -from danswer.background.celery.tasks.shared.RetryDocumentIndex import ( # noqa: E402 +from onyx.db.engine import get_session_context_manager # noqa: E402 +from onyx.db.document import delete_documents_complete__no_commit # noqa: E402 +from onyx.db.search_settings import get_current_search_settings # noqa: E402 +from onyx.document_index.vespa.index import VespaIndex # noqa: E402 +from onyx.background.celery.tasks.shared.RetryDocumentIndex import ( # noqa: E402 RetryDocumentIndex, ) diff --git a/backend/scripts/query_time_check/seed_dummy_docs.py b/backend/scripts/query_time_check/seed_dummy_docs.py index e7aa65fba76..e7a7805690f 100644 --- a/backend/scripts/query_time_check/seed_dummy_docs.py +++ b/backend/scripts/query_time_check/seed_dummy_docs.py @@ -11,16 +11,16 @@ import random from datetime import datetime -from danswer.access.models import DocumentAccess -from danswer.configs.constants import DocumentSource -from danswer.connectors.models import Document -from danswer.db.engine import get_session_context_manager -from danswer.db.search_settings import get_current_search_settings -from danswer.document_index.vespa.index import VespaIndex -from danswer.indexing.models import ChunkEmbedding -from danswer.indexing.models import DocMetadataAwareIndexChunk -from danswer.indexing.models import IndexChunk -from danswer.utils.timing import log_function_time +from onyx.access.models import DocumentAccess +from onyx.configs.constants import DocumentSource +from onyx.connectors.models import Document +from onyx.db.engine import get_session_context_manager +from onyx.db.search_settings import get_current_search_settings +from onyx.document_index.vespa.index import VespaIndex +from onyx.indexing.models import ChunkEmbedding +from onyx.indexing.models import DocMetadataAwareIndexChunk +from onyx.indexing.models import IndexChunk +from onyx.utils.timing import log_function_time from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA from shared_configs.model_server_models import Embedding diff --git a/backend/scripts/query_time_check/test_query_times.py b/backend/scripts/query_time_check/test_query_times.py index 144b2354f93..2975a46e098 100644 --- a/backend/scripts/query_time_check/test_query_times.py +++ b/backend/scripts/query_time_check/test_query_times.py @@ -4,12 +4,12 @@ import random import time -from danswer.configs.constants import DocumentSource -from danswer.configs.model_configs import DOC_EMBEDDING_DIM -from danswer.context.search.models import IndexFilters -from danswer.db.engine import get_session_context_manager -from danswer.db.search_settings import get_current_search_settings -from danswer.document_index.vespa.index import VespaIndex +from onyx.configs.constants import DocumentSource +from onyx.configs.model_configs import DOC_EMBEDDING_DIM +from onyx.context.search.models import IndexFilters +from onyx.db.engine import get_session_context_manager +from onyx.db.search_settings import get_current_search_settings +from onyx.document_index.vespa.index import VespaIndex from scripts.query_time_check.seed_dummy_docs import TOTAL_ACL_ENTRIES_PER_CATEGORY from scripts.query_time_check.seed_dummy_docs import TOTAL_DOC_SETS from shared_configs.model_server_models import Embedding diff --git a/backend/scripts/reset_indexes.py b/backend/scripts/reset_indexes.py index 1411a082499..af01b02d6e2 100644 --- a/backend/scripts/reset_indexes.py +++ b/backend/scripts/reset_indexes.py @@ -10,9 +10,9 @@ parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(parent_dir) -from danswer.configs.app_configs import DOCUMENT_INDEX_NAME # noqa: E402 -from danswer.document_index.vespa.index import DOCUMENT_ID_ENDPOINT # noqa: E402 -from danswer.utils.logger import setup_logger # noqa: E402 +from onyx.configs.app_configs import DOCUMENT_INDEX_NAME # noqa: E402 +from onyx.document_index.vespa.index import DOCUMENT_ID_ENDPOINT # noqa: E402 +from onyx.utils.logger import setup_logger # noqa: E402 logger = setup_logger() diff --git a/backend/scripts/reset_postgres.py b/backend/scripts/reset_postgres.py index 2df4646169e..b3cd71a00f3 100644 --- a/backend/scripts/reset_postgres.py +++ b/backend/scripts/reset_postgres.py @@ -4,18 +4,18 @@ import psycopg2 from sqlalchemy.orm import Session -from danswer.db.engine import get_sqlalchemy_engine +from onyx.db.engine import get_sqlalchemy_engine # makes it so `PYTHONPATH=.` is not required when running this script parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(parent_dir) -from danswer.configs.app_configs import POSTGRES_DB # noqa: E402 -from danswer.configs.app_configs import POSTGRES_HOST # noqa: E402 -from danswer.configs.app_configs import POSTGRES_PASSWORD # noqa: E402 -from danswer.configs.app_configs import POSTGRES_PORT # noqa: E402 -from danswer.configs.app_configs import POSTGRES_USER # noqa: E402 -from danswer.db.credentials import create_initial_public_credential # noqa: E402 +from onyx.configs.app_configs import POSTGRES_DB # noqa: E402 +from onyx.configs.app_configs import POSTGRES_HOST # noqa: E402 +from onyx.configs.app_configs import POSTGRES_PASSWORD # noqa: E402 +from onyx.configs.app_configs import POSTGRES_PORT # noqa: E402 +from onyx.configs.app_configs import POSTGRES_USER # noqa: E402 +from onyx.db.credentials import create_initial_public_credential # noqa: E402 def wipe_all_rows(database: str) -> None: @@ -62,11 +62,11 @@ def wipe_all_rows(database: str) -> None: if __name__ == "__main__": - print("Cleaning up all Danswer tables") + print("Cleaning up all Onyx tables") wipe_all_rows(POSTGRES_DB) with Session(get_sqlalchemy_engine(), expire_on_commit=False) as db_session: create_initial_public_credential(db_session) print("To keep data consistent, it's best to wipe the document index as well.") print( - "To be safe, it's best to restart the Danswer services (API Server and Background Tasks" + "To be safe, it's best to restart the Onyx services (API Server and Background Tasks" ) diff --git a/backend/scripts/restart_containers.sh b/backend/scripts/restart_containers.sh index 06ed606c746..adf5929c0f4 100755 --- a/backend/scripts/restart_containers.sh +++ b/backend/scripts/restart_containers.sh @@ -9,31 +9,31 @@ REDIS_VOLUME=${3:-""} # Default is empty if not provided # Stop and remove the existing containers echo "Stopping and removing existing containers..." -docker stop danswer_postgres danswer_vespa danswer_redis -docker rm danswer_postgres danswer_vespa danswer_redis +docker stop onyx_postgres onyx_vespa onyx_redis +docker rm onyx_postgres onyx_vespa onyx_redis # Start the PostgreSQL container with optional volume echo "Starting PostgreSQL container..." if [[ -n "$POSTGRES_VOLUME" ]]; then - docker run -p 5432:5432 --name danswer_postgres -e POSTGRES_PASSWORD=password -d -v $POSTGRES_VOLUME:/var/lib/postgresql/data postgres -c max_connections=250 + docker run -p 5432:5432 --name onyx_postgres -e POSTGRES_PASSWORD=password -d -v $POSTGRES_VOLUME:/var/lib/postgresql/data postgres -c max_connections=250 else - docker run -p 5432:5432 --name danswer_postgres -e POSTGRES_PASSWORD=password -d postgres -c max_connections=250 + docker run -p 5432:5432 --name onyx_postgres -e POSTGRES_PASSWORD=password -d postgres -c max_connections=250 fi # Start the Vespa container with optional volume echo "Starting Vespa container..." if [[ -n "$VESPA_VOLUME" ]]; then - docker run --detach --name danswer_vespa --hostname vespa-container --publish 8081:8081 --publish 19071:19071 -v $VESPA_VOLUME:/opt/vespa/var vespaengine/vespa:8 + docker run --detach --name onyx_vespa --hostname vespa-container --publish 8081:8081 --publish 19071:19071 -v $VESPA_VOLUME:/opt/vespa/var vespaengine/vespa:8 else - docker run --detach --name danswer_vespa --hostname vespa-container --publish 8081:8081 --publish 19071:19071 vespaengine/vespa:8 + docker run --detach --name onyx_vespa --hostname vespa-container --publish 8081:8081 --publish 19071:19071 vespaengine/vespa:8 fi # Start the Redis container with optional volume echo "Starting Redis container..." if [[ -n "$REDIS_VOLUME" ]]; then - docker run --detach --name danswer_redis --publish 6379:6379 -v $REDIS_VOLUME:/data redis + docker run --detach --name onyx_redis --publish 6379:6379 -v $REDIS_VOLUME:/data redis else - docker run --detach --name danswer_redis --publish 6379:6379 redis + docker run --detach --name onyx_redis --publish 6379:6379 redis fi # Ensure alembic runs in the correct directory diff --git a/backend/scripts/save_load_state.py b/backend/scripts/save_load_state.py index 94431e8c813..c8a8167a114 100644 --- a/backend/scripts/save_load_state.py +++ b/backend/scripts/save_load_state.py @@ -9,13 +9,13 @@ from alembic import command from alembic.config import Config -from danswer.configs.app_configs import POSTGRES_DB -from danswer.configs.app_configs import POSTGRES_HOST -from danswer.configs.app_configs import POSTGRES_PASSWORD -from danswer.configs.app_configs import POSTGRES_PORT -from danswer.configs.app_configs import POSTGRES_USER -from danswer.document_index.vespa.index import DOCUMENT_ID_ENDPOINT -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import POSTGRES_DB +from onyx.configs.app_configs import POSTGRES_HOST +from onyx.configs.app_configs import POSTGRES_PASSWORD +from onyx.configs.app_configs import POSTGRES_PORT +from onyx.configs.app_configs import POSTGRES_USER +from onyx.document_index.vespa.index import DOCUMENT_ID_ENDPOINT +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -94,25 +94,23 @@ def load_vespa(filename: str) -> None: if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Danswer checkpoint saving and loading." - ) + parser = argparse.ArgumentParser(description="Onyx checkpoint saving and loading.") parser.add_argument( - "--save", action="store_true", help="Save Danswer state to directory." + "--save", action="store_true", help="Save Onyx state to directory." ) parser.add_argument( - "--load", action="store_true", help="Load Danswer state from save directory." + "--load", action="store_true", help="Load Onyx state from save directory." ) parser.add_argument( "--postgres_container_name", type=str, - default="danswer-stack-relational_db-1", + default="onyx-stack-relational_db-1", help="Name of the postgres container to dump", ) parser.add_argument( "--checkpoint_dir", type=str, - default=os.path.join("..", "danswer_checkpoint"), + default=os.path.join("..", "onyx_checkpoint"), help="A directory to store temporary files to.", ) diff --git a/backend/scripts/sources_selection_analysis.py b/backend/scripts/sources_selection_analysis.py index b71a4eb3e67..32ee2344700 100644 --- a/backend/scripts/sources_selection_analysis.py +++ b/backend/scripts/sources_selection_analysis.py @@ -14,8 +14,8 @@ parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(parent_dir) -from danswer.configs.app_configs import DOCUMENT_INDEX_NAME # noqa: E402 -from danswer.configs.constants import SOURCE_TYPE # noqa: E402 +from onyx.configs.app_configs import DOCUMENT_INDEX_NAME # noqa: E402 +from onyx.configs.constants import SOURCE_TYPE # noqa: E402 ANALYSIS_FOLDER = f"{parent_dir}/scripts/.analysisfiles/" @@ -366,13 +366,13 @@ def prepare(self) -> bool: return False def do_request(self, query: str) -> dict: - """Request the Danswer API + """Request the Onyx API Args: query (str): A query Returns: - dict: The Danswer API response content + dict: The Onyx API response content """ cookies = {"fastapiusersauth": self._auth_cookie} if self._auth_cookie else {} @@ -391,7 +391,7 @@ def do_request(self, query: str) -> dict: if response.status_code != 200: color_output( ( - "something goes wrong while requesting the Danswer API " + "something goes wrong while requesting the Onyx API " f"for the query '{query}': {response.text}" ), model="critical", @@ -399,7 +399,7 @@ def do_request(self, query: str) -> dict: sys.exit(1) except Exception as e: color_output( - f"Unable to request the Danswer API for the query '{query}': {e}", + f"Unable to request the Onyx API for the query '{query}': {e}", model="critical", ) sys.exit(1) @@ -427,10 +427,10 @@ def get_analysis_file_content(self, filename: str) -> list[dict]: return json.load(f) def extract_content(self, contents: dict) -> dict: - """Extract the content returns by the Danswer API + """Extract the content returns by the Onyx API Args: - contents (dict): The danswer response content + contents (dict): The onyx response content Returns: dict: Data regarding the selected sources document @@ -650,7 +650,7 @@ def validate_cmd_args(args: argparse.Namespace) -> bool: type=str, default=None, help=( - "Currently, to get this script working when the Danswer Auth is " + "Currently, to get this script working when the Onyx Auth is " "enabled, you must extract from the UI your cookie 'fastapiusersauth' " "and then set it using this argument" ), @@ -685,8 +685,8 @@ def validate_cmd_args(args: argparse.Namespace) -> bool: type=int, default=3000, help=( - "The Danswer Web (not the API) port. We use the UI to forward the requests to the API. " - "It should be '3000' for local dev and '80' if Danswer runs using docker compose." + "The Onyx Web (not the API) port. We use the UI to forward the requests to the API. " + "It should be '3000' for local dev and '80' if Onyx runs using docker compose." ), ) parser.add_argument( diff --git a/backend/scripts/test-openapi-key.py b/backend/scripts/test-openapi-key.py index 8b12279ba1c..f63a46d2ea5 100644 --- a/backend/scripts/test-openapi-key.py +++ b/backend/scripts/test-openapi-key.py @@ -50,9 +50,9 @@ temperature=2, ) print(response.choices[0].message.content) - print("Success! Feel free to use this API key for Danswer.") + print("Success! Feel free to use this API key for Onyx.") except Exception: print( - "Failed, provided API key is invalid for Danswer, please address the error from OpenAI." + "Failed, provided API key is invalid for Onyx, please address the error from OpenAI." ) raise diff --git a/backend/shared_configs/configs.py b/backend/shared_configs/configs.py index 0bc34c65d2a..b5dbfa4c226 100644 --- a/backend/shared_configs/configs.py +++ b/backend/shared_configs/configs.py @@ -20,7 +20,7 @@ os.environ.get("INDEXING_MODEL_SERVER_PORT") or MODEL_SERVER_PORT ) -# Danswer custom Deep Learning Models +# Onyx custom Deep Learning Models CONNECTOR_CLASSIFIER_MODEL_REPO = "Danswer/filter-extraction-model" CONNECTOR_CLASSIFIER_MODEL_TAG = "1.0.0" INTENT_MODEL_VERSION = "danswer/hybrid-intent-token-classifier" @@ -31,7 +31,7 @@ DOC_EMBEDDING_CONTEXT_SIZE = 512 # Used to distinguish alternative indices -ALT_INDEX_SUFFIX = "__danswer_alt_index" +ALT_INDEX_SUFFIX = "__onyx_alt_index" # Used for loading defaults for automatic deployments and dev flows # For local, use: mixedbread-ai/mxbai-rerank-xsmall-v1 @@ -56,7 +56,7 @@ # The process needs to have this for the log file to write to # otherwise, it will not create additional log files -LOG_FILE_NAME = os.environ.get("LOG_FILE_NAME") or "danswer" +LOG_FILE_NAME = os.environ.get("LOG_FILE_NAME") or "onyx" # Enable generating persistent log files for local dev environments DEV_LOGGING_ENABLED = os.environ.get("DEV_LOGGING_ENABLED", "").lower() == "true" diff --git a/backend/slackbot_images/README.md b/backend/slackbot_images/README.md index bb527d676df..0a01b4e508d 100644 --- a/backend/slackbot_images/README.md +++ b/backend/slackbot_images/README.md @@ -1,3 +1,2 @@ - -This folder contains images needed by the Danswer Slack Bot. When possible, we use the images -within `web/public`, but sometimes those images do not work for the Slack Bot. +This folder contains images needed by the Onyx Slack Bot. When possible, we use the images +within `web/public`, but sometimes those images do not work for the Slack Bot. diff --git a/backend/supervisord.conf b/backend/supervisord.conf index c4a431b1e3a..1a17f5d17d0 100644 --- a/backend/supervisord.conf +++ b/backend/supervisord.conf @@ -15,7 +15,7 @@ logfile=/var/log/supervisord.log # relatively compute-light (e.g. they tend to just make a bunch of requests to # Vespa / Postgres) [program:celery_worker_primary] -command=celery -A danswer.background.celery.versioned_apps.primary worker +command=celery -A onyx.background.celery.versioned_apps.primary worker --loglevel=INFO --hostname=primary@%%n -Q celery @@ -30,7 +30,7 @@ stopasgroup=true # since this is often the bottleneck for "sync" jobs (e.g. document set syncing, # user group syncing, deletion, etc.) [program:celery_worker_light] -command=celery -A danswer.background.celery.versioned_apps.light worker +command=celery -A onyx.background.celery.versioned_apps.light worker --loglevel=INFO --hostname=light@%%n -Q vespa_metadata_sync,connector_deletion,doc_permissions_upsert @@ -42,7 +42,7 @@ startsecs=10 stopasgroup=true [program:celery_worker_heavy] -command=celery -A danswer.background.celery.versioned_apps.heavy worker +command=celery -A onyx.background.celery.versioned_apps.heavy worker --loglevel=INFO --hostname=heavy@%%n -Q connector_pruning,connector_doc_permissions_sync,connector_external_group_sync @@ -54,7 +54,7 @@ startsecs=10 stopasgroup=true [program:celery_worker_indexing] -command=celery -A danswer.background.celery.versioned_apps.indexing worker +command=celery -A onyx.background.celery.versioned_apps.indexing worker --loglevel=INFO --hostname=indexing@%%n -Q connector_indexing @@ -67,7 +67,7 @@ stopasgroup=true # Job scheduler for periodic tasks [program:celery_beat] -command=celery -A danswer.background.celery.versioned_apps.beat beat +command=celery -A onyx.background.celery.versioned_apps.beat beat stdout_logfile=/var/log/celery_beat.log stdout_logfile_maxbytes=16MB redirect_stderr=true @@ -75,11 +75,11 @@ startsecs=10 stopasgroup=true # Listens for Slack messages and responds with answers -# for all channels that the DanswerBot has been added to. +# for all channels that the OnyxBot has been added to. # If not setup, this will just fail 5 times and then stop. -# More details on setup here: https://docs.danswer.dev/slack_bot_setup +# More details on setup here: https://docs.onyx.app/slack_bot_setup [program:slack_bot] -command=python danswer/danswerbot/slack/listener.py +command=python onyx/onyxbot/slack/listener.py stdout_logfile=/var/log/slack_bot.log stdout_logfile_maxbytes=16MB redirect_stderr=true diff --git a/backend/tests/api/test_api.py b/backend/tests/api/test_api.py index 9a3571ef585..9008033536b 100644 --- a/backend/tests/api/test_api.py +++ b/backend/tests/api/test_api.py @@ -5,8 +5,8 @@ import pytest from fastapi.testclient import TestClient -from danswer.main import fetch_versioned_implementation -from danswer.utils.logger import setup_logger +from onyx.main import fetch_versioned_implementation +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -18,7 +18,7 @@ def client() -> Generator[TestClient, Any, None]: # Initialize TestClient with the FastAPI app app = fetch_versioned_implementation( - module="danswer.main", attribute="get_application" + module="onyx.main", attribute="get_application" )() client = TestClient(app) yield client diff --git a/backend/tests/daily/conftest.py b/backend/tests/daily/conftest.py index 88a74c7b4ce..e5e738d76c8 100644 --- a/backend/tests/daily/conftest.py +++ b/backend/tests/daily/conftest.py @@ -5,8 +5,8 @@ import pytest from fastapi.testclient import TestClient -from danswer.main import fetch_versioned_implementation -from danswer.utils.logger import setup_logger +from onyx.main import fetch_versioned_implementation +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -18,7 +18,7 @@ def client() -> Generator[TestClient, Any, None]: # Initialize TestClient with the FastAPI app app = fetch_versioned_implementation( - module="danswer.main", attribute="get_application" + module="onyx.main", attribute="get_application" )() client = TestClient(app) yield client diff --git a/backend/tests/daily/connectors/confluence/test_confluence_basic.py b/backend/tests/daily/connectors/confluence/test_confluence_basic.py index 4f928b91ee5..5462a66177a 100644 --- a/backend/tests/daily/connectors/confluence/test_confluence_basic.py +++ b/backend/tests/daily/connectors/confluence/test_confluence_basic.py @@ -5,7 +5,7 @@ import pytest -from danswer.connectors.confluence.connector import ConfluenceConnector +from onyx.connectors.confluence.connector import ConfluenceConnector @pytest.fixture @@ -27,7 +27,7 @@ def confluence_connector() -> ConfluenceConnector: @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_confluence_connector_basic( diff --git a/backend/tests/daily/connectors/confluence/test_confluence_permissions_basic.py b/backend/tests/daily/connectors/confluence/test_confluence_permissions_basic.py index 35d2da61cf1..0f66a993d0d 100644 --- a/backend/tests/daily/connectors/confluence/test_confluence_permissions_basic.py +++ b/backend/tests/daily/connectors/confluence/test_confluence_permissions_basic.py @@ -2,7 +2,7 @@ import pytest -from danswer.connectors.confluence.connector import ConfluenceConnector +from onyx.connectors.confluence.connector import ConfluenceConnector @pytest.fixture diff --git a/backend/tests/daily/connectors/gmail/conftest.py b/backend/tests/daily/connectors/gmail/conftest.py index 8ed2f01eb91..3855f62a076 100644 --- a/backend/tests/daily/connectors/gmail/conftest.py +++ b/backend/tests/daily/connectors/gmail/conftest.py @@ -4,20 +4,20 @@ import pytest -from danswer.connectors.gmail.connector import GmailConnector -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.gmail.connector import GmailConnector +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_AUTHENTICATION_METHOD, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_TOKEN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_PRIMARY_ADMIN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( GoogleOAuthAuthenticationMethod, ) from tests.load_env_vars import load_env_vars @@ -54,7 +54,7 @@ def parse_credentials(env_str: str) -> dict: @pytest.fixture def google_gmail_oauth_connector_factory() -> Callable[..., GmailConnector]: def _connector_factory( - primary_admin_email: str = "admin@onyx-test.com", + primary_admin_email: str = "admin@danswer-test.com", ) -> GmailConnector: print("Creating GmailConnector with OAuth credentials") connector = GmailConnector() @@ -76,7 +76,7 @@ def _connector_factory( @pytest.fixture def google_gmail_service_acct_connector_factory() -> Callable[..., GmailConnector]: def _connector_factory( - primary_admin_email: str = "admin@onyx-test.com", + primary_admin_email: str = "admin@danswer-test.com", ) -> GmailConnector: print("Creating GmailConnector with service account credentials") connector = GmailConnector() diff --git a/backend/tests/daily/connectors/gmail/test_gmail_connector.py b/backend/tests/daily/connectors/gmail/test_gmail_connector.py index 73cab1136c7..28333334cc7 100644 --- a/backend/tests/daily/connectors/gmail/test_gmail_connector.py +++ b/backend/tests/daily/connectors/gmail/test_gmail_connector.py @@ -3,9 +3,9 @@ from unittest.mock import MagicMock from unittest.mock import patch -from danswer.connectors.gmail.connector import GmailConnector -from danswer.connectors.models import Document -from danswer.connectors.models import SlimDocument +from onyx.connectors.gmail.connector import GmailConnector +from onyx.connectors.models import Document +from onyx.connectors.models import SlimDocument _THREAD_1_START_TIME = 1730568700 @@ -13,18 +13,18 @@ """ This thread was 4 emails long: - admin@onyx-test.com -> test-group-1@onyx-test.com (conaining test_user_1 and test_user_2) - test_user_1@onyx-test.com -> admin@onyx-test.com - admin@onyx-test.com -> test_user_2@onyx-test.com + BCC: test_user_3@onyx-test.com - test_user_3@onyx-test.com -> admin@onyx-test.com + admin@danswer-test.com -> test-group-1@onyx-test.com (conaining test_user_1 and test_user_2) + test_user_1@onyx-test.com -> admin@danswer-test.com + admin@danswer-test.com -> test_user_2@onyx-test.com + BCC: test_user_3@onyx-test.com + test_user_3@onyx-test.com -> admin@danswer-test.com """ _THREAD_1_BY_ID: dict[str, dict[str, Any]] = { "192edefb315737c3": { - "email": "admin@onyx-test.com", + "email": "admin@danswer-test.com", "sections_count": 4, "primary_owners": set( [ - "admin@onyx-test.com", + "admin@danswer-test.com", "test_user_1@onyx-test.com", "test_user_3@onyx-test.com", ] @@ -32,7 +32,7 @@ "secondary_owners": set( [ "test-group-1@onyx-test.com", - "admin@onyx-test.com", + "admin@danswer-test.com", "test_user_2@onyx-test.com", "test_user_3@onyx-test.com", ] @@ -41,13 +41,15 @@ "192edf020d2f5def": { "email": "test_user_1@onyx-test.com", "sections_count": 2, - "primary_owners": set(["admin@onyx-test.com", "test_user_1@onyx-test.com"]), - "secondary_owners": set(["test-group-1@onyx-test.com", "admin@onyx-test.com"]), + "primary_owners": set(["admin@danswer-test.com", "test_user_1@onyx-test.com"]), + "secondary_owners": set( + ["test-group-1@onyx-test.com", "admin@danswer-test.com"] + ), }, "192edf020ae90aab": { "email": "test_user_2@onyx-test.com", "sections_count": 2, - "primary_owners": set(["admin@onyx-test.com"]), + "primary_owners": set(["admin@danswer-test.com"]), "secondary_owners": set( ["test-group-1@onyx-test.com", "test_user_2@onyx-test.com"] ), @@ -55,10 +57,10 @@ "192edf18316015fa": { "email": "test_user_3@onyx-test.com", "sections_count": 2, - "primary_owners": set(["admin@onyx-test.com", "test_user_3@onyx-test.com"]), + "primary_owners": set(["admin@danswer-test.com", "test_user_3@onyx-test.com"]), "secondary_owners": set( [ - "admin@onyx-test.com", + "admin@danswer-test.com", "test_user_2@onyx-test.com", "test_user_3@onyx-test.com", ] @@ -68,7 +70,7 @@ @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_slim_docs_retrieval( @@ -93,7 +95,7 @@ def test_slim_docs_retrieval( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_docs_retrieval( diff --git a/backend/tests/daily/connectors/google_drive/conftest.py b/backend/tests/daily/connectors/google_drive/conftest.py index 8de8784f155..386d59aa474 100644 --- a/backend/tests/daily/connectors/google_drive/conftest.py +++ b/backend/tests/daily/connectors/google_drive/conftest.py @@ -4,20 +4,20 @@ import pytest -from danswer.connectors.google_drive.connector import GoogleDriveConnector -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_drive.connector import GoogleDriveConnector +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_AUTHENTICATION_METHOD, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_DICT_TOKEN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_PRIMARY_ADMIN_KEY, ) -from danswer.connectors.google_utils.shared_constants import ( +from onyx.connectors.google_utils.shared_constants import ( GoogleOAuthAuthenticationMethod, ) from tests.load_env_vars import load_env_vars @@ -28,12 +28,12 @@ _USER_TO_OAUTH_CREDENTIALS_MAP = { - "admin@onyx-test.com": "GOOGLE_DRIVE_OAUTH_CREDENTIALS_JSON_STR", + "admin@danswer-test.com": "GOOGLE_DRIVE_OAUTH_CREDENTIALS_JSON_STR", "test_user_1@onyx-test.com": "GOOGLE_DRIVE_OAUTH_CREDENTIALS_JSON_STR_TEST_USER_1", } _USER_TO_SERVICE_ACCOUNT_CREDENTIALS_MAP = { - "admin@onyx-test.com": "GOOGLE_DRIVE_SERVICE_ACCOUNT_JSON_STR", + "admin@danswer-test.com": "GOOGLE_DRIVE_SERVICE_ACCOUNT_JSON_STR", } diff --git a/backend/tests/daily/connectors/google_drive/consts_and_utils.py b/backend/tests/daily/connectors/google_drive/consts_and_utils.py index 1df59a58101..c45448062ec 100644 --- a/backend/tests/daily/connectors/google_drive/consts_and_utils.py +++ b/backend/tests/daily/connectors/google_drive/consts_and_utils.py @@ -1,6 +1,6 @@ from collections.abc import Sequence -from danswer.connectors.models import Document +from onyx.connectors.models import Document ALL_FILES = list(range(0, 60)) SHARED_DRIVE_FILES = list(range(20, 25)) @@ -53,7 +53,7 @@ "https://drive.google.com/drive/u/5/folders/1loe6XJ-pJxu9YYPv7cF3Hmz296VNzA33" ) -ADMIN_EMAIL = "admin@onyx-test.com" +ADMIN_EMAIL = "admin@danswer-test.com" TEST_USER_1_EMAIL = "test_user_1@onyx-test.com" TEST_USER_2_EMAIL = "test_user_2@onyx-test.com" TEST_USER_3_EMAIL = "test_user_3@onyx-test.com" diff --git a/backend/tests/daily/connectors/google_drive/test_admin_oauth.py b/backend/tests/daily/connectors/google_drive/test_admin_oauth.py index 117d294de6d..ae854de9e45 100644 --- a/backend/tests/daily/connectors/google_drive/test_admin_oauth.py +++ b/backend/tests/daily/connectors/google_drive/test_admin_oauth.py @@ -3,8 +3,8 @@ from unittest.mock import MagicMock from unittest.mock import patch -from danswer.connectors.google_drive.connector import GoogleDriveConnector -from danswer.connectors.models import Document +from onyx.connectors.google_drive.connector import GoogleDriveConnector +from onyx.connectors.models import Document from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_EMAIL from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_FILE_IDS from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_FOLDER_3_FILE_IDS @@ -30,7 +30,7 @@ @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_include_all( @@ -72,7 +72,7 @@ def test_include_all( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_include_shared_drives_only( @@ -112,7 +112,7 @@ def test_include_shared_drives_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_include_my_drives_only( @@ -142,7 +142,7 @@ def test_include_my_drives_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_drive_one_only( @@ -177,7 +177,7 @@ def test_drive_one_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_folder_and_shared_drive( @@ -216,7 +216,7 @@ def test_folder_and_shared_drive( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_folders_only( @@ -261,7 +261,7 @@ def test_folders_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_personal_folders_only( diff --git a/backend/tests/daily/connectors/google_drive/test_sections.py b/backend/tests/daily/connectors/google_drive/test_sections.py index 1ef05729ffd..14e858840b8 100644 --- a/backend/tests/daily/connectors/google_drive/test_sections.py +++ b/backend/tests/daily/connectors/google_drive/test_sections.py @@ -3,14 +3,14 @@ from unittest.mock import MagicMock from unittest.mock import patch -from danswer.connectors.google_drive.connector import GoogleDriveConnector -from danswer.connectors.models import Document +from onyx.connectors.google_drive.connector import GoogleDriveConnector +from onyx.connectors.models import Document from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_EMAIL from tests.daily.connectors.google_drive.consts_and_utils import SECTIONS_FOLDER_URL @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_google_drive_sections( diff --git a/backend/tests/daily/connectors/google_drive/test_service_acct.py b/backend/tests/daily/connectors/google_drive/test_service_acct.py index 602849a41dc..69002158b06 100644 --- a/backend/tests/daily/connectors/google_drive/test_service_acct.py +++ b/backend/tests/daily/connectors/google_drive/test_service_acct.py @@ -3,8 +3,8 @@ from unittest.mock import MagicMock from unittest.mock import patch -from danswer.connectors.google_drive.connector import GoogleDriveConnector -from danswer.connectors.models import Document +from onyx.connectors.google_drive.connector import GoogleDriveConnector +from onyx.connectors.models import Document from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_EMAIL from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_FILE_IDS from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_FOLDER_3_FILE_IDS @@ -35,7 +35,7 @@ @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_include_all( @@ -80,7 +80,7 @@ def test_include_all( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_include_shared_drives_only( @@ -120,7 +120,7 @@ def test_include_shared_drives_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_include_my_drives_only( @@ -156,7 +156,7 @@ def test_include_my_drives_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_drive_one_only( @@ -192,7 +192,7 @@ def test_drive_one_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_folder_and_shared_drive( @@ -232,7 +232,7 @@ def test_folder_and_shared_drive( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_folders_only( @@ -277,7 +277,7 @@ def test_folders_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_specific_emails( @@ -310,7 +310,7 @@ def test_specific_emails( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def get_specific_folders_in_my_drive( diff --git a/backend/tests/daily/connectors/google_drive/test_slim_docs.py b/backend/tests/daily/connectors/google_drive/test_slim_docs.py index 7a836421317..312823e0ef6 100644 --- a/backend/tests/daily/connectors/google_drive/test_slim_docs.py +++ b/backend/tests/daily/connectors/google_drive/test_slim_docs.py @@ -3,13 +3,13 @@ from unittest.mock import MagicMock from unittest.mock import patch -from danswer.access.models import ExternalAccess -from danswer.connectors.google_drive.connector import GoogleDriveConnector -from danswer.connectors.google_utils.google_utils import execute_paginated_retrieval -from danswer.connectors.google_utils.resources import get_admin_service -from ee.danswer.external_permissions.google_drive.doc_sync import ( +from ee.onyx.external_permissions.google_drive.doc_sync import ( _get_permissions_from_slim_doc, ) +from onyx.access.models import ExternalAccess +from onyx.connectors.google_drive.connector import GoogleDriveConnector +from onyx.connectors.google_utils.google_utils import execute_paginated_retrieval +from onyx.connectors.google_utils.resources import get_admin_service from tests.daily.connectors.google_drive.consts_and_utils import ACCESS_MAPPING from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_EMAIL from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_FILE_IDS @@ -118,7 +118,7 @@ def get_group_map(google_drive_connector: GoogleDriveConnector) -> dict[str, lis @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_all_permissions( diff --git a/backend/tests/daily/connectors/google_drive/test_user_1_oauth.py b/backend/tests/daily/connectors/google_drive/test_user_1_oauth.py index 2278259acda..d399868ce66 100644 --- a/backend/tests/daily/connectors/google_drive/test_user_1_oauth.py +++ b/backend/tests/daily/connectors/google_drive/test_user_1_oauth.py @@ -3,8 +3,8 @@ from unittest.mock import MagicMock from unittest.mock import patch -from danswer.connectors.google_drive.connector import GoogleDriveConnector -from danswer.connectors.models import Document +from onyx.connectors.google_drive.connector import GoogleDriveConnector +from onyx.connectors.models import Document from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_FOLDER_3_FILE_IDS from tests.daily.connectors.google_drive.consts_and_utils import ( assert_retrieved_docs_match_expected, @@ -20,7 +20,7 @@ @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_all( @@ -60,7 +60,7 @@ def test_all( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_shared_drives_only( @@ -95,7 +95,7 @@ def test_shared_drives_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_shared_with_me_only( @@ -128,7 +128,7 @@ def test_shared_with_me_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_my_drive_only( @@ -158,7 +158,7 @@ def test_my_drive_only( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_shared_my_drive_folder( @@ -190,7 +190,7 @@ def test_shared_my_drive_folder( @patch( - "danswer.file_processing.extract_file_text.get_unstructured_api_key", + "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) def test_shared_drive_folder( diff --git a/backend/tests/daily/connectors/jira/test_jira_basic.py b/backend/tests/daily/connectors/jira/test_jira_basic.py index 19d69dfadcf..a1bb8c3e4f6 100644 --- a/backend/tests/daily/connectors/jira/test_jira_basic.py +++ b/backend/tests/daily/connectors/jira/test_jira_basic.py @@ -3,8 +3,8 @@ import pytest -from danswer.configs.constants import DocumentSource -from danswer.connectors.danswer_jira.connector import JiraConnector +from onyx.configs.constants import DocumentSource +from onyx.connectors.onyx_jira.connector import JiraConnector @pytest.fixture diff --git a/backend/tests/daily/connectors/slab/test_slab_connector.py b/backend/tests/daily/connectors/slab/test_slab_connector.py index d3902cd0a0c..e5722cdc564 100644 --- a/backend/tests/daily/connectors/slab/test_slab_connector.py +++ b/backend/tests/daily/connectors/slab/test_slab_connector.py @@ -5,9 +5,9 @@ import pytest -from danswer.configs.constants import DocumentSource -from danswer.connectors.models import Document -from danswer.connectors.slab.connector import SlabConnector +from onyx.configs.constants import DocumentSource +from onyx.connectors.models import Document +from onyx.connectors.slab.connector import SlabConnector def load_test_data(file_name: str = "test_slab_data.json") -> dict[str, str]: diff --git a/backend/tests/daily/embedding/test_embeddings.py b/backend/tests/daily/embedding/test_embeddings.py index 7182510214f..a87c41c33fe 100644 --- a/backend/tests/daily/embedding/test_embeddings.py +++ b/backend/tests/daily/embedding/test_embeddings.py @@ -2,7 +2,7 @@ import pytest -from danswer.natural_language_processing.search_nlp_models import EmbeddingModel +from onyx.natural_language_processing.search_nlp_models import EmbeddingModel from shared_configs.enums import EmbedTextType from shared_configs.model_server_models import EmbeddingProvider diff --git a/backend/tests/daily/llm/test_bedrock.py b/backend/tests/daily/llm/test_bedrock.py index 1d5022abf99..d895d5a1f52 100644 --- a/backend/tests/daily/llm/test_bedrock.py +++ b/backend/tests/daily/llm/test_bedrock.py @@ -4,9 +4,9 @@ import pytest from fastapi.testclient import TestClient -from danswer.llm.llm_provider_options import BEDROCK_PROVIDER_NAME -from danswer.llm.llm_provider_options import fetch_available_well_known_llms -from danswer.llm.llm_provider_options import WellKnownLLMProviderDescriptor +from onyx.llm.llm_provider_options import BEDROCK_PROVIDER_NAME +from onyx.llm.llm_provider_options import fetch_available_well_known_llms +from onyx.llm.llm_provider_options import WellKnownLLMProviderDescriptor @pytest.fixture diff --git a/backend/tests/integration/Dockerfile b/backend/tests/integration/Dockerfile index 3eecb0d5683..12e63a9b946 100644 --- a/backend/tests/integration/Dockerfile +++ b/backend/tests/integration/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.11.7-slim-bookworm # Dockerfile for integration tests -# Currently needs all dependencies, since the ITs use some of the Danswer +# Currently needs all dependencies, since the ITs use some of the Onyx # backend code. # Install system dependencies @@ -43,7 +43,7 @@ RUN pip install --no-cache-dir --upgrade \ # Cleanup for CVEs and size reduction # https://github.com/tornadoweb/tornado/issues/3107 # xserver-common and xvfb included by playwright installation but not needed after -# perl-base is part of the base Python Debian image but not needed for Danswer functionality +# perl-base is part of the base Python Debian image but not needed for Onyx functionality # perl-base could only be removed with --allow-remove-essential RUN apt-get update && \ apt-get remove -y --allow-remove-essential \ @@ -68,7 +68,7 @@ COPY ./ee /app/ee COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Set up application files -COPY ./danswer /app/danswer +COPY ./onyx /app/onyx COPY ./shared_configs /app/shared_configs COPY ./alembic /app/alembic COPY ./alembic.ini /app/alembic.ini diff --git a/backend/tests/integration/README.md b/backend/tests/integration/README.md index bc5e388082f..f655b6589ad 100644 --- a/backend/tests/integration/README.md +++ b/backend/tests/integration/README.md @@ -1,16 +1,19 @@ # Integration Tests ## General Testing Overview + The integration tests are designed with a "manager" class and a "test" class for each type of object being manipulated (e.g., user, persona, credential): + - **Manager Class**: Contains methods for each type of API call. Responsible for creating, deleting, and verifying the existence of an entity. - **Test Class**: Stores data for each entity being tested. This is our "expected state" of the object. -The idea is that each test can use the manager class to create (.create()) a "test_" object. It can then perform an operation on the object (e.g., send a request to the API) and then check if the "test_" object is in the expected state by using the manager class (.verify()) function. +The idea is that each test can use the manager class to create (.create()) a "test*" object. It can then perform an operation on the object (e.g., send a request to the API) and then check if the "test*" object is in the expected state by using the manager class (.verify()) function. ## Instructions for Running Integration Tests Locally -1. Launch danswer (using Docker or running with a debugger), ensuring the API server is running on port 8080. - a. If you'd like to set environment variables, you can do so by creating a `.env` file in the danswer/backend/tests/integration/ directory. -2. Navigate to `danswer/backend`. + +1. Launch onyx (using Docker or running with a debugger), ensuring the API server is running on port 8080. + a. If you'd like to set environment variables, you can do so by creating a `.env` file in the onyx/backend/tests/integration/ directory. +2. Navigate to `onyx/backend`. 3. Run the following command in the terminal: ```sh pytest -s tests/integration/tests/ @@ -25,46 +28,57 @@ The idea is that each test can use the manager class to create (.create()) a "te ``` ## Guidelines for Writing Integration Tests + - As authentication is currently required for all tests, each test should start by creating a user. -- Each test should ideally focus on a single API flow. +- Each test should ideally focus on a single API flow. - The test writer should try to consider failure cases and edge cases for the flow and write the tests to check for these cases. - Every step of the test should be commented describing what is being done and what the expected behavior is. - A summary of the test should be given at the top of the test function as well! - When writing new tests, manager classes, manager functions, and test classes, try to copy the style of the other ones that have already been written. -- Be careful for scope creep! - - No need to overcomplicate every test by verifying after every single API call so long as the case you would be verifying is covered elsewhere (ideally in a test focused on covering that case). - - An example of this is: Creating an admin user is done at the beginning of nearly every test, but we only need to verify that the user is actually an admin in the test focused on checking admin permissions. For every other test, we can just create the admin user and assume that the permissions are working as expected. +- Be careful for scope creep! + - No need to overcomplicate every test by verifying after every single API call so long as the case you would be verifying is covered elsewhere (ideally in a test focused on covering that case). + - An example of this is: Creating an admin user is done at the beginning of nearly every test, but we only need to verify that the user is actually an admin in the test focused on checking admin permissions. For every other test, we can just create the admin user and assume that the permissions are working as expected. ## Current Testing Limitations + ### Test coverage + - All tests are probably not as high coverage as they could be. - The "connector" tests in particular are super bare bones because we will be reworking connector/cc_pair sometime soon. - Global Curator role is not thoroughly tested. - No auth is not tested at all. + ### Failure checking -- While we test expected auth failures, we only check that it failed at all. -- We dont check that the return codes are what we expect. + +- While we test expected auth failures, we only check that it failed at all. +- We dont check that the return codes are what we expect. - This means that a test could be failing for a different reason than expected. - We should ensure that the proper codes are being returned for each failure case. - We should also query the db after each failure to ensure that the db is in the expected state. + ### Scope/focus + - The tests may be scoped sub-optimally. - The scoping of each test may be overlapping. ## Current Testing Coverage -The current testing coverage should be checked by reading the comments at the top of each test file. +The current testing coverage should be checked by reading the comments at the top of each test file. ## TODO: Testing Coverage + - Persona permissions testing - Read only (and/or basic) user permissions - - Ensuring proper permission enforcement using the chat/doc_search endpoints + - Ensuring proper permission enforcement using the chat/doc_search endpoints - No auth ## Ideas for integration testing design + ### Combine the "test" and "manager" classes + This could make test writing a bit cleaner by preventing test writers from having to pass around objects into functions that the objects have a 1:1 relationship with. ### Rework VespaClient + Right now, its used a fixture and has to be passed around between manager classes. Could just be built where its used diff --git a/backend/tests/integration/common_utils/chat.py b/backend/tests/integration/common_utils/chat.py index cd33d4edcaf..b9de84ad52f 100644 --- a/backend/tests/integration/common_utils/chat.py +++ b/backend/tests/integration/common_utils/chat.py @@ -1,7 +1,7 @@ import requests from sqlalchemy.orm import Session -from danswer.db.models import User +from onyx.db.models import User def test_create_chat_session_and_send_messages(db_session: Session) -> None: diff --git a/backend/tests/integration/common_utils/managers/api_key.py b/backend/tests/integration/common_utils/managers/api_key.py index 9df6b1c4f2f..6dca93884c5 100644 --- a/backend/tests/integration/common_utils/managers/api_key.py +++ b/backend/tests/integration/common_utils/managers/api_key.py @@ -2,8 +2,8 @@ import requests -from danswer.db.models import UserRole -from danswer.server.api_key.models import APIKeyArgs +from onyx.db.models import UserRole +from onyx.server.api_key.models import APIKeyArgs from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestAPIKey diff --git a/backend/tests/integration/common_utils/managers/cc_pair.py b/backend/tests/integration/common_utils/managers/cc_pair.py index d32e100563b..dc8e534012a 100644 --- a/backend/tests/integration/common_utils/managers/cc_pair.py +++ b/backend/tests/integration/common_utils/managers/cc_pair.py @@ -5,14 +5,14 @@ import requests -from danswer.connectors.models import InputType -from danswer.db.enums import AccessType -from danswer.db.enums import ConnectorCredentialPairStatus -from danswer.server.documents.models import CCPairFullInfo -from danswer.server.documents.models import ConnectorCredentialPairIdentifier -from danswer.server.documents.models import ConnectorIndexingStatus -from danswer.server.documents.models import DocumentSource -from danswer.server.documents.models import DocumentSyncStatus +from onyx.connectors.models import InputType +from onyx.db.enums import AccessType +from onyx.db.enums import ConnectorCredentialPairStatus +from onyx.server.documents.models import CCPairFullInfo +from onyx.server.documents.models import ConnectorCredentialPairIdentifier +from onyx.server.documents.models import ConnectorIndexingStatus +from onyx.server.documents.models import DocumentSource +from onyx.server.documents.models import DocumentSyncStatus from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.constants import MAX_DELAY diff --git a/backend/tests/integration/common_utils/managers/chat.py b/backend/tests/integration/common_utils/managers/chat.py index d8a35b2b31f..625e8bbd57c 100644 --- a/backend/tests/integration/common_utils/managers/chat.py +++ b/backend/tests/integration/common_utils/managers/chat.py @@ -4,12 +4,12 @@ import requests from requests.models import Response -from danswer.context.search.models import RetrievalDetails -from danswer.file_store.models import FileDescriptor -from danswer.llm.override_models import LLMOverride -from danswer.llm.override_models import PromptOverride -from danswer.server.query_and_chat.models import ChatSessionCreationRequest -from danswer.server.query_and_chat.models import CreateChatMessageRequest +from onyx.context.search.models import RetrievalDetails +from onyx.file_store.models import FileDescriptor +from onyx.llm.override_models import LLMOverride +from onyx.llm.override_models import PromptOverride +from onyx.server.query_and_chat.models import ChatSessionCreationRequest +from onyx.server.query_and_chat.models import CreateChatMessageRequest from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestChatMessage diff --git a/backend/tests/integration/common_utils/managers/connector.py b/backend/tests/integration/common_utils/managers/connector.py index 5c090c387dd..2bcda485107 100644 --- a/backend/tests/integration/common_utils/managers/connector.py +++ b/backend/tests/integration/common_utils/managers/connector.py @@ -3,10 +3,10 @@ import requests -from danswer.connectors.models import InputType -from danswer.db.enums import AccessType -from danswer.server.documents.models import ConnectorUpdateRequest -from danswer.server.documents.models import DocumentSource +from onyx.connectors.models import InputType +from onyx.db.enums import AccessType +from onyx.server.documents.models import ConnectorUpdateRequest +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestConnector diff --git a/backend/tests/integration/common_utils/managers/credential.py b/backend/tests/integration/common_utils/managers/credential.py index 8c8a59d4856..9479a0d6b5e 100644 --- a/backend/tests/integration/common_utils/managers/credential.py +++ b/backend/tests/integration/common_utils/managers/credential.py @@ -3,8 +3,8 @@ import requests -from danswer.server.documents.models import CredentialSnapshot -from danswer.server.documents.models import DocumentSource +from onyx.server.documents.models import CredentialSnapshot +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestCredential diff --git a/backend/tests/integration/common_utils/managers/document.py b/backend/tests/integration/common_utils/managers/document.py index eecd75fa157..939a420f014 100644 --- a/backend/tests/integration/common_utils/managers/document.py +++ b/backend/tests/integration/common_utils/managers/document.py @@ -2,8 +2,8 @@ import requests -from danswer.configs.constants import DocumentSource -from danswer.db.enums import AccessType +from onyx.configs.constants import DocumentSource +from onyx.db.enums import AccessType from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.constants import NUM_DOCS @@ -99,7 +99,7 @@ def seed_dummy_docs( document = _generate_dummy_document(document_id, cc_pair.id) documents.append(document) response = requests.post( - f"{API_SERVER_URL}/danswer-api/ingestion", + f"{API_SERVER_URL}/onyx-api/ingestion", json=document, headers=api_key.headers if api_key else GENERAL_HEADERS, ) @@ -127,7 +127,7 @@ def seed_doc_with_content( # Create and ingest some documents document: dict = _generate_dummy_document(document_id, cc_pair.id, content) response = requests.post( - f"{API_SERVER_URL}/danswer-api/ingestion", + f"{API_SERVER_URL}/onyx-api/ingestion", json=document, headers=api_key.headers if api_key else GENERAL_HEADERS, ) diff --git a/backend/tests/integration/common_utils/managers/document_search.py b/backend/tests/integration/common_utils/managers/document_search.py index 82fdaf27db1..71d23180df9 100644 --- a/backend/tests/integration/common_utils/managers/document_search.py +++ b/backend/tests/integration/common_utils/managers/document_search.py @@ -1,10 +1,10 @@ import requests -from danswer.context.search.enums import LLMEvaluationType -from danswer.context.search.enums import SearchType -from danswer.context.search.models import RetrievalDetails -from danswer.context.search.models import SavedSearchDocWithContent -from ee.danswer.server.query_and_chat.models import DocumentSearchRequest +from ee.onyx.server.query_and_chat.models import DocumentSearchRequest +from onyx.context.search.enums import LLMEvaluationType +from onyx.context.search.enums import SearchType +from onyx.context.search.models import RetrievalDetails +from onyx.context.search.models import SavedSearchDocWithContent from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestUser diff --git a/backend/tests/integration/common_utils/managers/file.py b/backend/tests/integration/common_utils/managers/file.py index 461874f7ec5..e8028a6a571 100644 --- a/backend/tests/integration/common_utils/managers/file.py +++ b/backend/tests/integration/common_utils/managers/file.py @@ -6,7 +6,7 @@ import requests -from danswer.file_store.models import FileDescriptor +from onyx.file_store.models import FileDescriptor from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestUser diff --git a/backend/tests/integration/common_utils/managers/llm_provider.py b/backend/tests/integration/common_utils/managers/llm_provider.py index 6ac4693496d..44d4ce5010b 100644 --- a/backend/tests/integration/common_utils/managers/llm_provider.py +++ b/backend/tests/integration/common_utils/managers/llm_provider.py @@ -3,8 +3,8 @@ import requests -from danswer.server.manage.llm.models import FullLLMProvider -from danswer.server.manage.llm.models import LLMProviderUpsertRequest +from onyx.server.manage.llm.models import FullLLMProvider +from onyx.server.manage.llm.models import LLMProviderUpsertRequest from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestLLMProvider diff --git a/backend/tests/integration/common_utils/managers/persona.py b/backend/tests/integration/common_utils/managers/persona.py index e5392dfb68b..325208fe2c9 100644 --- a/backend/tests/integration/common_utils/managers/persona.py +++ b/backend/tests/integration/common_utils/managers/persona.py @@ -2,8 +2,8 @@ import requests -from danswer.context.search.enums import RecencyBiasSetting -from danswer.server.features.persona.models import PersonaSnapshot +from onyx.context.search.enums import RecencyBiasSetting +from onyx.server.features.persona.models import PersonaSnapshot from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestPersona diff --git a/backend/tests/integration/common_utils/managers/tenant.py b/backend/tests/integration/common_utils/managers/tenant.py index c25a1b2ec6e..3672b16961e 100644 --- a/backend/tests/integration/common_utils/managers/tenant.py +++ b/backend/tests/integration/common_utils/managers/tenant.py @@ -4,9 +4,9 @@ import jwt import requests -from danswer.server.manage.models import AllUsersResponse -from danswer.server.models import FullUserSnapshot -from danswer.server.models import InvitedUserSnapshot +from onyx.server.manage.models import AllUsersResponse +from onyx.server.models import FullUserSnapshot +from onyx.server.models import InvitedUserSnapshot from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestUser diff --git a/backend/tests/integration/common_utils/managers/user.py b/backend/tests/integration/common_utils/managers/user.py index 26cb29cdffb..d0cad756854 100644 --- a/backend/tests/integration/common_utils/managers/user.py +++ b/backend/tests/integration/common_utils/managers/user.py @@ -4,10 +4,10 @@ import requests -from danswer.db.models import UserRole -from danswer.server.manage.models import AllUsersResponse -from danswer.server.models import FullUserSnapshot -from danswer.server.models import InvitedUserSnapshot +from onyx.db.models import UserRole +from onyx.server.manage.models import AllUsersResponse +from onyx.server.models import FullUserSnapshot +from onyx.server.models import InvitedUserSnapshot from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestUser diff --git a/backend/tests/integration/common_utils/managers/user_group.py b/backend/tests/integration/common_utils/managers/user_group.py index e8a26fa34a7..7d3ed5347b1 100644 --- a/backend/tests/integration/common_utils/managers/user_group.py +++ b/backend/tests/integration/common_utils/managers/user_group.py @@ -3,7 +3,7 @@ import requests -from ee.danswer.server.user_group.models import UserGroup +from ee.onyx.server.user_group.models import UserGroup from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.constants import MAX_DELAY diff --git a/backend/tests/integration/common_utils/reset.py b/backend/tests/integration/common_utils/reset.py index 1792af9dbf9..116d91c420d 100644 --- a/backend/tests/integration/common_utils/reset.py +++ b/backend/tests/integration/common_utils/reset.py @@ -7,23 +7,23 @@ from alembic import command from alembic.config import Config -from danswer.configs.app_configs import POSTGRES_HOST -from danswer.configs.app_configs import POSTGRES_PASSWORD -from danswer.configs.app_configs import POSTGRES_PORT -from danswer.configs.app_configs import POSTGRES_USER -from danswer.db.engine import build_connection_string -from danswer.db.engine import get_all_tenant_ids -from danswer.db.engine import get_session_context_manager -from danswer.db.engine import get_session_with_tenant -from danswer.db.engine import SYNC_DB_API -from danswer.db.search_settings import get_current_search_settings -from danswer.db.swap_index import check_index_swap -from danswer.document_index.vespa.index import DOCUMENT_ID_ENDPOINT -from danswer.document_index.vespa.index import VespaIndex -from danswer.indexing.models import IndexingSetting -from danswer.setup import setup_postgres -from danswer.setup import setup_vespa -from danswer.utils.logger import setup_logger +from onyx.configs.app_configs import POSTGRES_HOST +from onyx.configs.app_configs import POSTGRES_PASSWORD +from onyx.configs.app_configs import POSTGRES_PORT +from onyx.configs.app_configs import POSTGRES_USER +from onyx.db.engine import build_connection_string +from onyx.db.engine import get_all_tenant_ids +from onyx.db.engine import get_session_context_manager +from onyx.db.engine import get_session_with_tenant +from onyx.db.engine import SYNC_DB_API +from onyx.db.search_settings import get_current_search_settings +from onyx.db.swap_index import check_index_swap +from onyx.document_index.vespa.index import DOCUMENT_ID_ENDPOINT +from onyx.document_index.vespa.index import VespaIndex +from onyx.indexing.models import IndexingSetting +from onyx.setup import setup_postgres +from onyx.setup import setup_vespa +from onyx.utils.logger import setup_logger logger = setup_logger() @@ -64,7 +64,7 @@ def _run_migrations( def reset_postgres( - database: str = "postgres", config_name: str = "alembic", setup_danswer: bool = True + database: str = "postgres", config_name: str = "alembic", setup_onyx: bool = True ) -> None: """Reset the Postgres database.""" @@ -134,7 +134,7 @@ def reset_postgres( direction="upgrade", revision="head", ) - if not setup_danswer: + if not setup_onyx: return # do the same thing as we do on API server startup @@ -215,7 +215,7 @@ def reset_postgres_multitenant() -> None: cur.close() conn.close() - reset_postgres(config_name="schema_private", setup_danswer=False) + reset_postgres(config_name="schema_private", setup_onyx=False) def reset_vespa_multitenant() -> None: diff --git a/backend/tests/integration/common_utils/test_models.py b/backend/tests/integration/common_utils/test_models.py index 65a90259d8b..36eb2c9ecec 100644 --- a/backend/tests/integration/common_utils/test_models.py +++ b/backend/tests/integration/common_utils/test_models.py @@ -4,11 +4,11 @@ from pydantic import BaseModel from pydantic import Field -from danswer.auth.schemas import UserRole -from danswer.context.search.enums import RecencyBiasSetting -from danswer.db.enums import AccessType -from danswer.server.documents.models import DocumentSource -from danswer.server.documents.models import InputType +from onyx.auth.schemas import UserRole +from onyx.context.search.enums import RecencyBiasSetting +from onyx.db.enums import AccessType +from onyx.server.documents.models import DocumentSource +from onyx.server.documents.models import InputType """ These data models are used to represent the data on the testing side of things. diff --git a/backend/tests/integration/common_utils/vespa.py b/backend/tests/integration/common_utils/vespa.py index 1bd0060d89b..933c4d5e056 100644 --- a/backend/tests/integration/common_utils/vespa.py +++ b/backend/tests/integration/common_utils/vespa.py @@ -1,6 +1,6 @@ import requests -from danswer.document_index.vespa.index import DOCUMENT_ID_ENDPOINT +from onyx.document_index.vespa.index import DOCUMENT_ID_ENDPOINT class vespa_fixture: diff --git a/backend/tests/integration/conftest.py b/backend/tests/integration/conftest.py index 91e61966643..5eba1e66f87 100644 --- a/backend/tests/integration/conftest.py +++ b/backend/tests/integration/conftest.py @@ -4,8 +4,8 @@ import pytest from sqlalchemy.orm import Session -from danswer.db.engine import get_session_context_manager -from danswer.db.search_settings import get_current_search_settings +from onyx.db.engine import get_session_context_manager +from onyx.db.search_settings import get_current_search_settings from tests.integration.common_utils.managers.user import UserManager from tests.integration.common_utils.reset import reset_all from tests.integration.common_utils.reset import reset_all_multitenant diff --git a/backend/tests/integration/connector_job_tests/slack/conftest.py b/backend/tests/integration/connector_job_tests/slack/conftest.py index 38b851de809..1e4ee4b0132 100644 --- a/backend/tests/integration/connector_job_tests/slack/conftest.py +++ b/backend/tests/integration/connector_job_tests/slack/conftest.py @@ -15,7 +15,7 @@ def slack_test_setup() -> Generator[tuple[dict[str, Any], dict[str, Any]], None, None]: slack_client = SlackManager.get_slack_client(os.environ["SLACK_BOT_TOKEN"]) admin_user_id = SlackManager.build_slack_user_email_id_map(slack_client)[ - "admin@onyx-test.com" + "admin@danswer-test.com" ] ( diff --git a/backend/tests/integration/connector_job_tests/slack/slack_api_utils.py b/backend/tests/integration/connector_job_tests/slack/slack_api_utils.py index f17c4211066..84ab28e96c0 100644 --- a/backend/tests/integration/connector_job_tests/slack/slack_api_utils.py +++ b/backend/tests/integration/connector_job_tests/slack/slack_api_utils.py @@ -14,10 +14,10 @@ from slack_sdk import WebClient from slack_sdk.errors import SlackApiError -from danswer.connectors.slack.connector import default_msg_filter -from danswer.connectors.slack.connector import get_channel_messages -from danswer.connectors.slack.utils import make_paginated_slack_api_call_w_retries -from danswer.connectors.slack.utils import make_slack_api_call_w_retries +from onyx.connectors.slack.connector import default_msg_filter +from onyx.connectors.slack.connector import get_channel_messages +from onyx.connectors.slack.utils import make_paginated_slack_api_call_w_retries +from onyx.connectors.slack.utils import make_slack_api_call_w_retries def _get_slack_channel_id(channel: dict[str, Any]) -> str: diff --git a/backend/tests/integration/connector_job_tests/slack/test_permission_sync.py b/backend/tests/integration/connector_job_tests/slack/test_permission_sync.py index 6396d7ca058..eed67d6a381 100644 --- a/backend/tests/integration/connector_job_tests/slack/test_permission_sync.py +++ b/backend/tests/integration/connector_job_tests/slack/test_permission_sync.py @@ -5,9 +5,9 @@ import pytest -from danswer.connectors.models import InputType -from danswer.db.enums import AccessType -from danswer.server.documents.models import DocumentSource +from onyx.connectors.models import InputType +from onyx.db.enums import AccessType +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.connector import ConnectorManager from tests.integration.common_utils.managers.credential import CredentialManager @@ -35,7 +35,7 @@ def test_slack_permission_sync( # Creating an admin user (first user created is automatically an admin) admin_user: DATestUser = UserManager.create( - email="admin@onyx-test.com", + email="admin@danswer-test.com", ) # Creating a non-admin user @@ -134,48 +134,48 @@ def test_slack_permission_sync( # Search as admin with access to both channels print("\nSearching as admin user") - danswer_doc_message_strings = DocumentSearchManager.search_documents( + onyx_doc_message_strings = DocumentSearchManager.search_documents( query="favorite number", user_performing_action=admin_user, ) print( "\n documents retrieved by admin user: ", - danswer_doc_message_strings, + onyx_doc_message_strings, ) # Ensure admin user can see messages from both channels - assert public_message in danswer_doc_message_strings - assert private_message in danswer_doc_message_strings + assert public_message in onyx_doc_message_strings + assert private_message in onyx_doc_message_strings # Search as test_user_2 with access to only the public channel print("\n Searching as test_user_2") - danswer_doc_message_strings = DocumentSearchManager.search_documents( + onyx_doc_message_strings = DocumentSearchManager.search_documents( query="favorite number", user_performing_action=test_user_2, ) print( "\n documents retrieved by test_user_2: ", - danswer_doc_message_strings, + onyx_doc_message_strings, ) # Ensure test_user_2 can only see messages from the public channel - assert public_message in danswer_doc_message_strings - assert private_message not in danswer_doc_message_strings + assert public_message in onyx_doc_message_strings + assert private_message not in onyx_doc_message_strings # Search as test_user_1 with access to both channels print("\n Searching as test_user_1") - danswer_doc_message_strings = DocumentSearchManager.search_documents( + onyx_doc_message_strings = DocumentSearchManager.search_documents( query="favorite number", user_performing_action=test_user_1, ) print( "\n documents retrieved by test_user_1 before being removed from private channel: ", - danswer_doc_message_strings, + onyx_doc_message_strings, ) # Ensure test_user_1 can see messages from both channels - assert public_message in danswer_doc_message_strings - assert private_message in danswer_doc_message_strings + assert public_message in onyx_doc_message_strings + assert private_message in onyx_doc_message_strings # ----------------------MAKE THE CHANGES-------------------------- print("\n Removing test_user_1 from the private channel") @@ -205,18 +205,18 @@ def test_slack_permission_sync( # Ensure test_user_1 can no longer see messages from the private channel # Search as test_user_1 with access to only the public channel - danswer_doc_message_strings = DocumentSearchManager.search_documents( + onyx_doc_message_strings = DocumentSearchManager.search_documents( query="favorite number", user_performing_action=test_user_1, ) print( "\n documents retrieved by test_user_1 after being removed from private channel: ", - danswer_doc_message_strings, + onyx_doc_message_strings, ) # Ensure test_user_1 can only see messages from the public channel - assert public_message in danswer_doc_message_strings - assert private_message not in danswer_doc_message_strings + assert public_message in onyx_doc_message_strings + assert private_message not in onyx_doc_message_strings def test_slack_group_permission_sync( @@ -225,13 +225,13 @@ def test_slack_group_permission_sync( slack_test_setup: tuple[dict[str, Any], dict[str, Any]], ) -> None: """ - This test ensures that permission sync overrides danswer group access. + This test ensures that permission sync overrides onyx group access. """ public_channel, private_channel = slack_test_setup # Creating an admin user (first user created is automatically an admin) admin_user: DATestUser = UserManager.create( - email="admin@onyx-test.com", + email="admin@danswer-test.com", ) # Creating a non-admin user diff --git a/backend/tests/integration/connector_job_tests/slack/test_prune.py b/backend/tests/integration/connector_job_tests/slack/test_prune.py index 774cf39e2ed..cc2ce564159 100644 --- a/backend/tests/integration/connector_job_tests/slack/test_prune.py +++ b/backend/tests/integration/connector_job_tests/slack/test_prune.py @@ -5,9 +5,9 @@ import pytest -from danswer.connectors.models import InputType -from danswer.db.enums import AccessType -from danswer.server.documents.models import DocumentSource +from onyx.connectors.models import InputType +from onyx.db.enums import AccessType +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.connector import ConnectorManager from tests.integration.common_utils.managers.credential import CredentialManager @@ -34,7 +34,7 @@ def test_slack_prune( # Creating an admin user (first user created is automatically an admin) admin_user: DATestUser = UserManager.create( - email="admin@onyx-test.com", + email="admin@danswer-test.com", ) # Creating a non-admin user @@ -132,34 +132,34 @@ def test_slack_prune( # ----------------------TEST THE SETUP-------------------------- # Search as admin with access to both channels - danswer_doc_message_strings = DocumentSearchManager.search_documents( + onyx_doc_message_strings = DocumentSearchManager.search_documents( query="favorite number", user_performing_action=admin_user, ) print( "\ntop_documents content before deleting for admin: ", - danswer_doc_message_strings, + onyx_doc_message_strings, ) # Ensure admin user can see all messages - assert public_message in danswer_doc_message_strings - assert private_message in danswer_doc_message_strings - assert message_to_delete in danswer_doc_message_strings + assert public_message in onyx_doc_message_strings + assert private_message in onyx_doc_message_strings + assert message_to_delete in onyx_doc_message_strings # Search as test_user_1 with access to both channels - danswer_doc_message_strings = DocumentSearchManager.search_documents( + onyx_doc_message_strings = DocumentSearchManager.search_documents( query="favorite number", user_performing_action=test_user_1, ) print( "\ntop_documents content before deleting for test_user_1: ", - danswer_doc_message_strings, + onyx_doc_message_strings, ) # Ensure test_user_1 can see all messages - assert public_message in danswer_doc_message_strings - assert private_message in danswer_doc_message_strings - assert message_to_delete in danswer_doc_message_strings + assert public_message in onyx_doc_message_strings + assert private_message in onyx_doc_message_strings + assert message_to_delete in onyx_doc_message_strings # ----------------------MAKE THE CHANGES-------------------------- # Delete messages @@ -178,32 +178,32 @@ def test_slack_prune( # ----------------------------VERIFY THE CHANGES--------------------------- # Ensure admin user can't see deleted messages # Search as admin user with access to only the public channel - danswer_doc_message_strings = DocumentSearchManager.search_documents( + onyx_doc_message_strings = DocumentSearchManager.search_documents( query="favorite number", user_performing_action=admin_user, ) print( "\ntop_documents content after deleting for admin: ", - danswer_doc_message_strings, + onyx_doc_message_strings, ) # Ensure admin can't see deleted messages - assert public_message in danswer_doc_message_strings - assert private_message in danswer_doc_message_strings - assert message_to_delete not in danswer_doc_message_strings + assert public_message in onyx_doc_message_strings + assert private_message in onyx_doc_message_strings + assert message_to_delete not in onyx_doc_message_strings # Ensure test_user_1 can't see deleted messages # Search as test_user_1 with access to only the public channel - danswer_doc_message_strings = DocumentSearchManager.search_documents( + onyx_doc_message_strings = DocumentSearchManager.search_documents( query="favorite number", user_performing_action=test_user_1, ) print( "\ntop_documents content after prune for test_user_1: ", - danswer_doc_message_strings, + onyx_doc_message_strings, ) # Ensure test_user_1 can't see deleted messages - assert public_message in danswer_doc_message_strings - assert private_message in danswer_doc_message_strings - assert message_to_delete not in danswer_doc_message_strings + assert public_message in onyx_doc_message_strings + assert private_message in onyx_doc_message_strings + assert message_to_delete not in onyx_doc_message_strings diff --git a/backend/tests/integration/multitenant_tests/syncing/test_search_permissions.py b/backend/tests/integration/multitenant_tests/syncing/test_search_permissions.py index fead77387f6..8d0fd60f251 100644 --- a/backend/tests/integration/multitenant_tests/syncing/test_search_permissions.py +++ b/backend/tests/integration/multitenant_tests/syncing/test_search_permissions.py @@ -1,4 +1,4 @@ -from danswer.db.models import UserRole +from onyx.db.models import UserRole from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.chat import ChatSessionManager diff --git a/backend/tests/integration/multitenant_tests/tenants/test_tenant_creation.py b/backend/tests/integration/multitenant_tests/tenants/test_tenant_creation.py index 33110653557..d9147686e9d 100644 --- a/backend/tests/integration/multitenant_tests/tenants/test_tenant_creation.py +++ b/backend/tests/integration/multitenant_tests/tenants/test_tenant_creation.py @@ -1,6 +1,6 @@ -from danswer.configs.constants import DocumentSource -from danswer.db.enums import AccessType -from danswer.db.models import UserRole +from onyx.configs.constants import DocumentSource +from onyx.db.enums import AccessType +from onyx.db.models import UserRole from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.connector import ConnectorManager from tests.integration.common_utils.managers.credential import CredentialManager diff --git a/backend/tests/integration/openai_assistants_api/test_threads.py b/backend/tests/integration/openai_assistants_api/test_threads.py index 4ae128b2612..619d693d861 100644 --- a/backend/tests/integration/openai_assistants_api/test_threads.py +++ b/backend/tests/integration/openai_assistants_api/test_threads.py @@ -2,7 +2,7 @@ import requests -from danswer.db.models import ChatSessionSharedStatus +from onyx.db.models import ChatSessionSharedStatus from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.test_models import DATestUser diff --git a/backend/tests/integration/tests/api_key/test_api_key.py b/backend/tests/integration/tests/api_key/test_api_key.py index 34023d897a5..5c21044b3ee 100644 --- a/backend/tests/integration/tests/api_key/test_api_key.py +++ b/backend/tests/integration/tests/api_key/test_api_key.py @@ -1,6 +1,6 @@ import requests -from danswer.auth.schemas import UserRole +from onyx.auth.schemas import UserRole from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers.user import UserManager diff --git a/backend/tests/integration/tests/connector/test_connector_creation.py b/backend/tests/integration/tests/connector/test_connector_creation.py index 61085c5a5d2..8e30342e035 100644 --- a/backend/tests/integration/tests/connector/test_connector_creation.py +++ b/backend/tests/integration/tests/connector/test_connector_creation.py @@ -2,7 +2,7 @@ from datetime import datetime from datetime import timezone -from danswer.server.documents.models import DocumentSource +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.user import UserManager from tests.integration.common_utils.test_models import DATestUser diff --git a/backend/tests/integration/tests/connector/test_connector_deletion.py b/backend/tests/integration/tests/connector/test_connector_deletion.py index 676ee4d9f4b..8878a502e2a 100644 --- a/backend/tests/integration/tests/connector/test_connector_deletion.py +++ b/backend/tests/integration/tests/connector/test_connector_deletion.py @@ -9,13 +9,13 @@ from sqlalchemy.orm import Session -from danswer.db.engine import get_sqlalchemy_engine -from danswer.db.enums import IndexingStatus -from danswer.db.index_attempt import create_index_attempt -from danswer.db.index_attempt import create_index_attempt_error -from danswer.db.models import IndexAttempt -from danswer.db.search_settings import get_current_search_settings -from danswer.server.documents.models import DocumentSource +from onyx.db.engine import get_sqlalchemy_engine +from onyx.db.enums import IndexingStatus +from onyx.db.index_attempt import create_index_attempt +from onyx.db.index_attempt import create_index_attempt_error +from onyx.db.models import IndexAttempt +from onyx.db.search_settings import get_current_search_settings +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.constants import NUM_DOCS from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers.cc_pair import CCPairManager diff --git a/backend/tests/integration/tests/dev_apis/test_knowledge_chat.py b/backend/tests/integration/tests/dev_apis/test_knowledge_chat.py index 475085c6777..e08449e0be7 100644 --- a/backend/tests/integration/tests/dev_apis/test_knowledge_chat.py +++ b/backend/tests/integration/tests/dev_apis/test_knowledge_chat.py @@ -1,6 +1,6 @@ import requests -from danswer.configs.constants import MessageType +from onyx.configs.constants import MessageType from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers.cc_pair import CCPairManager diff --git a/backend/tests/integration/tests/dev_apis/test_simple_chat_api.py b/backend/tests/integration/tests/dev_apis/test_simple_chat_api.py index 0ed40c758d0..cadb848a97d 100644 --- a/backend/tests/integration/tests/dev_apis/test_simple_chat_api.py +++ b/backend/tests/integration/tests/dev_apis/test_simple_chat_api.py @@ -2,7 +2,7 @@ import requests -from danswer.configs.constants import MessageType +from onyx.configs.constants import MessageType from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.constants import NUM_DOCS diff --git a/backend/tests/integration/tests/document_set/test_syncing.py b/backend/tests/integration/tests/document_set/test_syncing.py index ed00870663a..92a6039ab66 100644 --- a/backend/tests/integration/tests/document_set/test_syncing.py +++ b/backend/tests/integration/tests/document_set/test_syncing.py @@ -1,4 +1,4 @@ -from danswer.server.documents.models import DocumentSource +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.constants import NUM_DOCS from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers.cc_pair import CCPairManager diff --git a/backend/tests/integration/tests/permissions/test_cc_pair_permissions.py b/backend/tests/integration/tests/permissions/test_cc_pair_permissions.py index 19c2d7535a6..9e1b14f00be 100644 --- a/backend/tests/integration/tests/permissions/test_cc_pair_permissions.py +++ b/backend/tests/integration/tests/permissions/test_cc_pair_permissions.py @@ -5,8 +5,8 @@ import pytest from requests.exceptions import HTTPError -from danswer.db.enums import AccessType -from danswer.server.documents.models import DocumentSource +from onyx.db.enums import AccessType +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.connector import ConnectorManager from tests.integration.common_utils.managers.credential import CredentialManager diff --git a/backend/tests/integration/tests/permissions/test_connector_permissions.py b/backend/tests/integration/tests/permissions/test_connector_permissions.py index 9b4bc21f942..0af39e7674b 100644 --- a/backend/tests/integration/tests/permissions/test_connector_permissions.py +++ b/backend/tests/integration/tests/permissions/test_connector_permissions.py @@ -5,8 +5,8 @@ import pytest from requests.exceptions import HTTPError -from danswer.db.enums import AccessType -from danswer.server.documents.models import DocumentSource +from onyx.db.enums import AccessType +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.connector import ConnectorManager from tests.integration.common_utils.managers.user import DATestUser from tests.integration.common_utils.managers.user import UserManager diff --git a/backend/tests/integration/tests/permissions/test_credential_permissions.py b/backend/tests/integration/tests/permissions/test_credential_permissions.py index 7433389feb2..eaa71adb518 100644 --- a/backend/tests/integration/tests/permissions/test_credential_permissions.py +++ b/backend/tests/integration/tests/permissions/test_credential_permissions.py @@ -5,7 +5,7 @@ import pytest from requests.exceptions import HTTPError -from danswer.server.documents.models import DocumentSource +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.credential import CredentialManager from tests.integration.common_utils.managers.user import DATestUser from tests.integration.common_utils.managers.user import UserManager diff --git a/backend/tests/integration/tests/permissions/test_doc_set_permissions.py b/backend/tests/integration/tests/permissions/test_doc_set_permissions.py index e352d5eb303..aec7cdc78b1 100644 --- a/backend/tests/integration/tests/permissions/test_doc_set_permissions.py +++ b/backend/tests/integration/tests/permissions/test_doc_set_permissions.py @@ -1,8 +1,8 @@ import pytest from requests.exceptions import HTTPError -from danswer.db.enums import AccessType -from danswer.server.documents.models import DocumentSource +from onyx.db.enums import AccessType +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.document_set import DocumentSetManager from tests.integration.common_utils.managers.user import DATestUser diff --git a/backend/tests/integration/tests/permissions/test_user_role_permissions.py b/backend/tests/integration/tests/permissions/test_user_role_permissions.py index 5be49d25c5e..1dfabb01421 100644 --- a/backend/tests/integration/tests/permissions/test_user_role_permissions.py +++ b/backend/tests/integration/tests/permissions/test_user_role_permissions.py @@ -4,7 +4,7 @@ import pytest from requests.exceptions import HTTPError -from danswer.db.models import UserRole +from onyx.db.models import UserRole from tests.integration.common_utils.managers.user import DATestUser from tests.integration.common_utils.managers.user import UserManager from tests.integration.common_utils.managers.user_group import UserGroupManager diff --git a/backend/tests/integration/tests/permissions/test_whole_curator_flow.py b/backend/tests/integration/tests/permissions/test_whole_curator_flow.py index 53c1a0b8a94..0fa27cd823a 100644 --- a/backend/tests/integration/tests/permissions/test_whole_curator_flow.py +++ b/backend/tests/integration/tests/permissions/test_whole_curator_flow.py @@ -1,9 +1,9 @@ """ This test tests the happy path for curator permissions """ -from danswer.db.enums import AccessType -from danswer.db.models import UserRole -from danswer.server.documents.models import DocumentSource +from onyx.db.enums import AccessType +from onyx.db.models import UserRole +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.connector import ConnectorManager from tests.integration.common_utils.managers.credential import CredentialManager diff --git a/backend/tests/integration/tests/pruning/test_pruning.py b/backend/tests/integration/tests/pruning/test_pruning.py index beb1e8efbe9..96153db948c 100644 --- a/backend/tests/integration/tests/pruning/test_pruning.py +++ b/backend/tests/integration/tests/pruning/test_pruning.py @@ -14,8 +14,8 @@ from fastapi import FastAPI from fastapi.staticfiles import StaticFiles -from danswer.server.documents.models import DocumentSource -from danswer.utils.logger import setup_logger +from onyx.server.documents.models import DocumentSource +from onyx.utils.logger import setup_logger from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.user import UserManager diff --git a/backend/tests/integration/tests/query-history/test_query_history.py b/backend/tests/integration/tests/query-history/test_query_history.py index 2d8eab72ab4..f0cae20b1f6 100644 --- a/backend/tests/integration/tests/query-history/test_query_history.py +++ b/backend/tests/integration/tests/query-history/test_query_history.py @@ -5,8 +5,8 @@ import pytest import requests -from danswer.configs.constants import QAFeedbackType -from danswer.configs.constants import SessionType +from onyx.configs.constants import QAFeedbackType +from onyx.configs.constants import SessionType from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers.cc_pair import CCPairManager diff --git a/backend/tests/integration/tests/usergroup/test_user_group_deletion.py b/backend/tests/integration/tests/usergroup/test_user_group_deletion.py index 31d7f3d2035..05f075da5d0 100644 --- a/backend/tests/integration/tests/usergroup/test_user_group_deletion.py +++ b/backend/tests/integration/tests/usergroup/test_user_group_deletion.py @@ -8,7 +8,7 @@ - token_rate_limit (Not Implemented) - persona """ -from danswer.server.documents.models import DocumentSource +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.credential import CredentialManager from tests.integration.common_utils.managers.document_set import DocumentSetManager diff --git a/backend/tests/integration/tests/usergroup/test_usergroup_syncing.py b/backend/tests/integration/tests/usergroup/test_usergroup_syncing.py index 5d1ee3b1021..497d7ff64c6 100644 --- a/backend/tests/integration/tests/usergroup/test_usergroup_syncing.py +++ b/backend/tests/integration/tests/usergroup/test_usergroup_syncing.py @@ -1,4 +1,4 @@ -from danswer.server.documents.models import DocumentSource +from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.constants import NUM_DOCS from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers.cc_pair import CCPairManager diff --git a/backend/tests/regression/answer_quality/README.md b/backend/tests/regression/answer_quality/README.md index 27a0bd5ae96..0937528a6be 100644 --- a/backend/tests/regression/answer_quality/README.md +++ b/backend/tests/regression/answer_quality/README.md @@ -20,87 +20,96 @@ This Python script automates the process of running search quality tests for a b 4. Set up the PYTHONPATH permanently: Add the following line to your shell configuration file (e.g., `~/.bashrc`, `~/.zshrc`, or `~/.bash_profile`): ``` - export PYTHONPATH=$PYTHONPATH:/path/to/danswer/backend + export PYTHONPATH=$PYTHONPATH:/path/to/onyx/backend ``` - Replace `/path/to/danswer` with the actual path to your Danswer repository. + Replace `/path/to/onyx` with the actual path to your Onyx repository. After adding this line, restart your terminal or run `source ~/.bashrc` (or the appropriate config file) to apply the changes. -5. Navigate to Danswer repo: +5. Navigate to Onyx repo: + ``` -cd path/to/danswer +cd path/to/onyx ``` + 6. Navigate to the answer_quality folder: + ``` cd backend/tests/regression/answer_quality ``` + 7. To launch the evaluation environment, run the launch_eval_env.py script (this step can be skipped if you are running the env outside of docker, just leave "environment_name" blank): + ``` python launch_eval_env.py ``` + 8. Run the file_uploader.py script to upload the zip files located at the path "zipped_documents_file" + ``` python file_uploader.py ``` + 9. Run the run_qa.py script to ask questions from the jsonl located at the path "questions_file". This will hit the "query/answer-with-quote" API endpoint. + ``` python run_qa.py ``` Note: All data will be saved even after the containers are shut down. There are instructions below to re-launching docker containers using this data. -If you decide to run multiple UIs at the same time, the ports will increment upwards from 3000 (E.g. http://localhost:3001). +If you decide to run multiple UIs at the same time, the ports will increment upwards from 3000 (E.g. http://localhost:3001). To see which port the desired instance is on, look at the ports on the nginx container by running `docker ps` or using docker desktop. -Docker daemon must be running for this to work. +Docker daemon must be running for this to work. ## Configuration Edit `search_test_config.yaml` to set: - output_folder - - This is the folder where the folders for each test will go - - These folders will contain the postgres/vespa data as well as the results for each test + - This is the folder where the folders for each test will go + - These folders will contain the postgres/vespa data as well as the results for each test - zipped_documents_file - - The path to the zip file containing the files you'd like to test against + - The path to the zip file containing the files you'd like to test against - questions_file - - The path to the yaml containing the questions you'd like to test with + - The path to the yaml containing the questions you'd like to test with - commit_sha - - Set this to the SHA of the commit you want to run the test against - - You must clear all local changes if you want to use this option - - Set this to null if you want it to just use the code as is + - Set this to the SHA of the commit you want to run the test against + - You must clear all local changes if you want to use this option + - Set this to null if you want it to just use the code as is - clean_up_docker_containers - - Set this to true to automatically delete all docker containers, networks and volumes after the test + - Set this to true to automatically delete all docker containers, networks and volumes after the test - launch_web_ui - - Set this to true if you want to use the UI during/after the testing process + - Set this to true if you want to use the UI during/after the testing process - only_state - - Whether to only run Vespa and Postgres + - Whether to only run Vespa and Postgres - only_retrieve_docs - - Set true to only retrieve documents, not LLM response - - This is to save on API costs + - Set true to only retrieve documents, not LLM response + - This is to save on API costs - use_cloud_gpu - - Set to true or false depending on if you want to use the remote gpu - - Only need to set this if use_cloud_gpu is true + - Set to true or false depending on if you want to use the remote gpu + - Only need to set this if use_cloud_gpu is true - model_server_ip - - This is the ip of the remote model server - - Only need to set this if use_cloud_gpu is true + - This is the ip of the remote model server + - Only need to set this if use_cloud_gpu is true - model_server_port - - This is the port of the remote model server - - Only need to set this if use_cloud_gpu is true -- environment_name - - Use this if you would like to relaunch a previous test instance - - Input the env_name of the test you'd like to re-launch - - Leave empty to launch referencing local default network locations + - This is the port of the remote model server + - Only need to set this if use_cloud_gpu is true +- environment_name + - Use this if you would like to relaunch a previous test instance + - Input the env_name of the test you'd like to re-launch + - Leave empty to launch referencing local default network locations - limit - - Max number of questions you'd like to ask against the dataset - - Set to null for no limit + - Max number of questions you'd like to ask against the dataset + - Set to null for no limit - llm - - Fill this out according to the normal LLM seeding - + - Fill this out according to the normal LLM seeding ## Relaunching From Existing Data To launch an existing set of containers that has already completed indexing, set the environment_name variable. This will launch the docker containers mounted on the volumes of the indicated env_name and will not automatically index any documents or run any QA. -Once these containers are launched you can run file_uploader.py or run_qa.py (assuming you have run the steps in the Usage section above). -- file_uploader.py will upload and index additional zipped files located at the zipped_documents_file path. +Once these containers are launched you can run file_uploader.py or run_qa.py (assuming you have run the steps in the Usage section above). + +- file_uploader.py will upload and index additional zipped files located at the zipped_documents_file path. - run_qa.py will ask questions located at the questions_file path against the indexed documents. diff --git a/backend/tests/regression/answer_quality/api_utils.py b/backend/tests/regression/answer_quality/api_utils.py index c37d650788a..1a281a1bdd1 100644 --- a/backend/tests/regression/answer_quality/api_utils.py +++ b/backend/tests/regression/answer_quality/api_utils.py @@ -1,16 +1,16 @@ import requests from retry import retry -from danswer.chat.models import ThreadMessage -from danswer.configs.constants import DocumentSource -from danswer.configs.constants import MessageType -from danswer.connectors.models import InputType -from danswer.context.search.enums import OptionalSearchSetting -from danswer.context.search.models import IndexFilters -from danswer.context.search.models import RetrievalDetails -from danswer.db.enums import IndexingStatus -from danswer.server.documents.models import ConnectorBase -from ee.danswer.server.query_and_chat.models import OneShotQARequest +from ee.onyx.server.query_and_chat.models import OneShotQARequest +from onyx.chat.models import ThreadMessage +from onyx.configs.constants import DocumentSource +from onyx.configs.constants import MessageType +from onyx.connectors.models import InputType +from onyx.context.search.enums import OptionalSearchSetting +from onyx.context.search.models import IndexFilters +from onyx.context.search.models import RetrievalDetails +from onyx.db.enums import IndexingStatus +from onyx.server.documents.models import ConnectorBase from tests.regression.answer_quality.cli_utils import get_api_server_host_port GENERAL_HEADERS = {"Content-Type": "application/json"} diff --git a/backend/tests/regression/answer_quality/cli_utils.py b/backend/tests/regression/answer_quality/cli_utils.py index 874a6292dbc..0f0ed6e4018 100644 --- a/backend/tests/regression/answer_quality/cli_utils.py +++ b/backend/tests/regression/answer_quality/cli_utils.py @@ -149,7 +149,7 @@ def start_docker_compose( print("Starting Docker Compose...") os.chdir(os.path.dirname(__file__)) os.chdir("../../../../deployment/docker_compose/") - command = f"docker compose -f docker-compose.search-testing.yml -p danswer-stack-{env_name} up -d" + command = f"docker compose -f docker-compose.search-testing.yml -p onyx-stack-{env_name} up -d" command += " --build" command += " --force-recreate" @@ -185,7 +185,7 @@ def cleanup_docker(env_name: str) -> None: containers = [json.loads(line) for line in stdout.splitlines()] if not env_name: env_name = datetime.now().strftime("-%Y") - project_name = f"danswer-stack{env_name}" + project_name = f"onyx-stack{env_name}" containers_to_delete = [ c for c in containers if c["Names"].startswith(project_name) ] @@ -308,7 +308,7 @@ def restart_vespa_container(env_name: str) -> None: if __name__ == "__main__": """ Running this just cleans up the docker environment for the container indicated by environment_name - If no environment_name is indicated, will just clean up all danswer docker containers/volumes/networks + If no environment_name is indicated, will just clean up all onyx docker containers/volumes/networks Note: vespa/postgres mounts are not deleted """ current_dir = os.path.dirname(os.path.abspath(__file__)) diff --git a/backend/tests/regression/answer_quality/launch_eval_env.py b/backend/tests/regression/answer_quality/launch_eval_env.py index e701a1d42cf..d9f709469b2 100644 --- a/backend/tests/regression/answer_quality/launch_eval_env.py +++ b/backend/tests/regression/answer_quality/launch_eval_env.py @@ -20,7 +20,7 @@ def main() -> None: config = load_config("search_test_config.yaml") if config.environment_name: env_name = config.environment_name - print("launching danswer with environment name:", env_name) + print("launching onyx with environment name:", env_name) else: print("No env name defined. Not launching docker.") print( diff --git a/backend/tests/regression/answer_quality/run_qa.py b/backend/tests/regression/answer_quality/run_qa.py index f6dd0e0b558..4f421c0c848 100644 --- a/backend/tests/regression/answer_quality/run_qa.py +++ b/backend/tests/regression/answer_quality/run_qa.py @@ -193,6 +193,6 @@ def run_qa_test_and_save_results(env_name: str = "") -> None: if __name__ == "__main__": """ To run a different set of questions, update the questions_file in search_test_config.yaml - If there is more than one instance of Danswer running, specify the env_name in search_test_config.yaml + If there is more than one instance of Onyx running, specify the env_name in search_test_config.yaml """ run_qa_test_and_save_results() diff --git a/backend/tests/regression/answer_quality/search_test_config.yaml.template b/backend/tests/regression/answer_quality/search_test_config.yaml.template index eb813df57f3..ac69f976f99 100644 --- a/backend/tests/regression/answer_quality/search_test_config.yaml.template +++ b/backend/tests/regression/answer_quality/search_test_config.yaml.template @@ -2,7 +2,7 @@ # Don't forget to also update the .env_eval file with the correct values # Directory where test results will be saved -output_folder: "~/danswer_test_results" +output_folder: "~/onyx_test_results" # Path to the zip file containing sample documents zipped_documents_file: "~/sampledocs.zip" diff --git a/backend/tests/unit/danswer/connectors/gmail/thread.json b/backend/tests/unit/danswer/connectors/gmail/thread.json deleted file mode 100644 index 53f0b83ce3a..00000000000 --- a/backend/tests/unit/danswer/connectors/gmail/thread.json +++ /dev/null @@ -1,349 +0,0 @@ -{ - "id": "192edefb315737c3", - "messages": [ - { - "id": "192edeff0dc743cf", - "payload": { - "headers": [ - { - "name": "MIME-Version", - "value": "1.0" - }, - { - "name": "Date", - "value": "Sat, 2 Nov 2024 10:32:57 -0700" - }, - { - "name": "Message-ID", - "value": "" - }, - { - "name": "Subject", - "value": "Email Chain 1" - }, - { - "name": "From", - "value": "Test Admin Admin " - }, - { - "name": "To", - "value": "test-group-1@onyx-test.com" - }, - { - "name": "Content-Type", - "value": "multipart/alternative; boundary=\"0000000000004480480625f17117\"" - } - ], - "parts": [ - { - "mimeType": "text/plain", - "body": { - "data": "VGhpcyBpcyBlbWFpbCAxIGluIGNoYWluIDENCg==" - } - }, - { - "mimeType": "text/html", - "body": { - "data": "PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAxIGluIGNoYWluIDE8L2Rpdj4NCg==" - } - } - ] - } - }, - { - "id": "192edf07fbcc8b2c", - "payload": { - "headers": [ - { - "name": "Delivered-To", - "value": "admin@onyx-test.com" - }, - { - "name": "Received", - "value": "by 2002:a59:b3cc:0:b0:491:1bbc:5e54 with SMTP id g12csp1873533vqt; Sat, 2 Nov 2024 10:33:34 -0700 (PDT)" - }, - { - "name": "X-Received", - "value": "by 2002:a05:6102:1284:b0:4a9:555b:fb50 with SMTP id ada2fe7eead31-4a9555bfd21mr8428882137.20.1730568814436; Sat, 02 Nov 2024 10:33:34 -0700 (PDT)" - }, - { - "name": "ARC-Seal", - "value": "i=1; a=rsa-sha256; t=1730568814; cv=none; d=google.com; s=arc-20240605; b=A75GBczY/LN8OhNdpZ1VM3opx5VWU3HWYnwCIL9TLBqEpNz2X74TXNkCevJkImB3VF BkFY7gHg7d8oGdsQvUp2EEdRBXKoYT8P4PTc3ZSD2W8LYU2XCudIbA5xtGObELmI0h0f bCXT8dE7m6hGJPTg0WPSlkvGs2bY52bmSbCbrnrA/Mx/oyxYPzwv5cMw3CLMXo/8nOLO FAzrnMTKRqYtn/QvYjUne7PpVSYPk0Edg5261/jn9qatyyL8VePU4FriQTffjAC85Ayc jikVA5QnsYO79aXJE0SIw4xBHwtOgmyWhU9TPw2NfuQHZWrm39JudUYlmZb8MV4VpX6p otxw==" - }, - { - "name": "ARC-Message-Signature", - "value": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9Eo5wYdnqXP3axXBCAwTODK4DvptOqG5RNct/xfBak4=; fh=/JhVJcrFVXWWzpGRY8HXA/cCDTQzCntn8VCeyDmjzic=; b=bkhR3iHOUD64TOG3Mqfd9BMT/2IF9gHEjHZWR/tet5J05UKFhk2d4k69wuSLNJcxlF dB6zzgt1vvEnCbSV+XBCEG1zW76T/sN6Ldn7+5xomsGFYvTZsW4E7OJqxkedfdpFeWwc eBlgX765wnBs4ztktDhK6gO8igWx3CaYH5wbX72DV4wqcQpDNpMqNHK7sHrlOG2YJGzV 7i3tli4dJqu1zgQK+lo1or1QQyadFzhbwX2iFdSLTNSNR3s70kqqBOT69lDMv84dfKCp +hXE0uwjOY/9lGG9rO1/e5WWEDC2BSZ7wzjvvyBRjDG+lavBqTggUizd8W+MlRYXONAX t7Kg==; dara=google.com" - }, - { - "name": "ARC-Authentication-Results", - "value": "i=1; mx.google.com; dkim=pass header.i=@onyx-test-com.20230601.gappssmtp.com header.s=20230601 header.b=Z57TqzI7; spf=none (google.com: test_user_1@onyx-test.com does not designate permitted sender hosts) smtp.mailfrom=test_user_1@onyx-test.com; dara=pass header.i=@onyx-test.com" - }, - { - "name": "Return-Path", - "value": "" - }, - { - "name": "Received", - "value": "from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a1e0cc1a2514c-855dae589a1sor1192309241.6.2024.11.02.10.33.34 for (Google Transport Security); Sat, 02 Nov 2024 10:33:34 -0700 (PDT)" - }, - { - "name": "Received-SPF", - "value": "none (google.com: test_user_1@onyx-test.com does not designate permitted sender hosts) client-ip=209.85.220.41;" - }, - { - "name": "Authentication-Results", - "value": "mx.google.com; dkim=pass header.i=@onyx-test-com.20230601.gappssmtp.com header.s=20230601 header.b=Z57TqzI7; spf=none (google.com: test_user_1@onyx-test.com does not designate permitted sender hosts) smtp.mailfrom=test_user_1@onyx-test.com; dara=pass header.i=@onyx-test.com" - }, - { - "name": "DKIM-Signature", - "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=onyx-test-com.20230601.gappssmtp.com; s=20230601; t=1730568814; x=1731173614; darn=onyx-test.com; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=9Eo5wYdnqXP3axXBCAwTODK4DvptOqG5RNct/xfBak4=; b=Z57TqzI7sEwwOumQx0z6YhibC1x2CHlNmBjwyQT1mNOUScZbzo6nmH8Ydo7slsTfgZ rgwKEEYkf/CYlFWGUEzGzc22jVUCSMjNMFB0nEtfj+GPJaNjDR9FxjFLTUfSq64H/RCI eO9+oEAJHaa5QmceX2yiSJFXNqmVEMJNT+K6CnlbN5gW6CUD2tBt46vW83PVJgxKMc76 A7/eaDxdZDLUvpjHes4SvM7x0eBM9t7w9wb/jEjGqA54HI2YHVcxM4HJxrbCChYn8UoG 7+UOpfOmHTZLdLYgMtSqYanJ3BTENEdyVp2LIOZOhlUT7Hbr9esyeVyy765XTuRAWxmo DGPQ==" - }, - { - "name": "X-Google-DKIM-Signature", - "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730568814; x=1731173614; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9Eo5wYdnqXP3axXBCAwTODK4DvptOqG5RNct/xfBak4=; b=fxuobWT2rW8kvQ14LUHbJEJOdCM4uBP+Obo7jL4w0BvwLrBNNbMPqMUc8d8u17dnS7 gczFCprOr5PZnVNmOZMQvmRTJ6poTkWOGQhsOyDOSLNI0IzuaN2wh9qjmFez6Z9nTx3f Lo0I0uahwzNkExywHC9x0H3NOZlS4074qkyLJObgnOHa5vml8SEcChMuzOQuCSU9wNjO t26urEoct8LArf0K/xztjxpEpDCgnf4Cr/KmZfi4/2Sjv4jwQzkLVuiwADraHIJbLv1m UMNs92dakWYK0cBbuwOx/sYpUWWyhVmv6Q0LqXzJjtpY4Z0zsnpI2UCrkAdAOSh7geEJ LCnw==" - }, - { - "name": "X-Gm-Message-State", - "value": "AOJu0YyCYZOHIzoRHgMd7foUCpX2JYDwPS2XsTjWiMkkR364/mhFKFsQ vixTj7QM6pDecoDxn8pS0btM7b8z+cwo/8hFiYNgp26wK5L0aGymu+M8OuEk/73fuEthWVV0eko B9LvS5+qixa/oNO/HkRJpVTQmAH7OTT25KeZJj0Dd3x1JqsrfiNE=" - }, - { - "name": "X-Google-Smtp-Source", - "value": "AGHT+IHCMrQhOT9sgPUOQJL1oVfxMruiLg3BZ5DXqKMdQ7PYF2puka6Ovabv3BPg08CeyS1ovKydIdwHT2uleZkkAaU=" - }, - { - "name": "X-Received", - "value": "by 2002:a05:6102:5092:b0:4a3:e05e:f6a3 with SMTP id ada2fe7eead31-4a900e11589mr14462681137.3.1730568813787; Sat, 02 Nov 2024 10:33:33 -0700 (PDT)" - }, - { - "name": "MIME-Version", - "value": "1.0" - }, - { - "name": "References", - "value": "" - }, - { - "name": "In-Reply-To", - "value": "" - }, - { - "name": "From", - "value": "test_user_1 1 " - }, - { - "name": "Date", - "value": "Sat, 2 Nov 2024 10:33:22 -0700" - }, - { - "name": "Message-ID", - "value": "" - }, - { - "name": "Subject", - "value": "Re: Email Chain 1" - }, - { - "name": "To", - "value": "Test Admin Admin " - }, - { - "name": "Content-Type", - "value": "multipart/alternative; boundary=\"00000000000067dbf70625f1730f\"" - } - ], - "parts": [ - { - "mimeType": "text/plain", - "body": { - "data": "VGhpcyBpcyBlbWFpbCAyIGluIGNoYWluIDENCg0KT24gU2F0LCBOb3YgMiwgMjAyNCBhdCAxMDozM-KAr0FNIFRlc3QgQWRtaW4gQWRtaW4gPGFkbWluQG9ueXgtdGVzdC5jb20-DQp3cm90ZToNCg0KPiBUaGlzIGlzIGVtYWlsIDEgaW4gY2hhaW4gMQ0KPg0K" - } - }, - { - "mimeType": "text/html", - "body": { - "data": "PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAyIGluIGNoYWluIDE8L2Rpdj48YnI-PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj5PbiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0gVGVzdCBBZG1pbiBBZG1pbiAmbHQ7PGEgaHJlZj0ibWFpbHRvOmFkbWluQG9ueXgtdGVzdC5jb20iPmFkbWluQG9ueXgtdGVzdC5jb208L2E-Jmd0OyB3cm90ZTo8YnI-PC9kaXY-PGJsb2NrcXVvdGUgY2xhc3M9ImdtYWlsX3F1b3RlIiBzdHlsZT0ibWFyZ2luOjBweCAwcHggMHB4IDAuOGV4O2JvcmRlci1sZWZ0OjFweCBzb2xpZCByZ2IoMjA0LDIwNCwyMDQpO3BhZGRpbmctbGVmdDoxZXgiPjxkaXYgZGlyPSJsdHIiPlRoaXMgaXMgZW1haWwgMSBpbiBjaGFpbiAxPC9kaXY-DQo8L2Jsb2NrcXVvdGU-PC9kaXY-DQo=" - } - } - ] - } - }, - { - "id": "192edf157175fcec", - "payload": { - "headers": [ - { - "name": "MIME-Version", - "value": "1.0" - }, - { - "name": "Date", - "value": "Sat, 2 Nov 2024 10:34:29 -0700" - }, - { - "name": "References", - "value": " " - }, - { - "name": "In-Reply-To", - "value": "" - }, - { - "name": "Bcc", - "value": "test_user_3@onyx-test.com" - }, - { - "name": "Message-ID", - "value": "" - }, - { - "name": "Subject", - "value": "Fwd: Email Chain 1" - }, - { - "name": "From", - "value": "Test Admin Admin " - }, - { - "name": "To", - "value": "test_user_2 2 " - }, - { - "name": "Content-Type", - "value": "multipart/alternative; boundary=\"000000000000bf7afd0625f1764f\"" - } - ], - "parts": [ - { - "mimeType": "text/plain", - "body": { - "data": "VGhpcyBpcyBlbWFpbCAzIGluIGNoYWluIDENCg0KLS0tLS0tLS0tLSBGb3J3YXJkZWQgbWVzc2FnZSAtLS0tLS0tLS0NCkZyb206IHRlc3RfdXNlcl8xIDEgPHRlc3RfdXNlcl8xQG9ueXgtdGVzdC5jb20-DQpEYXRlOiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0NClN1YmplY3Q6IFJlOiBFbWFpbCBDaGFpbiAxDQpUbzogVGVzdCBBZG1pbiBBZG1pbiA8YWRtaW5Ab255eC10ZXN0LmNvbT4NCg0KDQpUaGlzIGlzIGVtYWlsIDIgaW4gY2hhaW4gMQ0KDQpPbiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0gVGVzdCBBZG1pbiBBZG1pbiA8YWRtaW5Ab255eC10ZXN0LmNvbT4NCndyb3RlOg0KDQo-IFRoaXMgaXMgZW1haWwgMSBpbiBjaGFpbiAxDQo-DQo=" - } - }, - { - "mimeType": "text/html", - "body": { - "data": "PGRpdiBkaXI9Imx0ciI-PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAzIGluIGNoYWluIDE8L2Rpdj48YnI-PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj4tLS0tLS0tLS0tIEZvcndhcmRlZCBtZXNzYWdlIC0tLS0tLS0tLTxicj5Gcm9tOiA8c3Ryb25nIGNsYXNzPSJnbWFpbF9zZW5kZXJuYW1lIiBkaXI9ImF1dG8iPnRlc3RfdXNlcl8xIDE8L3N0cm9uZz4gPHNwYW4gZGlyPSJhdXRvIj4mbHQ7PGEgaHJlZj0ibWFpbHRvOnRlc3RfdXNlcl8xQG9ueXgtdGVzdC5jb20iPnRlc3RfdXNlcl8xQG9ueXgtdGVzdC5jb208L2E-Jmd0Ozwvc3Bhbj48YnI-RGF0ZTogU2F0LCBOb3YgMiwgMjAyNCBhdCAxMDozM-KAr0FNPGJyPlN1YmplY3Q6IFJlOiBFbWFpbCBDaGFpbiAxPGJyPlRvOiBUZXN0IEFkbWluIEFkbWluICZsdDs8YSBocmVmPSJtYWlsdG86YWRtaW5Ab255eC10ZXN0LmNvbSI-YWRtaW5Ab255eC10ZXN0LmNvbTwvYT4mZ3Q7PGJyPjwvZGl2Pjxicj48YnI-PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAyIGluIGNoYWluIDE8L2Rpdj48YnI-PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj5PbiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0gVGVzdCBBZG1pbiBBZG1pbiAmbHQ7PGEgaHJlZj0ibWFpbHRvOmFkbWluQG9ueXgtdGVzdC5jb20iIHRhcmdldD0iX2JsYW5rIj5hZG1pbkBvbnl4LXRlc3QuY29tPC9hPiZndDsgd3JvdGU6PGJyPjwvZGl2PjxibG9ja3F1b3RlIGNsYXNzPSJnbWFpbF9xdW90ZSIgc3R5bGU9Im1hcmdpbjowcHggMHB4IDBweCAwLjhleDtib3JkZXItbGVmdDoxcHggc29saWQgcmdiKDIwNCwyMDQsMjA0KTtwYWRkaW5nLWxlZnQ6MWV4Ij48ZGl2IGRpcj0ibHRyIj5UaGlzIGlzIGVtYWlsIDEgaW4gY2hhaW4gMTwvZGl2Pg0KPC9ibG9ja3F1b3RlPjwvZGl2Pg0KPC9kaXY-PC9kaXY-DQo=" - } - } - ] - } - }, - { - "id": "192edf1e8f7ecbb4", - "payload": { - "headers": [ - { - "name": "Delivered-To", - "value": "admin@onyx-test.com" - }, - { - "name": "Received", - "value": "by 2002:a59:b3cc:0:b0:491:1bbc:5e54 with SMTP id g12csp1874156vqt; Sat, 2 Nov 2024 10:35:07 -0700 (PDT)" - }, - { - "name": "X-Received", - "value": "by 2002:a05:6122:319c:b0:50d:81f9:5210 with SMTP id 71dfb90a1353d-5105d128958mr15853812e0c.13.1730568906834; Sat, 02 Nov 2024 10:35:06 -0700 (PDT)" - }, - { - "name": "ARC-Seal", - "value": "i=1; a=rsa-sha256; t=1730568906; cv=none; d=google.com; s=arc-20240605; b=JUd7S6ql1poKM5ox92op2g2Z67AS8sEkp5f/S+Mr5+7KSichsjAwixWg/YhhRhvaY/ UcykrbdaAeWfCuGtJgSq1nr1z5hB3iAltv/D2XCdJdOXzVDpVvaV9lT/YU6266VKtsnq gFVKfjyMe/MnNKvDITQL67A2gRvhiR3XWxwEVvrMArMpUb9bbudlF/5L3MQY4BCIvWLL 9uBv1ZnclghscsxspoG3CkULkGqHGUTKq6bPoUn/hOljiVdsVVagoOwhbDEcyMRKUDnm 2t3H7iiujhlBIDbRoLJR/6C+A6AMyNKPAFA3axM6EXrTOADMZ8a0JqFj8O4rktYpRV+d zHxQ==" - }, - { - "name": "ARC-Message-Signature", - "value": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=K0g0X/4URFSC1nuXjI7ZESJA66WnWcqwgfHOUDQ/kQo=; fh=/JhVJcrFVXWWzpGRY8HXA/cCDTQzCntn8VCeyDmjzic=; b=IarHhl5g5tjBhlMRRXo6WwTzaFOI4Q3w4ebNunftDUHwzV7Qu1hY0y7r3SRNaBb+qD ZncYUI6PF/Oo7eMG65IloXfu+kHUI8NJMaoERUWgEk21Tj6cOSRO4x/W6V5PSX7a4lWZ K1cNdAlaiWI09Esv07Vel975Bgrd+XiCwoVgJAAslHOJ2bZwSYWzvwLqdkCRVrAGJQ9/ I80kvOnNVesIFdIR6SGrhdz8xNIIoe60k8PjJRzkmzy/tEeKCYBz6W+NW4xoIaAVmKUw RvjI8JozUVkGzh+LLyx64MakPCZPWM+ft+D35JodarYh+KesF+HV/Oe7rjaw7JXZ1WoE OdJQ==; dara=google.com" - }, - { - "name": "ARC-Authentication-Results", - "value": "i=1; mx.google.com; dkim=pass header.i=@onyx-test-com.20230601.gappssmtp.com header.s=20230601 header.b=1U8JkCbL; spf=none (google.com: test_user_3@onyx-test.com does not designate permitted sender hosts) smtp.mailfrom=test_user_3@onyx-test.com; dara=pass header.i=@onyx-test.com" - }, - { - "name": "Return-Path", - "value": "" - }, - { - "name": "Received", - "value": "from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 71dfb90a1353d-5106f3f9037sor1051490e0c.7.2024.11.02.10.35.06 for (Google Transport Security); Sat, 02 Nov 2024 10:35:06 -0700 (PDT)" - }, - { - "name": "Received-SPF", - "value": "none (google.com: test_user_3@onyx-test.com does not designate permitted sender hosts) client-ip=209.85.220.41;" - }, - { - "name": "Authentication-Results", - "value": "mx.google.com; dkim=pass header.i=@onyx-test-com.20230601.gappssmtp.com header.s=20230601 header.b=1U8JkCbL; spf=none (google.com: test_user_3@onyx-test.com does not designate permitted sender hosts) smtp.mailfrom=test_user_3@onyx-test.com; dara=pass header.i=@onyx-test.com" - }, - { - "name": "DKIM-Signature", - "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=onyx-test-com.20230601.gappssmtp.com; s=20230601; t=1730568906; x=1731173706; darn=onyx-test.com; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=K0g0X/4URFSC1nuXjI7ZESJA66WnWcqwgfHOUDQ/kQo=; b=1U8JkCbLjicGtH7otVX3QjKv/XK5fGnmOIVMTD/b9cO1w8ai2GwCuJbBo+z1IuGqto aRuNCcEqUIaFvVFiezvhL9xg7scIwHHvLOrSpmc0h0JMSx8q4kKaUGKEJpewsYvkStmr DYv/cUIeaPTIChSuUDV7FVMhf7jIyIaYry3i9/EIlw+on18nD30C9kXwds5yWW8XGvtR /OUuSdgJzuoNmypUt8v9Ebqd+LP23YTs+78/G1Ag+JjugxxF+C9cm7SxmooWueukRkm8 o8nQO5QVx/y/xsCZdM2XXcKCLcZIntuY48amlfFyIqrhG1/DEM6htD64meMGctNTptQf jHrw==" - }, - { - "name": "X-Google-DKIM-Signature", - "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730568906; x=1731173706; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K0g0X/4URFSC1nuXjI7ZESJA66WnWcqwgfHOUDQ/kQo=; b=J4+ozlusGGM1Hn95EZkDeYbExgkyOlAdcY6LcV4Wx1zeI78HtEXGgvqcZ5sP7HzS1X /A3i7WkgmjpC9bU2/zKLrfXDvYQ7udQwTJtKsKaUo4O65Al7Wtgz8e8rBDYikhqEEAZQ GbEwqp+qa+v0T4rPhkQKd4zpIE3AUd3eh5u5iF/UEYc1NcyV35uMGWRP4jOK6F67MwS7 73MgObcGqmBH48I4K+ITYAkNEMGOBpY6fheGxCxyDpcG5gbf8swlWX2Dd0EM9H72o+Xb jvAslOq1lZzPZUgyyZJ2wVEASxF8S7depiOLcTPKwsw+pgXIMAUBExBvu0u4PhO0qG+z pftQ==" - }, - { - "name": "X-Gm-Message-State", - "value": "AOJu0Yy2r0aT3w7HBU7t0JGla+x3AddG9WdnQT06r6T/HGZwZ9Wp9TUs Orb/HMtgvXivtYFkG14NJkMTBO4EqSynmzaxAvEheDXB1uYE2LS21XoqrvycvYQh3GUHBwUdS8L lE6BUjm4TJfXlZWAqKRxg4C0j1UFSuVdkXf6P1GCsdyKKTeS6A9eohw==" - }, - { - "name": "X-Google-Smtp-Source", - "value": "AGHT+IHXTB7Ar9w/Q3G3gCT19SVELYvWl30pNGuNiTmkYZgMWFS7YUWTkG/DS4/mrjMRXpYuclOLHv8BeOmw9Jovkr4=" - }, - { - "name": "X-Received", - "value": "by 2002:a05:6102:3a10:b0:4a9:49:26d2 with SMTP id ada2fe7eead31-4a90109fb68mr15589362137.29.1730568906301; Sat, 02 Nov 2024 10:35:06 -0700 (PDT)" - }, - { - "name": "MIME-Version", - "value": "1.0" - }, - { - "name": "References", - "value": " " - }, - { - "name": "In-Reply-To", - "value": "" - }, - { - "name": "From", - "value": "test_user_3 3 " - }, - { - "name": "Date", - "value": "Sat, 2 Nov 2024 10:34:55 -0700" - }, - { - "name": "Message-ID", - "value": "" - }, - { - "name": "Subject", - "value": "Re: Email Chain 1" - }, - { - "name": "To", - "value": "Test Admin Admin " - }, - { - "name": "Content-Type", - "value": "multipart/alternative; boundary=\"000000000000eb82a70625f178cf\"" - } - ], - "parts": [ - { - "mimeType": "text/plain", - "body": { - "data": "VGhpcyBpcyBlbWFpbCA0IGluIGNoYWluIDENCg0KT24gU2F0LCBOb3YgMiwgMjAyNCBhdCAxMDozNOKAr0FNIFRlc3QgQWRtaW4gQWRtaW4gPGFkbWluQG9ueXgtdGVzdC5jb20-DQp3cm90ZToNCg0KPiBUaGlzIGlzIGVtYWlsIDMgaW4gY2hhaW4gMQ0KPg0KPiAtLS0tLS0tLS0tIEZvcndhcmRlZCBtZXNzYWdlIC0tLS0tLS0tLQ0KPiBGcm9tOiB0ZXN0X3VzZXJfMSAxIDx0ZXN0X3VzZXJfMUBvbnl4LXRlc3QuY29tPg0KPiBEYXRlOiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0NCj4gU3ViamVjdDogUmU6IEVtYWlsIENoYWluIDENCj4gVG86IFRlc3QgQWRtaW4gQWRtaW4gPGFkbWluQG9ueXgtdGVzdC5jb20-DQo-DQo-DQo-IFRoaXMgaXMgZW1haWwgMiBpbiBjaGFpbiAxDQo-DQo-IE9uIFNhdCwgTm92IDIsIDIwMjQgYXQgMTA6MzPigK9BTSBUZXN0IEFkbWluIEFkbWluIDxhZG1pbkBvbnl4LXRlc3QuY29tPg0KPiB3cm90ZToNCj4NCj4-IFRoaXMgaXMgZW1haWwgMSBpbiBjaGFpbiAxDQo-Pg0KPg0K" - } - }, - { - "mimeType": "text/html", - "body": { - "data": "PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCA0IGluIGNoYWluIDE8YnIgY2xhc3M9ImdtYWlsLUFwcGxlLWludGVyY2hhbmdlLW5ld2xpbmUiPjwvZGl2Pjxicj48ZGl2IGNsYXNzPSJnbWFpbF9xdW90ZSI-PGRpdiBkaXI9Imx0ciIgY2xhc3M9ImdtYWlsX2F0dHIiPk9uIFNhdCwgTm92IDIsIDIwMjQgYXQgMTA6MzTigK9BTSBUZXN0IEFkbWluIEFkbWluICZsdDs8YSBocmVmPSJtYWlsdG86YWRtaW5Ab255eC10ZXN0LmNvbSI-YWRtaW5Ab255eC10ZXN0LmNvbTwvYT4mZ3Q7IHdyb3RlOjxicj48L2Rpdj48YmxvY2txdW90ZSBjbGFzcz0iZ21haWxfcXVvdGUiIHN0eWxlPSJtYXJnaW46MHB4IDBweCAwcHggMC44ZXg7Ym9yZGVyLWxlZnQ6MXB4IHNvbGlkIHJnYigyMDQsMjA0LDIwNCk7cGFkZGluZy1sZWZ0OjFleCI-PGRpdiBkaXI9Imx0ciI-PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAzIGluIGNoYWluIDE8L2Rpdj48YnI-PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj4tLS0tLS0tLS0tIEZvcndhcmRlZCBtZXNzYWdlIC0tLS0tLS0tLTxicj5Gcm9tOiA8c3Ryb25nIGNsYXNzPSJnbWFpbF9zZW5kZXJuYW1lIiBkaXI9ImF1dG8iPnRlc3RfdXNlcl8xIDE8L3N0cm9uZz4gPHNwYW4gZGlyPSJhdXRvIj4mbHQ7PGEgaHJlZj0ibWFpbHRvOnRlc3RfdXNlcl8xQG9ueXgtdGVzdC5jb20iIHRhcmdldD0iX2JsYW5rIj50ZXN0X3VzZXJfMUBvbnl4LXRlc3QuY29tPC9hPiZndDs8L3NwYW4-PGJyPkRhdGU6IFNhdCwgTm92IDIsIDIwMjQgYXQgMTA6MzPigK9BTTxicj5TdWJqZWN0OiBSZTogRW1haWwgQ2hhaW4gMTxicj5UbzogVGVzdCBBZG1pbiBBZG1pbiAmbHQ7PGEgaHJlZj0ibWFpbHRvOmFkbWluQG9ueXgtdGVzdC5jb20iIHRhcmdldD0iX2JsYW5rIj5hZG1pbkBvbnl4LXRlc3QuY29tPC9hPiZndDs8YnI-PC9kaXY-PGJyPjxicj48ZGl2IGRpcj0ibHRyIj5UaGlzIGlzIGVtYWlsIDIgaW4gY2hhaW4gMTwvZGl2Pjxicj48ZGl2IGNsYXNzPSJnbWFpbF9xdW90ZSI-PGRpdiBkaXI9Imx0ciIgY2xhc3M9ImdtYWlsX2F0dHIiPk9uIFNhdCwgTm92IDIsIDIwMjQgYXQgMTA6MzPigK9BTSBUZXN0IEFkbWluIEFkbWluICZsdDs8YSBocmVmPSJtYWlsdG86YWRtaW5Ab255eC10ZXN0LmNvbSIgdGFyZ2V0PSJfYmxhbmsiPmFkbWluQG9ueXgtdGVzdC5jb208L2E-Jmd0OyB3cm90ZTo8YnI-PC9kaXY-PGJsb2NrcXVvdGUgY2xhc3M9ImdtYWlsX3F1b3RlIiBzdHlsZT0ibWFyZ2luOjBweCAwcHggMHB4IDAuOGV4O2JvcmRlci1sZWZ0OjFweCBzb2xpZCByZ2IoMjA0LDIwNCwyMDQpO3BhZGRpbmctbGVmdDoxZXgiPjxkaXYgZGlyPSJsdHIiPlRoaXMgaXMgZW1haWwgMSBpbiBjaGFpbiAxPC9kaXY-DQo8L2Jsb2NrcXVvdGU-PC9kaXY-DQo8L2Rpdj48L2Rpdj4NCjwvYmxvY2txdW90ZT48L2Rpdj4NCg==" - } - } - ] - } - } - ] -} diff --git a/backend/tests/unit/danswer/chat/conftest.py b/backend/tests/unit/onyx/chat/conftest.py similarity index 85% rename from backend/tests/unit/danswer/chat/conftest.py rename to backend/tests/unit/onyx/chat/conftest.py index aed94d8fc49..5ee15601276 100644 --- a/backend/tests/unit/danswer/chat/conftest.py +++ b/backend/tests/unit/onyx/chat/conftest.py @@ -5,16 +5,16 @@ import pytest from langchain_core.messages import SystemMessage -from danswer.chat.models import AnswerStyleConfig -from danswer.chat.models import CitationConfig -from danswer.chat.models import LlmDoc -from danswer.chat.models import PromptConfig -from danswer.chat.prompt_builder.build import AnswerPromptBuilder -from danswer.configs.constants import DocumentSource -from danswer.llm.interfaces import LLMConfig -from danswer.tools.models import ToolResponse -from danswer.tools.tool_implementations.search.search_tool import SearchTool -from danswer.tools.tool_implementations.search_like_tool_utils import ( +from onyx.chat.models import AnswerStyleConfig +from onyx.chat.models import CitationConfig +from onyx.chat.models import LlmDoc +from onyx.chat.models import PromptConfig +from onyx.chat.prompt_builder.build import AnswerPromptBuilder +from onyx.configs.constants import DocumentSource +from onyx.llm.interfaces import LLMConfig +from onyx.tools.models import ToolResponse +from onyx.tools.tool_implementations.search.search_tool import SearchTool +from onyx.tools.tool_implementations.search_like_tool_utils import ( FINAL_CONTEXT_DOCUMENTS_ID, ) diff --git a/backend/tests/unit/danswer/chat/stream_processing/test_citation_processing.py b/backend/tests/unit/onyx/chat/stream_processing/test_citation_processing.py similarity index 96% rename from backend/tests/unit/danswer/chat/stream_processing/test_citation_processing.py rename to backend/tests/unit/onyx/chat/stream_processing/test_citation_processing.py index 178240c7176..a40f0392e3c 100644 --- a/backend/tests/unit/danswer/chat/stream_processing/test_citation_processing.py +++ b/backend/tests/unit/onyx/chat/stream_processing/test_citation_processing.py @@ -2,16 +2,16 @@ import pytest -from danswer.chat.models import CitationInfo -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import LlmDoc -from danswer.chat.stream_processing.citation_processing import CitationProcessor -from danswer.chat.stream_processing.utils import DocumentIdOrderMapping -from danswer.configs.constants import DocumentSource +from onyx.chat.models import CitationInfo +from onyx.chat.models import LlmDoc +from onyx.chat.models import OnyxAnswerPiece +from onyx.chat.stream_processing.citation_processing import CitationProcessor +from onyx.chat.stream_processing.utils import DocumentIdOrderMapping +from onyx.configs.constants import DocumentSource """ -This module contains tests for the citation extraction functionality in Danswer. +This module contains tests for the citation extraction functionality in Onyx. The tests focus on the `extract_citations_from_stream` function, which processes a stream of tokens and extracts citations, replacing them with properly formatted @@ -76,7 +76,7 @@ def process_text( stop_stream=None, ) - result: list[DanswerAnswerPiece | CitationInfo] = [] + result: list[OnyxAnswerPiece | CitationInfo] = [] for token in tokens: result.extend(processor.process_token(token)) result.extend(processor.process_token(None)) @@ -84,7 +84,7 @@ def process_text( final_answer_text = "" citations = [] for piece in result: - if isinstance(piece, DanswerAnswerPiece): + if isinstance(piece, OnyxAnswerPiece): final_answer_text += piece.answer_piece or "" elif isinstance(piece, CitationInfo): citations.append(piece) diff --git a/backend/tests/unit/danswer/chat/stream_processing/test_citation_substitution.py b/backend/tests/unit/onyx/chat/stream_processing/test_citation_substitution.py similarity index 88% rename from backend/tests/unit/danswer/chat/stream_processing/test_citation_substitution.py rename to backend/tests/unit/onyx/chat/stream_processing/test_citation_substitution.py index 841d76a3247..78ecad1a3ec 100644 --- a/backend/tests/unit/danswer/chat/stream_processing/test_citation_substitution.py +++ b/backend/tests/unit/onyx/chat/stream_processing/test_citation_substitution.py @@ -2,16 +2,16 @@ import pytest -from danswer.chat.models import CitationInfo -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import LlmDoc -from danswer.chat.stream_processing.citation_processing import CitationProcessor -from danswer.chat.stream_processing.utils import DocumentIdOrderMapping -from danswer.configs.constants import DocumentSource +from onyx.chat.models import CitationInfo +from onyx.chat.models import LlmDoc +from onyx.chat.models import OnyxAnswerPiece +from onyx.chat.stream_processing.citation_processing import CitationProcessor +from onyx.chat.stream_processing.utils import DocumentIdOrderMapping +from onyx.configs.constants import DocumentSource """ -This module contains tests for the citation extraction functionality in Danswer, +This module contains tests for the citation extraction functionality in Onyx, specifically the substitution of the number of document cited in the UI. (The LLM will see the sources post re-ranking and relevance check, the UI before these steps.) This module is a derivative of test_citation_processing.py. @@ -87,7 +87,7 @@ def process_text( stop_stream=None, ) - result: list[DanswerAnswerPiece | CitationInfo] = [] + result: list[OnyxAnswerPiece | CitationInfo] = [] for token in tokens: result.extend(processor.process_token(token)) result.extend(processor.process_token(None)) @@ -95,7 +95,7 @@ def process_text( final_answer_text = "" citations = [] for piece in result: - if isinstance(piece, DanswerAnswerPiece): + if isinstance(piece, OnyxAnswerPiece): final_answer_text += piece.answer_piece or "" elif isinstance(piece, CitationInfo): citations.append(piece) diff --git a/backend/tests/unit/danswer/chat/stream_processing/test_quotes_processing.py b/backend/tests/unit/onyx/chat/stream_processing/test_quotes_processing.py similarity index 88% rename from backend/tests/unit/danswer/chat/stream_processing/test_quotes_processing.py rename to backend/tests/unit/onyx/chat/stream_processing/test_quotes_processing.py index 7cb969ab7a6..b0a2cb69210 100644 --- a/backend/tests/unit/danswer/chat/stream_processing/test_quotes_processing.py +++ b/backend/tests/unit/onyx/chat/stream_processing/test_quotes_processing.py @@ -2,10 +2,10 @@ import pytest -from danswer.chat.stream_processing.quotes_processing import match_quotes_to_docs -from danswer.chat.stream_processing.quotes_processing import separate_answer_quotes -from danswer.configs.constants import DocumentSource -from danswer.context.search.models import InferenceChunk +from onyx.chat.stream_processing.quotes_processing import match_quotes_to_docs +from onyx.chat.stream_processing.quotes_processing import separate_answer_quotes +from onyx.configs.constants import DocumentSource +from onyx.context.search.models import InferenceChunk def test_passed_in_quotes() -> None: @@ -13,29 +13,29 @@ def test_passed_in_quotes() -> None: test_answer = """{ "answer": "I can assist "James" with that", "quotes": [ - "Danswer can just ingest PDFs as they are. How GOOD it embeds them depends on the formatting of your PDFs.", - "the ` danswer. llm ` package aims to provide a comprehensive framework." + "Onyx can just ingest PDFs as they are. How GOOD it embeds them depends on the formatting of your PDFs.", + "the ` onyx. llm ` package aims to provide a comprehensive framework." ] }""" answer, quotes = separate_answer_quotes(test_answer, is_json_prompt=True) assert answer == 'I can assist "James" with that' assert quotes == [ - "Danswer can just ingest PDFs as they are. How GOOD it embeds them depends on the formatting of your PDFs.", - "the ` danswer. llm ` package aims to provide a comprehensive framework.", + "Onyx can just ingest PDFs as they are. How GOOD it embeds them depends on the formatting of your PDFs.", + "the ` onyx. llm ` package aims to provide a comprehensive framework.", ] # Test case 2: Additional quotes test_answer = """{ "answer": "She said the resposne was "1" and I said the reponse was "2".", "quotes": [ - "Danswer can efficiently ingest PDFs, with the quality of embedding depending on the PDF's formatting." + "Onyx can efficiently ingest PDFs, with the quality of embedding depending on the PDF's formatting." ] }""" answer, quotes = separate_answer_quotes(test_answer, is_json_prompt=True) assert answer == 'She said the resposne was "1" and I said the reponse was "2".' assert quotes == [ - "Danswer can efficiently ingest PDFs, with the quality of embedding depending on the PDF's formatting.", + "Onyx can efficiently ingest PDFs, with the quality of embedding depending on the PDF's formatting.", ] diff --git a/backend/tests/unit/danswer/chat/test_answer.py b/backend/tests/unit/onyx/chat/test_answer.py similarity index 85% rename from backend/tests/unit/danswer/chat/test_answer.py rename to backend/tests/unit/onyx/chat/test_answer.py index 14bbec65434..2d483951e80 100644 --- a/backend/tests/unit/danswer/chat/test_answer.py +++ b/backend/tests/unit/onyx/chat/test_answer.py @@ -11,21 +11,21 @@ from langchain_core.messages import ToolCall from langchain_core.messages import ToolCallChunk -from danswer.chat.answer import Answer -from danswer.chat.models import AnswerStyleConfig -from danswer.chat.models import CitationInfo -from danswer.chat.models import DanswerAnswerPiece -from danswer.chat.models import LlmDoc -from danswer.chat.models import PromptConfig -from danswer.chat.models import StreamStopInfo -from danswer.chat.models import StreamStopReason -from danswer.llm.interfaces import LLM -from danswer.tools.force import ForceUseTool -from danswer.tools.models import ToolCallFinalResult -from danswer.tools.models import ToolCallKickoff -from danswer.tools.models import ToolResponse -from tests.unit.danswer.chat.conftest import DEFAULT_SEARCH_ARGS -from tests.unit.danswer.chat.conftest import QUERY +from onyx.chat.answer import Answer +from onyx.chat.models import AnswerStyleConfig +from onyx.chat.models import CitationInfo +from onyx.chat.models import LlmDoc +from onyx.chat.models import OnyxAnswerPiece +from onyx.chat.models import PromptConfig +from onyx.chat.models import StreamStopInfo +from onyx.chat.models import StreamStopReason +from onyx.llm.interfaces import LLM +from onyx.tools.force import ForceUseTool +from onyx.tools.models import ToolCallFinalResult +from onyx.tools.models import ToolCallKickoff +from onyx.tools.models import ToolResponse +from tests.unit.onyx.chat.conftest import DEFAULT_SEARCH_ARGS +from tests.unit.onyx.chat.conftest import QUERY @pytest.fixture @@ -50,13 +50,13 @@ def test_basic_answer(answer_instance: Answer) -> None: output = list(answer_instance.processed_streamed_output) assert len(output) == 2 - assert isinstance(output[0], DanswerAnswerPiece) - assert isinstance(output[1], DanswerAnswerPiece) + assert isinstance(output[0], OnyxAnswerPiece) + assert isinstance(output[1], OnyxAnswerPiece) full_answer = "".join( piece.answer_piece for piece in output - if isinstance(piece, DanswerAnswerPiece) and piece.answer_piece is not None + if isinstance(piece, OnyxAnswerPiece) and piece.answer_piece is not None ) assert full_answer == "This is a mock answer." @@ -151,13 +151,13 @@ def test_answer_with_search_call( tool_args=expected_tool_args, tool_result=[json.loads(doc.model_dump_json()) for doc in mock_search_results], ) - assert output[3] == DanswerAnswerPiece(answer_piece="Based on the search results, ") + assert output[3] == OnyxAnswerPiece(answer_piece="Based on the search results, ") expected_citation = CitationInfo(citation_num=1, document_id="doc1") assert output[4] == expected_citation - assert output[5] == DanswerAnswerPiece( + assert output[5] == OnyxAnswerPiece( answer_piece="the answer is abc[[1]](https://example.com/doc1). " ) - assert output[6] == DanswerAnswerPiece(answer_piece="This is some other stuff.") + assert output[6] == OnyxAnswerPiece(answer_piece="This is some other stuff.") expected_answer = ( "Based on the search results, " @@ -167,7 +167,7 @@ def test_answer_with_search_call( full_answer = "".join( piece.answer_piece for piece in output - if isinstance(piece, DanswerAnswerPiece) and piece.answer_piece is not None + if isinstance(piece, OnyxAnswerPiece) and piece.answer_piece is not None ) assert full_answer == expected_answer @@ -242,13 +242,13 @@ def test_answer_with_search_no_tool_calling( tool_args=DEFAULT_SEARCH_ARGS, tool_result=[json.loads(doc.model_dump_json()) for doc in mock_search_results], ) - assert output[3] == DanswerAnswerPiece(answer_piece="Based on the search results, ") + assert output[3] == OnyxAnswerPiece(answer_piece="Based on the search results, ") expected_citation = CitationInfo(citation_num=1, document_id="doc1") assert output[4] == expected_citation - assert output[5] == DanswerAnswerPiece( + assert output[5] == OnyxAnswerPiece( answer_piece="the answer is abc[[1]](https://example.com/doc1). " ) - assert output[6] == DanswerAnswerPiece(answer_piece="This is some other stuff.") + assert output[6] == OnyxAnswerPiece(answer_piece="This is some other stuff.") expected_answer = ( "Based on the search results, " @@ -304,8 +304,8 @@ def test_is_cancelled(answer_instance: Answer) -> None: connection_status["connected"] = False assert len(output) == 3 - assert output[0] == DanswerAnswerPiece(answer_piece="This is the ") - assert output[1] == DanswerAnswerPiece(answer_piece="first part.") + assert output[0] == OnyxAnswerPiece(answer_piece="This is the ") + assert output[1] == OnyxAnswerPiece(answer_piece="first part.") assert output[2] == StreamStopInfo(stop_reason=StreamStopReason.CANCELLED) # Verify that the stream was cancelled diff --git a/backend/tests/unit/danswer/chat/test_prune_and_merge.py b/backend/tests/unit/onyx/chat/test_prune_and_merge.py similarity index 97% rename from backend/tests/unit/danswer/chat/test_prune_and_merge.py rename to backend/tests/unit/onyx/chat/test_prune_and_merge.py index 2741a56526d..bcc471748bd 100644 --- a/backend/tests/unit/danswer/chat/test_prune_and_merge.py +++ b/backend/tests/unit/onyx/chat/test_prune_and_merge.py @@ -1,9 +1,9 @@ import pytest -from danswer.chat.prune_and_merge import _merge_sections -from danswer.configs.constants import DocumentSource -from danswer.context.search.models import InferenceChunk -from danswer.context.search.models import InferenceSection +from onyx.chat.prune_and_merge import _merge_sections +from onyx.configs.constants import DocumentSource +from onyx.context.search.models import InferenceChunk +from onyx.context.search.models import InferenceSection # This large test accounts for all of the following: diff --git a/backend/tests/unit/danswer/chat/test_skip_gen_ai.py b/backend/tests/unit/onyx/chat/test_skip_gen_ai.py similarity index 93% rename from backend/tests/unit/danswer/chat/test_skip_gen_ai.py rename to backend/tests/unit/onyx/chat/test_skip_gen_ai.py index 772ec52a6ca..e380b4aaaac 100644 --- a/backend/tests/unit/danswer/chat/test_skip_gen_ai.py +++ b/backend/tests/unit/onyx/chat/test_skip_gen_ai.py @@ -5,12 +5,12 @@ import pytest from pytest_mock import MockerFixture -from danswer.chat.answer import Answer -from danswer.chat.answer import AnswerStream -from danswer.chat.models import AnswerStyleConfig -from danswer.chat.models import PromptConfig -from danswer.tools.force import ForceUseTool -from danswer.tools.tool_implementations.search.search_tool import SearchTool +from onyx.chat.answer import Answer +from onyx.chat.answer import AnswerStream +from onyx.chat.models import AnswerStyleConfig +from onyx.chat.models import PromptConfig +from onyx.tools.force import ForceUseTool +from onyx.tools.tool_implementations.search.search_tool import SearchTool from tests.regression.answer_quality.run_qa import _process_and_write_query_results diff --git a/backend/tests/unit/danswer/connectors/confluence/test_rate_limit_handler.py b/backend/tests/unit/onyx/connectors/confluence/test_rate_limit_handler.py similarity index 96% rename from backend/tests/unit/danswer/connectors/confluence/test_rate_limit_handler.py rename to backend/tests/unit/onyx/connectors/confluence/test_rate_limit_handler.py index d1f263a7793..ed77d77640b 100644 --- a/backend/tests/unit/danswer/connectors/confluence/test_rate_limit_handler.py +++ b/backend/tests/unit/onyx/connectors/confluence/test_rate_limit_handler.py @@ -3,7 +3,7 @@ import pytest from requests import HTTPError -from danswer.connectors.confluence.onyx_confluence import ( +from onyx.connectors.confluence.onyx_confluence import ( handle_confluence_rate_limit, ) diff --git a/backend/tests/unit/danswer/connectors/cross_connector_utils/test_html_utils.py b/backend/tests/unit/onyx/connectors/cross_connector_utils/test_html_utils.py similarity index 83% rename from backend/tests/unit/danswer/connectors/cross_connector_utils/test_html_utils.py rename to backend/tests/unit/onyx/connectors/cross_connector_utils/test_html_utils.py index f14a92faa3a..9ddc1941bb5 100644 --- a/backend/tests/unit/danswer/connectors/cross_connector_utils/test_html_utils.py +++ b/backend/tests/unit/onyx/connectors/cross_connector_utils/test_html_utils.py @@ -1,6 +1,6 @@ import pathlib -from danswer.file_processing.html_utils import parse_html_page_basic +from onyx.file_processing.html_utils import parse_html_page_basic def test_parse_table() -> None: diff --git a/backend/tests/unit/danswer/connectors/cross_connector_utils/test_rate_limit.py b/backend/tests/unit/onyx/connectors/cross_connector_utils/test_rate_limit.py similarity index 88% rename from backend/tests/unit/danswer/connectors/cross_connector_utils/test_rate_limit.py rename to backend/tests/unit/onyx/connectors/cross_connector_utils/test_rate_limit.py index 471ef424f15..81a0cef1adc 100644 --- a/backend/tests/unit/danswer/connectors/cross_connector_utils/test_rate_limit.py +++ b/backend/tests/unit/onyx/connectors/cross_connector_utils/test_rate_limit.py @@ -1,6 +1,6 @@ import time -from danswer.connectors.cross_connector_utils.rate_limit_wrapper import ( +from onyx.connectors.cross_connector_utils.rate_limit_wrapper import ( rate_limit_builder, ) diff --git a/backend/tests/unit/danswer/connectors/cross_connector_utils/test_table.html b/backend/tests/unit/onyx/connectors/cross_connector_utils/test_table.html similarity index 100% rename from backend/tests/unit/danswer/connectors/cross_connector_utils/test_table.html rename to backend/tests/unit/onyx/connectors/cross_connector_utils/test_table.html diff --git a/backend/tests/unit/danswer/connectors/gmail/test_connector.py b/backend/tests/unit/onyx/connectors/gmail/test_connector.py similarity index 86% rename from backend/tests/unit/danswer/connectors/gmail/test_connector.py rename to backend/tests/unit/onyx/connectors/gmail/test_connector.py index 31661cbcc06..8508f89aef0 100644 --- a/backend/tests/unit/danswer/connectors/gmail/test_connector.py +++ b/backend/tests/unit/onyx/connectors/gmail/test_connector.py @@ -2,11 +2,11 @@ import json import os -from danswer.configs.constants import DocumentSource -from danswer.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc -from danswer.connectors.gmail.connector import _build_time_range_query -from danswer.connectors.gmail.connector import thread_to_document -from danswer.connectors.models import Document +from onyx.configs.constants import DocumentSource +from onyx.connectors.cross_connector_utils.miscellaneous_utils import time_str_to_utc +from onyx.connectors.gmail.connector import _build_time_range_query +from onyx.connectors.gmail.connector import thread_to_document +from onyx.connectors.models import Document def test_thread_to_document() -> None: diff --git a/backend/tests/unit/onyx/connectors/gmail/thread.json b/backend/tests/unit/onyx/connectors/gmail/thread.json new file mode 100644 index 00000000000..9b27f466318 --- /dev/null +++ b/backend/tests/unit/onyx/connectors/gmail/thread.json @@ -0,0 +1,349 @@ +{ + "id": "192edefb315737c3", + "messages": [ + { + "id": "192edeff0dc743cf", + "payload": { + "headers": [ + { + "name": "MIME-Version", + "value": "1.0" + }, + { + "name": "Date", + "value": "Sat, 2 Nov 2024 10:32:57 -0700" + }, + { + "name": "Message-ID", + "value": "" + }, + { + "name": "Subject", + "value": "Email Chain 1" + }, + { + "name": "From", + "value": "Test Admin Admin " + }, + { + "name": "To", + "value": "test-group-1@onyx-test.com" + }, + { + "name": "Content-Type", + "value": "multipart/alternative; boundary=\"0000000000004480480625f17117\"" + } + ], + "parts": [ + { + "mimeType": "text/plain", + "body": { + "data": "VGhpcyBpcyBlbWFpbCAxIGluIGNoYWluIDENCg==" + } + }, + { + "mimeType": "text/html", + "body": { + "data": "PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAxIGluIGNoYWluIDE8L2Rpdj4NCg==" + } + } + ] + } + }, + { + "id": "192edf07fbcc8b2c", + "payload": { + "headers": [ + { + "name": "Delivered-To", + "value": "admin@danswer-test.com" + }, + { + "name": "Received", + "value": "by 2002:a59:b3cc:0:b0:491:1bbc:5e54 with SMTP id g12csp1873533vqt; Sat, 2 Nov 2024 10:33:34 -0700 (PDT)" + }, + { + "name": "X-Received", + "value": "by 2002:a05:6102:1284:b0:4a9:555b:fb50 with SMTP id ada2fe7eead31-4a9555bfd21mr8428882137.20.1730568814436; Sat, 02 Nov 2024 10:33:34 -0700 (PDT)" + }, + { + "name": "ARC-Seal", + "value": "i=1; a=rsa-sha256; t=1730568814; cv=none; d=google.com; s=arc-20240605; b=A75GBczY/LN8OhNdpZ1VM3opx5VWU3HWYnwCIL9TLBqEpNz2X74TXNkCevJkImB3VF BkFY7gHg7d8oGdsQvUp2EEdRBXKoYT8P4PTc3ZSD2W8LYU2XCudIbA5xtGObELmI0h0f bCXT8dE7m6hGJPTg0WPSlkvGs2bY52bmSbCbrnrA/Mx/oyxYPzwv5cMw3CLMXo/8nOLO FAzrnMTKRqYtn/QvYjUne7PpVSYPk0Edg5261/jn9qatyyL8VePU4FriQTffjAC85Ayc jikVA5QnsYO79aXJE0SIw4xBHwtOgmyWhU9TPw2NfuQHZWrm39JudUYlmZb8MV4VpX6p otxw==" + }, + { + "name": "ARC-Message-Signature", + "value": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9Eo5wYdnqXP3axXBCAwTODK4DvptOqG5RNct/xfBak4=; fh=/JhVJcrFVXWWzpGRY8HXA/cCDTQzCntn8VCeyDmjzic=; b=bkhR3iHOUD64TOG3Mqfd9BMT/2IF9gHEjHZWR/tet5J05UKFhk2d4k69wuSLNJcxlF dB6zzgt1vvEnCbSV+XBCEG1zW76T/sN6Ldn7+5xomsGFYvTZsW4E7OJqxkedfdpFeWwc eBlgX765wnBs4ztktDhK6gO8igWx3CaYH5wbX72DV4wqcQpDNpMqNHK7sHrlOG2YJGzV 7i3tli4dJqu1zgQK+lo1or1QQyadFzhbwX2iFdSLTNSNR3s70kqqBOT69lDMv84dfKCp +hXE0uwjOY/9lGG9rO1/e5WWEDC2BSZ7wzjvvyBRjDG+lavBqTggUizd8W+MlRYXONAX t7Kg==; dara=google.com" + }, + { + "name": "ARC-Authentication-Results", + "value": "i=1; mx.google.com; dkim=pass header.i=@onyx-test-com.20230601.gappssmtp.com header.s=20230601 header.b=Z57TqzI7; spf=none (google.com: test_user_1@onyx-test.com does not designate permitted sender hosts) smtp.mailfrom=test_user_1@onyx-test.com; dara=pass header.i=@onyx-test.com" + }, + { + "name": "Return-Path", + "value": "" + }, + { + "name": "Received", + "value": "from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a1e0cc1a2514c-855dae589a1sor1192309241.6.2024.11.02.10.33.34 for (Google Transport Security); Sat, 02 Nov 2024 10:33:34 -0700 (PDT)" + }, + { + "name": "Received-SPF", + "value": "none (google.com: test_user_1@onyx-test.com does not designate permitted sender hosts) client-ip=209.85.220.41;" + }, + { + "name": "Authentication-Results", + "value": "mx.google.com; dkim=pass header.i=@onyx-test-com.20230601.gappssmtp.com header.s=20230601 header.b=Z57TqzI7; spf=none (google.com: test_user_1@onyx-test.com does not designate permitted sender hosts) smtp.mailfrom=test_user_1@onyx-test.com; dara=pass header.i=@onyx-test.com" + }, + { + "name": "DKIM-Signature", + "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=onyx-test-com.20230601.gappssmtp.com; s=20230601; t=1730568814; x=1731173614; darn=onyx-test.com; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=9Eo5wYdnqXP3axXBCAwTODK4DvptOqG5RNct/xfBak4=; b=Z57TqzI7sEwwOumQx0z6YhibC1x2CHlNmBjwyQT1mNOUScZbzo6nmH8Ydo7slsTfgZ rgwKEEYkf/CYlFWGUEzGzc22jVUCSMjNMFB0nEtfj+GPJaNjDR9FxjFLTUfSq64H/RCI eO9+oEAJHaa5QmceX2yiSJFXNqmVEMJNT+K6CnlbN5gW6CUD2tBt46vW83PVJgxKMc76 A7/eaDxdZDLUvpjHes4SvM7x0eBM9t7w9wb/jEjGqA54HI2YHVcxM4HJxrbCChYn8UoG 7+UOpfOmHTZLdLYgMtSqYanJ3BTENEdyVp2LIOZOhlUT7Hbr9esyeVyy765XTuRAWxmo DGPQ==" + }, + { + "name": "X-Google-DKIM-Signature", + "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730568814; x=1731173614; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9Eo5wYdnqXP3axXBCAwTODK4DvptOqG5RNct/xfBak4=; b=fxuobWT2rW8kvQ14LUHbJEJOdCM4uBP+Obo7jL4w0BvwLrBNNbMPqMUc8d8u17dnS7 gczFCprOr5PZnVNmOZMQvmRTJ6poTkWOGQhsOyDOSLNI0IzuaN2wh9qjmFez6Z9nTx3f Lo0I0uahwzNkExywHC9x0H3NOZlS4074qkyLJObgnOHa5vml8SEcChMuzOQuCSU9wNjO t26urEoct8LArf0K/xztjxpEpDCgnf4Cr/KmZfi4/2Sjv4jwQzkLVuiwADraHIJbLv1m UMNs92dakWYK0cBbuwOx/sYpUWWyhVmv6Q0LqXzJjtpY4Z0zsnpI2UCrkAdAOSh7geEJ LCnw==" + }, + { + "name": "X-Gm-Message-State", + "value": "AOJu0YyCYZOHIzoRHgMd7foUCpX2JYDwPS2XsTjWiMkkR364/mhFKFsQ vixTj7QM6pDecoDxn8pS0btM7b8z+cwo/8hFiYNgp26wK5L0aGymu+M8OuEk/73fuEthWVV0eko B9LvS5+qixa/oNO/HkRJpVTQmAH7OTT25KeZJj0Dd3x1JqsrfiNE=" + }, + { + "name": "X-Google-Smtp-Source", + "value": "AGHT+IHCMrQhOT9sgPUOQJL1oVfxMruiLg3BZ5DXqKMdQ7PYF2puka6Ovabv3BPg08CeyS1ovKydIdwHT2uleZkkAaU=" + }, + { + "name": "X-Received", + "value": "by 2002:a05:6102:5092:b0:4a3:e05e:f6a3 with SMTP id ada2fe7eead31-4a900e11589mr14462681137.3.1730568813787; Sat, 02 Nov 2024 10:33:33 -0700 (PDT)" + }, + { + "name": "MIME-Version", + "value": "1.0" + }, + { + "name": "References", + "value": "" + }, + { + "name": "In-Reply-To", + "value": "" + }, + { + "name": "From", + "value": "test_user_1 1 " + }, + { + "name": "Date", + "value": "Sat, 2 Nov 2024 10:33:22 -0700" + }, + { + "name": "Message-ID", + "value": "" + }, + { + "name": "Subject", + "value": "Re: Email Chain 1" + }, + { + "name": "To", + "value": "Test Admin Admin " + }, + { + "name": "Content-Type", + "value": "multipart/alternative; boundary=\"00000000000067dbf70625f1730f\"" + } + ], + "parts": [ + { + "mimeType": "text/plain", + "body": { + "data": "VGhpcyBpcyBlbWFpbCAyIGluIGNoYWluIDENCg0KT24gU2F0LCBOb3YgMiwgMjAyNCBhdCAxMDozM-KAr0FNIFRlc3QgQWRtaW4gQWRtaW4gPGFkbWluQG9ueXgtdGVzdC5jb20-DQp3cm90ZToNCg0KPiBUaGlzIGlzIGVtYWlsIDEgaW4gY2hhaW4gMQ0KPg0K" + } + }, + { + "mimeType": "text/html", + "body": { + "data": "PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAyIGluIGNoYWluIDE8L2Rpdj48YnI-PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj5PbiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0gVGVzdCBBZG1pbiBBZG1pbiAmbHQ7PGEgaHJlZj0ibWFpbHRvOmFkbWluQG9ueXgtdGVzdC5jb20iPmFkbWluQG9ueXgtdGVzdC5jb208L2E-Jmd0OyB3cm90ZTo8YnI-PC9kaXY-PGJsb2NrcXVvdGUgY2xhc3M9ImdtYWlsX3F1b3RlIiBzdHlsZT0ibWFyZ2luOjBweCAwcHggMHB4IDAuOGV4O2JvcmRlci1sZWZ0OjFweCBzb2xpZCByZ2IoMjA0LDIwNCwyMDQpO3BhZGRpbmctbGVmdDoxZXgiPjxkaXYgZGlyPSJsdHIiPlRoaXMgaXMgZW1haWwgMSBpbiBjaGFpbiAxPC9kaXY-DQo8L2Jsb2NrcXVvdGU-PC9kaXY-DQo=" + } + } + ] + } + }, + { + "id": "192edf157175fcec", + "payload": { + "headers": [ + { + "name": "MIME-Version", + "value": "1.0" + }, + { + "name": "Date", + "value": "Sat, 2 Nov 2024 10:34:29 -0700" + }, + { + "name": "References", + "value": " " + }, + { + "name": "In-Reply-To", + "value": "" + }, + { + "name": "Bcc", + "value": "test_user_3@onyx-test.com" + }, + { + "name": "Message-ID", + "value": "" + }, + { + "name": "Subject", + "value": "Fwd: Email Chain 1" + }, + { + "name": "From", + "value": "Test Admin Admin " + }, + { + "name": "To", + "value": "test_user_2 2 " + }, + { + "name": "Content-Type", + "value": "multipart/alternative; boundary=\"000000000000bf7afd0625f1764f\"" + } + ], + "parts": [ + { + "mimeType": "text/plain", + "body": { + "data": "VGhpcyBpcyBlbWFpbCAzIGluIGNoYWluIDENCg0KLS0tLS0tLS0tLSBGb3J3YXJkZWQgbWVzc2FnZSAtLS0tLS0tLS0NCkZyb206IHRlc3RfdXNlcl8xIDEgPHRlc3RfdXNlcl8xQG9ueXgtdGVzdC5jb20-DQpEYXRlOiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0NClN1YmplY3Q6IFJlOiBFbWFpbCBDaGFpbiAxDQpUbzogVGVzdCBBZG1pbiBBZG1pbiA8YWRtaW5Ab255eC10ZXN0LmNvbT4NCg0KDQpUaGlzIGlzIGVtYWlsIDIgaW4gY2hhaW4gMQ0KDQpPbiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0gVGVzdCBBZG1pbiBBZG1pbiA8YWRtaW5Ab255eC10ZXN0LmNvbT4NCndyb3RlOg0KDQo-IFRoaXMgaXMgZW1haWwgMSBpbiBjaGFpbiAxDQo-DQo=" + } + }, + { + "mimeType": "text/html", + "body": { + "data": "PGRpdiBkaXI9Imx0ciI-PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAzIGluIGNoYWluIDE8L2Rpdj48YnI-PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj4tLS0tLS0tLS0tIEZvcndhcmRlZCBtZXNzYWdlIC0tLS0tLS0tLTxicj5Gcm9tOiA8c3Ryb25nIGNsYXNzPSJnbWFpbF9zZW5kZXJuYW1lIiBkaXI9ImF1dG8iPnRlc3RfdXNlcl8xIDE8L3N0cm9uZz4gPHNwYW4gZGlyPSJhdXRvIj4mbHQ7PGEgaHJlZj0ibWFpbHRvOnRlc3RfdXNlcl8xQG9ueXgtdGVzdC5jb20iPnRlc3RfdXNlcl8xQG9ueXgtdGVzdC5jb208L2E-Jmd0Ozwvc3Bhbj48YnI-RGF0ZTogU2F0LCBOb3YgMiwgMjAyNCBhdCAxMDozM-KAr0FNPGJyPlN1YmplY3Q6IFJlOiBFbWFpbCBDaGFpbiAxPGJyPlRvOiBUZXN0IEFkbWluIEFkbWluICZsdDs8YSBocmVmPSJtYWlsdG86YWRtaW5Ab255eC10ZXN0LmNvbSI-YWRtaW5Ab255eC10ZXN0LmNvbTwvYT4mZ3Q7PGJyPjwvZGl2Pjxicj48YnI-PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAyIGluIGNoYWluIDE8L2Rpdj48YnI-PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj5PbiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0gVGVzdCBBZG1pbiBBZG1pbiAmbHQ7PGEgaHJlZj0ibWFpbHRvOmFkbWluQG9ueXgtdGVzdC5jb20iIHRhcmdldD0iX2JsYW5rIj5hZG1pbkBvbnl4LXRlc3QuY29tPC9hPiZndDsgd3JvdGU6PGJyPjwvZGl2PjxibG9ja3F1b3RlIGNsYXNzPSJnbWFpbF9xdW90ZSIgc3R5bGU9Im1hcmdpbjowcHggMHB4IDBweCAwLjhleDtib3JkZXItbGVmdDoxcHggc29saWQgcmdiKDIwNCwyMDQsMjA0KTtwYWRkaW5nLWxlZnQ6MWV4Ij48ZGl2IGRpcj0ibHRyIj5UaGlzIGlzIGVtYWlsIDEgaW4gY2hhaW4gMTwvZGl2Pg0KPC9ibG9ja3F1b3RlPjwvZGl2Pg0KPC9kaXY-PC9kaXY-DQo=" + } + } + ] + } + }, + { + "id": "192edf1e8f7ecbb4", + "payload": { + "headers": [ + { + "name": "Delivered-To", + "value": "admin@danswer-test.com" + }, + { + "name": "Received", + "value": "by 2002:a59:b3cc:0:b0:491:1bbc:5e54 with SMTP id g12csp1874156vqt; Sat, 2 Nov 2024 10:35:07 -0700 (PDT)" + }, + { + "name": "X-Received", + "value": "by 2002:a05:6122:319c:b0:50d:81f9:5210 with SMTP id 71dfb90a1353d-5105d128958mr15853812e0c.13.1730568906834; Sat, 02 Nov 2024 10:35:06 -0700 (PDT)" + }, + { + "name": "ARC-Seal", + "value": "i=1; a=rsa-sha256; t=1730568906; cv=none; d=google.com; s=arc-20240605; b=JUd7S6ql1poKM5ox92op2g2Z67AS8sEkp5f/S+Mr5+7KSichsjAwixWg/YhhRhvaY/ UcykrbdaAeWfCuGtJgSq1nr1z5hB3iAltv/D2XCdJdOXzVDpVvaV9lT/YU6266VKtsnq gFVKfjyMe/MnNKvDITQL67A2gRvhiR3XWxwEVvrMArMpUb9bbudlF/5L3MQY4BCIvWLL 9uBv1ZnclghscsxspoG3CkULkGqHGUTKq6bPoUn/hOljiVdsVVagoOwhbDEcyMRKUDnm 2t3H7iiujhlBIDbRoLJR/6C+A6AMyNKPAFA3axM6EXrTOADMZ8a0JqFj8O4rktYpRV+d zHxQ==" + }, + { + "name": "ARC-Message-Signature", + "value": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=K0g0X/4URFSC1nuXjI7ZESJA66WnWcqwgfHOUDQ/kQo=; fh=/JhVJcrFVXWWzpGRY8HXA/cCDTQzCntn8VCeyDmjzic=; b=IarHhl5g5tjBhlMRRXo6WwTzaFOI4Q3w4ebNunftDUHwzV7Qu1hY0y7r3SRNaBb+qD ZncYUI6PF/Oo7eMG65IloXfu+kHUI8NJMaoERUWgEk21Tj6cOSRO4x/W6V5PSX7a4lWZ K1cNdAlaiWI09Esv07Vel975Bgrd+XiCwoVgJAAslHOJ2bZwSYWzvwLqdkCRVrAGJQ9/ I80kvOnNVesIFdIR6SGrhdz8xNIIoe60k8PjJRzkmzy/tEeKCYBz6W+NW4xoIaAVmKUw RvjI8JozUVkGzh+LLyx64MakPCZPWM+ft+D35JodarYh+KesF+HV/Oe7rjaw7JXZ1WoE OdJQ==; dara=google.com" + }, + { + "name": "ARC-Authentication-Results", + "value": "i=1; mx.google.com; dkim=pass header.i=@onyx-test-com.20230601.gappssmtp.com header.s=20230601 header.b=1U8JkCbL; spf=none (google.com: test_user_3@onyx-test.com does not designate permitted sender hosts) smtp.mailfrom=test_user_3@onyx-test.com; dara=pass header.i=@onyx-test.com" + }, + { + "name": "Return-Path", + "value": "" + }, + { + "name": "Received", + "value": "from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 71dfb90a1353d-5106f3f9037sor1051490e0c.7.2024.11.02.10.35.06 for (Google Transport Security); Sat, 02 Nov 2024 10:35:06 -0700 (PDT)" + }, + { + "name": "Received-SPF", + "value": "none (google.com: test_user_3@onyx-test.com does not designate permitted sender hosts) client-ip=209.85.220.41;" + }, + { + "name": "Authentication-Results", + "value": "mx.google.com; dkim=pass header.i=@onyx-test-com.20230601.gappssmtp.com header.s=20230601 header.b=1U8JkCbL; spf=none (google.com: test_user_3@onyx-test.com does not designate permitted sender hosts) smtp.mailfrom=test_user_3@onyx-test.com; dara=pass header.i=@onyx-test.com" + }, + { + "name": "DKIM-Signature", + "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=onyx-test-com.20230601.gappssmtp.com; s=20230601; t=1730568906; x=1731173706; darn=onyx-test.com; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=K0g0X/4URFSC1nuXjI7ZESJA66WnWcqwgfHOUDQ/kQo=; b=1U8JkCbLjicGtH7otVX3QjKv/XK5fGnmOIVMTD/b9cO1w8ai2GwCuJbBo+z1IuGqto aRuNCcEqUIaFvVFiezvhL9xg7scIwHHvLOrSpmc0h0JMSx8q4kKaUGKEJpewsYvkStmr DYv/cUIeaPTIChSuUDV7FVMhf7jIyIaYry3i9/EIlw+on18nD30C9kXwds5yWW8XGvtR /OUuSdgJzuoNmypUt8v9Ebqd+LP23YTs+78/G1Ag+JjugxxF+C9cm7SxmooWueukRkm8 o8nQO5QVx/y/xsCZdM2XXcKCLcZIntuY48amlfFyIqrhG1/DEM6htD64meMGctNTptQf jHrw==" + }, + { + "name": "X-Google-DKIM-Signature", + "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730568906; x=1731173706; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K0g0X/4URFSC1nuXjI7ZESJA66WnWcqwgfHOUDQ/kQo=; b=J4+ozlusGGM1Hn95EZkDeYbExgkyOlAdcY6LcV4Wx1zeI78HtEXGgvqcZ5sP7HzS1X /A3i7WkgmjpC9bU2/zKLrfXDvYQ7udQwTJtKsKaUo4O65Al7Wtgz8e8rBDYikhqEEAZQ GbEwqp+qa+v0T4rPhkQKd4zpIE3AUd3eh5u5iF/UEYc1NcyV35uMGWRP4jOK6F67MwS7 73MgObcGqmBH48I4K+ITYAkNEMGOBpY6fheGxCxyDpcG5gbf8swlWX2Dd0EM9H72o+Xb jvAslOq1lZzPZUgyyZJ2wVEASxF8S7depiOLcTPKwsw+pgXIMAUBExBvu0u4PhO0qG+z pftQ==" + }, + { + "name": "X-Gm-Message-State", + "value": "AOJu0Yy2r0aT3w7HBU7t0JGla+x3AddG9WdnQT06r6T/HGZwZ9Wp9TUs Orb/HMtgvXivtYFkG14NJkMTBO4EqSynmzaxAvEheDXB1uYE2LS21XoqrvycvYQh3GUHBwUdS8L lE6BUjm4TJfXlZWAqKRxg4C0j1UFSuVdkXf6P1GCsdyKKTeS6A9eohw==" + }, + { + "name": "X-Google-Smtp-Source", + "value": "AGHT+IHXTB7Ar9w/Q3G3gCT19SVELYvWl30pNGuNiTmkYZgMWFS7YUWTkG/DS4/mrjMRXpYuclOLHv8BeOmw9Jovkr4=" + }, + { + "name": "X-Received", + "value": "by 2002:a05:6102:3a10:b0:4a9:49:26d2 with SMTP id ada2fe7eead31-4a90109fb68mr15589362137.29.1730568906301; Sat, 02 Nov 2024 10:35:06 -0700 (PDT)" + }, + { + "name": "MIME-Version", + "value": "1.0" + }, + { + "name": "References", + "value": " " + }, + { + "name": "In-Reply-To", + "value": "" + }, + { + "name": "From", + "value": "test_user_3 3 " + }, + { + "name": "Date", + "value": "Sat, 2 Nov 2024 10:34:55 -0700" + }, + { + "name": "Message-ID", + "value": "" + }, + { + "name": "Subject", + "value": "Re: Email Chain 1" + }, + { + "name": "To", + "value": "Test Admin Admin " + }, + { + "name": "Content-Type", + "value": "multipart/alternative; boundary=\"000000000000eb82a70625f178cf\"" + } + ], + "parts": [ + { + "mimeType": "text/plain", + "body": { + "data": "VGhpcyBpcyBlbWFpbCA0IGluIGNoYWluIDENCg0KT24gU2F0LCBOb3YgMiwgMjAyNCBhdCAxMDozNOKAr0FNIFRlc3QgQWRtaW4gQWRtaW4gPGFkbWluQG9ueXgtdGVzdC5jb20-DQp3cm90ZToNCg0KPiBUaGlzIGlzIGVtYWlsIDMgaW4gY2hhaW4gMQ0KPg0KPiAtLS0tLS0tLS0tIEZvcndhcmRlZCBtZXNzYWdlIC0tLS0tLS0tLQ0KPiBGcm9tOiB0ZXN0X3VzZXJfMSAxIDx0ZXN0X3VzZXJfMUBvbnl4LXRlc3QuY29tPg0KPiBEYXRlOiBTYXQsIE5vdiAyLCAyMDI0IGF0IDEwOjMz4oCvQU0NCj4gU3ViamVjdDogUmU6IEVtYWlsIENoYWluIDENCj4gVG86IFRlc3QgQWRtaW4gQWRtaW4gPGFkbWluQG9ueXgtdGVzdC5jb20-DQo-DQo-DQo-IFRoaXMgaXMgZW1haWwgMiBpbiBjaGFpbiAxDQo-DQo-IE9uIFNhdCwgTm92IDIsIDIwMjQgYXQgMTA6MzPigK9BTSBUZXN0IEFkbWluIEFkbWluIDxhZG1pbkBvbnl4LXRlc3QuY29tPg0KPiB3cm90ZToNCj4NCj4-IFRoaXMgaXMgZW1haWwgMSBpbiBjaGFpbiAxDQo-Pg0KPg0K" + } + }, + { + "mimeType": "text/html", + "body": { + "data": "PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCA0IGluIGNoYWluIDE8YnIgY2xhc3M9ImdtYWlsLUFwcGxlLWludGVyY2hhbmdlLW5ld2xpbmUiPjwvZGl2Pjxicj48ZGl2IGNsYXNzPSJnbWFpbF9xdW90ZSI-PGRpdiBkaXI9Imx0ciIgY2xhc3M9ImdtYWlsX2F0dHIiPk9uIFNhdCwgTm92IDIsIDIwMjQgYXQgMTA6MzTigK9BTSBUZXN0IEFkbWluIEFkbWluICZsdDs8YSBocmVmPSJtYWlsdG86YWRtaW5Ab255eC10ZXN0LmNvbSI-YWRtaW5Ab255eC10ZXN0LmNvbTwvYT4mZ3Q7IHdyb3RlOjxicj48L2Rpdj48YmxvY2txdW90ZSBjbGFzcz0iZ21haWxfcXVvdGUiIHN0eWxlPSJtYXJnaW46MHB4IDBweCAwcHggMC44ZXg7Ym9yZGVyLWxlZnQ6MXB4IHNvbGlkIHJnYigyMDQsMjA0LDIwNCk7cGFkZGluZy1sZWZ0OjFleCI-PGRpdiBkaXI9Imx0ciI-PGRpdiBkaXI9Imx0ciI-VGhpcyBpcyBlbWFpbCAzIGluIGNoYWluIDE8L2Rpdj48YnI-PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj4tLS0tLS0tLS0tIEZvcndhcmRlZCBtZXNzYWdlIC0tLS0tLS0tLTxicj5Gcm9tOiA8c3Ryb25nIGNsYXNzPSJnbWFpbF9zZW5kZXJuYW1lIiBkaXI9ImF1dG8iPnRlc3RfdXNlcl8xIDE8L3N0cm9uZz4gPHNwYW4gZGlyPSJhdXRvIj4mbHQ7PGEgaHJlZj0ibWFpbHRvOnRlc3RfdXNlcl8xQG9ueXgtdGVzdC5jb20iIHRhcmdldD0iX2JsYW5rIj50ZXN0X3VzZXJfMUBvbnl4LXRlc3QuY29tPC9hPiZndDs8L3NwYW4-PGJyPkRhdGU6IFNhdCwgTm92IDIsIDIwMjQgYXQgMTA6MzPigK9BTTxicj5TdWJqZWN0OiBSZTogRW1haWwgQ2hhaW4gMTxicj5UbzogVGVzdCBBZG1pbiBBZG1pbiAmbHQ7PGEgaHJlZj0ibWFpbHRvOmFkbWluQG9ueXgtdGVzdC5jb20iIHRhcmdldD0iX2JsYW5rIj5hZG1pbkBvbnl4LXRlc3QuY29tPC9hPiZndDs8YnI-PC9kaXY-PGJyPjxicj48ZGl2IGRpcj0ibHRyIj5UaGlzIGlzIGVtYWlsIDIgaW4gY2hhaW4gMTwvZGl2Pjxicj48ZGl2IGNsYXNzPSJnbWFpbF9xdW90ZSI-PGRpdiBkaXI9Imx0ciIgY2xhc3M9ImdtYWlsX2F0dHIiPk9uIFNhdCwgTm92IDIsIDIwMjQgYXQgMTA6MzPigK9BTSBUZXN0IEFkbWluIEFkbWluICZsdDs8YSBocmVmPSJtYWlsdG86YWRtaW5Ab255eC10ZXN0LmNvbSIgdGFyZ2V0PSJfYmxhbmsiPmFkbWluQG9ueXgtdGVzdC5jb208L2E-Jmd0OyB3cm90ZTo8YnI-PC9kaXY-PGJsb2NrcXVvdGUgY2xhc3M9ImdtYWlsX3F1b3RlIiBzdHlsZT0ibWFyZ2luOjBweCAwcHggMHB4IDAuOGV4O2JvcmRlci1sZWZ0OjFweCBzb2xpZCByZ2IoMjA0LDIwNCwyMDQpO3BhZGRpbmctbGVmdDoxZXgiPjxkaXYgZGlyPSJsdHIiPlRoaXMgaXMgZW1haWwgMSBpbiBjaGFpbiAxPC9kaXY-DQo8L2Jsb2NrcXVvdGU-PC9kaXY-DQo8L2Rpdj48L2Rpdj4NCjwvYmxvY2txdW90ZT48L2Rpdj4NCg==" + } + } + ] + } + } + ] +} diff --git a/backend/tests/unit/danswer/connectors/jira/test_large_ticket_handling.py b/backend/tests/unit/onyx/connectors/jira/test_large_ticket_handling.py similarity index 93% rename from backend/tests/unit/danswer/connectors/jira/test_large_ticket_handling.py rename to backend/tests/unit/onyx/connectors/jira/test_large_ticket_handling.py index 3d05e86f096..8f89a86c7df 100644 --- a/backend/tests/unit/danswer/connectors/jira/test_large_ticket_handling.py +++ b/backend/tests/unit/onyx/connectors/jira/test_large_ticket_handling.py @@ -7,7 +7,7 @@ from jira.resources import Issue from pytest_mock import MockFixture -from danswer.connectors.danswer_jira.connector import fetch_jira_issues_batch +from onyx.connectors.onyx_jira.connector import fetch_jira_issues_batch @pytest.fixture @@ -61,7 +61,7 @@ def mock_issue_large() -> MagicMock: @pytest.fixture def mock_jira_api_version() -> Generator[Any, Any, Any]: - with patch("danswer.connectors.danswer_jira.connector.JIRA_API_VERSION", "2"): + with patch("onyx.connectors.onyx_jira.connector.JIRA_API_VERSION", "2"): yield @@ -114,7 +114,7 @@ def test_fetch_jira_issues_batch_mixed_tickets( assert docs[0].id.endswith("/SMALL-1") -@patch("danswer.connectors.danswer_jira.connector.JIRA_CONNECTOR_MAX_TICKET_SIZE", 50) +@patch("onyx.connectors.onyx_jira.connector.JIRA_CONNECTOR_MAX_TICKET_SIZE", 50) def test_fetch_jira_issues_batch_custom_size_limit( mock_jira_client: MagicMock, mock_issue_small: MagicMock, diff --git a/backend/tests/unit/danswer/connectors/mediawiki/__init__.py b/backend/tests/unit/onyx/connectors/mediawiki/__init__.py similarity index 100% rename from backend/tests/unit/danswer/connectors/mediawiki/__init__.py rename to backend/tests/unit/onyx/connectors/mediawiki/__init__.py diff --git a/backend/tests/unit/danswer/connectors/mediawiki/test_mediawiki_family.py b/backend/tests/unit/onyx/connectors/mediawiki/test_mediawiki_family.py similarity index 98% rename from backend/tests/unit/danswer/connectors/mediawiki/test_mediawiki_family.py rename to backend/tests/unit/onyx/connectors/mediawiki/test_mediawiki_family.py index 95e8a0cd902..b22fb2b7ccc 100644 --- a/backend/tests/unit/danswer/connectors/mediawiki/test_mediawiki_family.py +++ b/backend/tests/unit/onyx/connectors/mediawiki/test_mediawiki_family.py @@ -5,7 +5,7 @@ from pywikibot.families.wikipedia_family import Family as WikipediaFamily # type: ignore[import-untyped] from pywikibot.family import Family # type: ignore[import-untyped] -from danswer.connectors.mediawiki import family +from onyx.connectors.mediawiki import family # Disabling these tests as they are flaky and rely on external wikis that are maintained by just fan communities diff --git a/backend/tests/unit/danswer/connectors/mediawiki/test_wiki.py b/backend/tests/unit/onyx/connectors/mediawiki/test_wiki.py similarity index 99% rename from backend/tests/unit/danswer/connectors/mediawiki/test_wiki.py rename to backend/tests/unit/onyx/connectors/mediawiki/test_wiki.py index 9659c0afc0f..6a81008835a 100644 --- a/backend/tests/unit/danswer/connectors/mediawiki/test_wiki.py +++ b/backend/tests/unit/onyx/connectors/mediawiki/test_wiki.py @@ -8,7 +8,7 @@ import pywikibot # type: ignore[import-untyped] from pytest_mock import MockFixture -from danswer.connectors.mediawiki import wiki +from onyx.connectors.mediawiki import wiki # Some of these tests are disabled for now due to flakiness with wikipedia as the backend diff --git a/backend/tests/unit/danswer/indexing/conftest.py b/backend/tests/unit/onyx/indexing/conftest.py similarity index 82% rename from backend/tests/unit/danswer/indexing/conftest.py rename to backend/tests/unit/onyx/indexing/conftest.py index 193e53b828d..6832add9790 100644 --- a/backend/tests/unit/danswer/indexing/conftest.py +++ b/backend/tests/unit/onyx/indexing/conftest.py @@ -1,6 +1,6 @@ import pytest -from danswer.indexing.indexing_heartbeat import IndexingHeartbeatInterface +from onyx.indexing.indexing_heartbeat import IndexingHeartbeatInterface class MockHeartbeat(IndexingHeartbeatInterface): diff --git a/backend/tests/unit/danswer/indexing/test_chunker.py b/backend/tests/unit/onyx/indexing/test_chunker.py similarity index 87% rename from backend/tests/unit/danswer/indexing/test_chunker.py rename to backend/tests/unit/onyx/indexing/test_chunker.py index 065af49b95d..612474edad0 100644 --- a/backend/tests/unit/danswer/indexing/test_chunker.py +++ b/backend/tests/unit/onyx/indexing/test_chunker.py @@ -1,11 +1,11 @@ import pytest -from danswer.configs.constants import DocumentSource -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.indexing.chunker import Chunker -from danswer.indexing.embedder import DefaultIndexingEmbedder -from tests.unit.danswer.indexing.conftest import MockHeartbeat +from onyx.configs.constants import DocumentSource +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.indexing.chunker import Chunker +from onyx.indexing.embedder import DefaultIndexingEmbedder +from tests.unit.onyx.indexing.conftest import MockHeartbeat @pytest.fixture diff --git a/backend/tests/unit/danswer/indexing/test_embedder.py b/backend/tests/unit/onyx/indexing/test_embedder.py similarity index 85% rename from backend/tests/unit/danswer/indexing/test_embedder.py rename to backend/tests/unit/onyx/indexing/test_embedder.py index 6611c2e5985..78400ecd866 100644 --- a/backend/tests/unit/danswer/indexing/test_embedder.py +++ b/backend/tests/unit/onyx/indexing/test_embedder.py @@ -4,20 +4,20 @@ import pytest -from danswer.configs.constants import DocumentSource -from danswer.connectors.models import Document -from danswer.connectors.models import Section -from danswer.indexing.embedder import DefaultIndexingEmbedder -from danswer.indexing.models import ChunkEmbedding -from danswer.indexing.models import DocAwareChunk -from danswer.indexing.models import IndexChunk +from onyx.configs.constants import DocumentSource +from onyx.connectors.models import Document +from onyx.connectors.models import Section +from onyx.indexing.embedder import DefaultIndexingEmbedder +from onyx.indexing.models import ChunkEmbedding +from onyx.indexing.models import DocAwareChunk +from onyx.indexing.models import IndexChunk from shared_configs.enums import EmbeddingProvider from shared_configs.enums import EmbedTextType @pytest.fixture def mock_embedding_model() -> Generator[Mock, None, None]: - with patch("danswer.indexing.embedder.EmbeddingModel") as mock: + with patch("onyx.indexing.embedder.EmbeddingModel") as mock: yield mock diff --git a/backend/tests/unit/danswer/indexing/test_indexing_pipeline.py b/backend/tests/unit/onyx/indexing/test_indexing_pipeline.py similarity index 92% rename from backend/tests/unit/danswer/indexing/test_indexing_pipeline.py rename to backend/tests/unit/onyx/indexing/test_indexing_pipeline.py index 612535f67ed..908111e7274 100644 --- a/backend/tests/unit/danswer/indexing/test_indexing_pipeline.py +++ b/backend/tests/unit/onyx/indexing/test_indexing_pipeline.py @@ -1,10 +1,10 @@ from typing import List -from danswer.configs.app_configs import MAX_DOCUMENT_CHARS -from danswer.connectors.models import Document -from danswer.connectors.models import DocumentSource -from danswer.connectors.models import Section -from danswer.indexing.indexing_pipeline import filter_documents +from onyx.configs.app_configs import MAX_DOCUMENT_CHARS +from onyx.connectors.models import Document +from onyx.connectors.models import DocumentSource +from onyx.connectors.models import Section +from onyx.indexing.indexing_pipeline import filter_documents def create_test_document( diff --git a/backend/tests/unit/danswer/indexing/test_vespa.py b/backend/tests/unit/onyx/indexing/test_vespa.py similarity index 94% rename from backend/tests/unit/danswer/indexing/test_vespa.py rename to backend/tests/unit/onyx/indexing/test_vespa.py index 102be44409e..e9cc42f4050 100644 --- a/backend/tests/unit/danswer/indexing/test_vespa.py +++ b/backend/tests/unit/onyx/indexing/test_vespa.py @@ -5,9 +5,9 @@ import pytest from sqlalchemy.orm import Session -from danswer.db.engine import get_sqlalchemy_engine -from danswer.document_index.document_index_utils import get_both_index_names -from danswer.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT +from onyx.db.engine import get_sqlalchemy_engine +from onyx.document_index.document_index_utils import get_both_index_names +from onyx.document_index.vespa_constants import DOCUMENT_ID_ENDPOINT @pytest.mark.skip() diff --git a/backend/tests/unit/danswer/llm/test_chat_llm.py b/backend/tests/unit/onyx/llm/test_chat_llm.py similarity index 98% rename from backend/tests/unit/danswer/llm/test_chat_llm.py rename to backend/tests/unit/onyx/llm/test_chat_llm.py index efe0281f53c..50151febd4a 100644 --- a/backend/tests/unit/danswer/llm/test_chat_llm.py +++ b/backend/tests/unit/onyx/llm/test_chat_llm.py @@ -9,7 +9,7 @@ from litellm.types.utils import Delta from litellm.types.utils import Function as LiteLLMFunction -from danswer.llm.chat_llm import DefaultMultiLLM +from onyx.llm.chat_llm import DefaultMultiLLM def _create_delta( @@ -36,7 +36,7 @@ def default_multi_llm() -> DefaultMultiLLM: def test_multiple_tool_calls(default_multi_llm: DefaultMultiLLM) -> None: # Mock the litellm.completion function - with patch("danswer.llm.chat_llm.litellm.completion") as mock_completion: + with patch("onyx.llm.chat_llm.litellm.completion") as mock_completion: # Create a mock response with multiple tool calls using litellm objects mock_response = litellm.ModelResponse( id="chatcmpl-123", @@ -148,7 +148,7 @@ def test_multiple_tool_calls(default_multi_llm: DefaultMultiLLM) -> None: def test_multiple_tool_calls_streaming(default_multi_llm: DefaultMultiLLM) -> None: # Mock the litellm.completion function - with patch("danswer.llm.chat_llm.litellm.completion") as mock_completion: + with patch("onyx.llm.chat_llm.litellm.completion") as mock_completion: # Create a mock response with multiple tool calls using litellm objects mock_response = [ litellm.ModelResponse( diff --git a/backend/tests/unit/danswer/redis_ca.pem b/backend/tests/unit/onyx/redis_ca.pem similarity index 100% rename from backend/tests/unit/danswer/redis_ca.pem rename to backend/tests/unit/onyx/redis_ca.pem diff --git a/backend/tests/unit/danswer/test_redis.py b/backend/tests/unit/onyx/test_redis.py similarity index 91% rename from backend/tests/unit/danswer/test_redis.py rename to backend/tests/unit/onyx/test_redis.py index a55c980f618..18174d91a21 100644 --- a/backend/tests/unit/danswer/test_redis.py +++ b/backend/tests/unit/onyx/test_redis.py @@ -3,8 +3,8 @@ import pytest import redis -from danswer.redis.redis_pool import RedisPool -from danswer.utils.logger import setup_logger +from onyx.redis.redis_pool import RedisPool +from onyx.utils.logger import setup_logger logger = setup_logger() diff --git a/backend/tests/unit/danswer/tools/custom/test_custom_tools.py b/backend/tests/unit/onyx/tools/custom/test_custom_tools.py similarity index 91% rename from backend/tests/unit/danswer/tools/custom/test_custom_tools.py rename to backend/tests/unit/onyx/tools/custom/test_custom_tools.py index 4d47a8761ff..f414a07a0eb 100644 --- a/backend/tests/unit/danswer/tools/custom/test_custom_tools.py +++ b/backend/tests/unit/onyx/tools/custom/test_custom_tools.py @@ -5,19 +5,19 @@ import pytest -from danswer.tools.models import DynamicSchemaInfo -from danswer.tools.models import ToolResponse -from danswer.tools.tool_implementations.custom.custom_tool import ( +from onyx.tools.models import DynamicSchemaInfo +from onyx.tools.models import ToolResponse +from onyx.tools.tool_implementations.custom.custom_tool import ( build_custom_tools_from_openapi_schema_and_headers, ) -from danswer.tools.tool_implementations.custom.custom_tool import ( +from onyx.tools.tool_implementations.custom.custom_tool import ( CUSTOM_TOOL_RESPONSE_ID, ) -from danswer.tools.tool_implementations.custom.custom_tool import CustomToolCallSummary -from danswer.tools.tool_implementations.custom.custom_tool import ( +from onyx.tools.tool_implementations.custom.custom_tool import CustomToolCallSummary +from onyx.tools.tool_implementations.custom.custom_tool import ( validate_openapi_schema, ) -from danswer.utils.headers import HeaderItemDict +from onyx.utils.headers import HeaderItemDict class TestCustomTool(unittest.TestCase): @@ -82,7 +82,7 @@ def setUp(self) -> None: chat_session_id=uuid.uuid4(), message_id=20 ) - @patch("danswer.tools.tool_implementations.custom.custom_tool.requests.request") + @patch("onyx.tools.tool_implementations.custom.custom_tool.requests.request") def test_custom_tool_run_get(self, mock_request: unittest.mock.MagicMock) -> None: """ Test the GET method of a custom tool. @@ -110,7 +110,7 @@ def test_custom_tool_run_get(self, mock_request: unittest.mock.MagicMock) -> Non "Tool name in response does not match expected value", ) - @patch("danswer.tools.tool_implementations.custom.custom_tool.requests.request") + @patch("onyx.tools.tool_implementations.custom.custom_tool.requests.request") def test_custom_tool_run_post(self, mock_request: unittest.mock.MagicMock) -> None: """ Test the POST method of a custom tool. @@ -140,7 +140,7 @@ def test_custom_tool_run_post(self, mock_request: unittest.mock.MagicMock) -> No "Tool name in response does not match expected value", ) - @patch("danswer.tools.tool_implementations.custom.custom_tool.requests.request") + @patch("onyx.tools.tool_implementations.custom.custom_tool.requests.request") def test_custom_tool_with_headers( self, mock_request: unittest.mock.MagicMock ) -> None: @@ -168,7 +168,7 @@ def test_custom_tool_with_headers( "GET", expected_url, json=None, headers=expected_headers ) - @patch("danswer.tools.tool_implementations.custom.custom_tool.requests.request") + @patch("onyx.tools.tool_implementations.custom.custom_tool.requests.request") def test_custom_tool_with_empty_headers( self, mock_request: unittest.mock.MagicMock ) -> None: diff --git a/deployment/README.md b/deployment/README.md index 9454cbbe5ea..02a12d9fc77 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -1,52 +1,52 @@ - + -# Deploying Danswer -The two options provided here are the easiest ways to get Danswer up and running. +# Deploying Onyx + +The two options provided here are the easiest ways to get Onyx up and running. - Docker Compose is simpler and default values are already preset to run right out of the box with a single command. -As everything is running on a single machine, this may not be as scalable depending on your hardware, traffic and needs. + As everything is running on a single machine, this may not be as scalable depending on your hardware, traffic and needs. - Kubernetes deployment is also provided. Depending on your existing infrastructure, this may be more suitable for -production deployment but there are a few caveats. + production deployment but there are a few caveats. - User auth is turned on by default for Kubernetes (with the assumption this is for production use) - so you must either update the deployments to turn off user auth or provide the values shown in the example - secrets.yaml file. + so you must either update the deployments to turn off user auth or provide the values shown in the example + secrets.yaml file. - The example provided assumes a blank slate for existing Kubernetes deployments/services. You may need to adjust the - deployments or services according to your setup. This may require existing Kubernetes knowledge or additional - setup time. - -All the features of Danswer are fully available regardless of the deployment option. + deployments or services according to your setup. This may require existing Kubernetes knowledge or additional + setup time. -For information on setting up connectors, check out https://docs.danswer.dev/connectors/overview +All the features of Onyx are fully available regardless of the deployment option. +For information on setting up connectors, check out https://docs.onyx.app/connectors/overview ## Docker Compose: -Docker Compose provides the easiest way to get Danswer up and running. + +Docker Compose provides the easiest way to get Onyx up and running. Requirements: Docker and docker compose -This section is for getting started quickly without setting up GPUs. For deployments to leverage GPU, please refer to [this](https://github.com/danswer-ai/danswer/blob/main/deployment/docker_compose/README.md) documentation. +This section is for getting started quickly without setting up GPUs. For deployments to leverage GPU, please refer to [this](https://github.com/onyx-dot-app/onyx/blob/main/deployment/docker_compose/README.md) documentation. -1. To run Danswer, navigate to `docker_compose` directory and run the following: - - `docker compose -f docker-compose.dev.yml -p danswer-stack up -d --pull always --force-recreate` - - or run: `docker compose -f docker-compose.dev.yml -p danswer-stack up -d --build --force-recreate` -to build from source - - Downloading images or packages/requirements may take 15+ minutes depending on your internet connection. +1. To run Onyx, navigate to `docker_compose` directory and run the following: + - `docker compose -f docker-compose.dev.yml -p onyx-stack up -d --pull always --force-recreate` - or run: `docker compose -f docker-compose.dev.yml -p onyx-stack up -d --build --force-recreate` + to build from source + - Downloading images or packages/requirements may take 15+ minutes depending on your internet connection. 2. To shut down the deployment, run: - - To stop the containers: `docker compose -f docker-compose.dev.yml -p danswer-stack stop` - - To delete the containers: `docker compose -f docker-compose.dev.yml -p danswer-stack down` + - To stop the containers: `docker compose -f docker-compose.dev.yml -p onyx-stack stop` + - To delete the containers: `docker compose -f docker-compose.dev.yml -p onyx-stack down` -3. To completely remove Danswer run: +3. To completely remove Onyx run: - **WARNING, this will also erase your indexed data and users** - - `docker compose -f docker-compose.dev.yml -p danswer-stack down -v` - + - `docker compose -f docker-compose.dev.yml -p onyx-stack down -v` Additional steps for user auth and https if you do want to use Docker Compose for production: 1. Set up a `.env` file in this directory with relevant environment variables. + - Refer to `env.prod.template` - To turn on user auth, set: - GOOGLE_OAUTH_CLIENT_ID=\ @@ -54,13 +54,14 @@ Additional steps for user auth and https if you do want to use Docker Compose fo - Refer to https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid 2. Set up https: + - Set up a `.env.nginx` file in this directory based on `env.nginx.template`. - `chmod +x init-letsencrypt.sh` + `./init-letsencrypt.sh` to set up https certificate. 3. Follow the above steps but replacing dev with prod. - ## Kubernetes: + Depending on your deployment needs Kubernetes may be more suitable. The yamls provided will work out of the box but the intent is for you to customize the deployment to fit your own needs. There is no data replication or auto-scaling built in for the provided example. @@ -70,11 +71,12 @@ Requirements: a Kubernetes cluster and kubectl **NOTE: This setup does not explicitly enable https, the assumption is you would have this already set up for your prod cluster** -1. To run Danswer, navigate to `kubernetes` directory and run the following: +1. To run Onyx, navigate to `kubernetes` directory and run the following: + - `kubectl apply -f .` -2. To remove Danswer, run: +2. To remove Onyx, run: - **WARNING, this will also erase your indexed data and users** - `kubectl delete -f .` - - To not delete the persistent volumes (Document indexes and Users), specify the specific `.yaml` files instead of - `.` without specifying delete on persistent-volumes.yaml. + - To not delete the persistent volumes (Document indexes and Users), specify the specific `.yaml` files instead of + `.` without specifying delete on persistent-volumes.yaml. diff --git a/deployment/cloud_kubernetes/keda/celery-worker-auth.yaml b/deployment/cloud_kubernetes/keda/celery-worker-auth.yaml index dcd6f92b5b6..210957a3264 100644 --- a/deployment/cloud_kubernetes/keda/celery-worker-auth.yaml +++ b/deployment/cloud_kubernetes/keda/celery-worker-auth.yaml @@ -2,7 +2,7 @@ apiVersion: keda.sh/v1alpha1 kind: TriggerAuthentication metadata: name: celery-worker-auth - namespace: danswer + namespace: onyx spec: secretTargetRef: - parameter: host diff --git a/deployment/cloud_kubernetes/keda/celery-worker-indexing-scaledobject.yaml b/deployment/cloud_kubernetes/keda/celery-worker-indexing-scaledobject.yaml index 59ee24085f0..70854c12e7d 100644 --- a/deployment/cloud_kubernetes/keda/celery-worker-indexing-scaledobject.yaml +++ b/deployment/cloud_kubernetes/keda/celery-worker-indexing-scaledobject.yaml @@ -2,7 +2,7 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: celery-worker-indexing-scaledobject - namespace: danswer + namespace: onyx labels: app: celery-worker-indexing spec: diff --git a/deployment/cloud_kubernetes/keda/celery-worker-light-scaledobject.yaml b/deployment/cloud_kubernetes/keda/celery-worker-light-scaledobject.yaml index d05858b18b0..160a51f9531 100644 --- a/deployment/cloud_kubernetes/keda/celery-worker-light-scaledobject.yaml +++ b/deployment/cloud_kubernetes/keda/celery-worker-light-scaledobject.yaml @@ -2,7 +2,7 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: celery-worker-light-scaledobject - namespace: danswer + namespace: onyx labels: app: celery-worker-light spec: diff --git a/deployment/cloud_kubernetes/keda/celery-worker-primary-scaledobject.yaml b/deployment/cloud_kubernetes/keda/celery-worker-primary-scaledobject.yaml index 52bac2e44c4..1977465f976 100644 --- a/deployment/cloud_kubernetes/keda/celery-worker-primary-scaledobject.yaml +++ b/deployment/cloud_kubernetes/keda/celery-worker-primary-scaledobject.yaml @@ -2,7 +2,7 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: celery-worker-primary-scaledobject - namespace: danswer + namespace: onyx labels: app: celery-worker-primary spec: diff --git a/deployment/cloud_kubernetes/keda/indexing-model-server-scaledobject.yaml b/deployment/cloud_kubernetes/keda/indexing-model-server-scaledobject.yaml index b44c6faee7c..6ed6bdc6de1 100644 --- a/deployment/cloud_kubernetes/keda/indexing-model-server-scaledobject.yaml +++ b/deployment/cloud_kubernetes/keda/indexing-model-server-scaledobject.yaml @@ -2,7 +2,7 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: indexing-model-server-scaledobject - namespace: danswer + namespace: onyx labels: app: indexing-model-server spec: diff --git a/deployment/cloud_kubernetes/keda/keda-redis-secret.yaml b/deployment/cloud_kubernetes/keda/keda-redis-secret.yaml index 49492f09268..fd799638cee 100644 --- a/deployment/cloud_kubernetes/keda/keda-redis-secret.yaml +++ b/deployment/cloud_kubernetes/keda/keda-redis-secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: keda-redis-secret - namespace: danswer + namespace: onyx type: Opaque data: host: { base64 encoded host here } diff --git a/deployment/cloud_kubernetes/workers/beat.yaml b/deployment/cloud_kubernetes/workers/beat.yaml index cfe7f79cd91..a4e911a9e9b 100644 --- a/deployment/cloud_kubernetes/workers/beat.yaml +++ b/deployment/cloud_kubernetes/workers/beat.yaml @@ -14,13 +14,13 @@ spec: spec: containers: - name: celery-beat - image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4 + image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4 imagePullPolicy: IfNotPresent command: [ "celery", "-A", - "danswer.background.celery.versioned_apps.beat", + "onyx.background.celery.versioned_apps.beat", "beat", "--loglevel=INFO", ] @@ -28,7 +28,7 @@ spec: - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: danswer-secrets + name: onyx-secrets key: redis_password - name: DANSWER_VERSION value: "v0.11.0-cloud.beta.8" diff --git a/deployment/cloud_kubernetes/workers/heavy_worker.yaml b/deployment/cloud_kubernetes/workers/heavy_worker.yaml index 349ebb4f21e..d5ee676e29e 100644 --- a/deployment/cloud_kubernetes/workers/heavy_worker.yaml +++ b/deployment/cloud_kubernetes/workers/heavy_worker.yaml @@ -14,13 +14,13 @@ spec: spec: containers: - name: celery-worker-heavy - image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4 + image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4 imagePullPolicy: IfNotPresent command: [ "celery", "-A", - "danswer.background.celery.versioned_apps.heavy", + "onyx.background.celery.versioned_apps.heavy", "worker", "--loglevel=INFO", "--hostname=heavy@%n", @@ -31,7 +31,7 @@ spec: - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: danswer-secrets + name: onyx-secrets key: redis_password - name: DANSWER_VERSION value: "v0.11.0-cloud.beta.8" diff --git a/deployment/cloud_kubernetes/workers/indexing_worker.yaml b/deployment/cloud_kubernetes/workers/indexing_worker.yaml index 443bf236e00..350e689382f 100644 --- a/deployment/cloud_kubernetes/workers/indexing_worker.yaml +++ b/deployment/cloud_kubernetes/workers/indexing_worker.yaml @@ -14,13 +14,13 @@ spec: spec: containers: - name: celery-worker-indexing - image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4 + image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4 imagePullPolicy: IfNotPresent command: [ "celery", "-A", - "danswer.background.celery.versioned_apps.indexing", + "onyx.background.celery.versioned_apps.indexing", "worker", "--loglevel=INFO", "--hostname=indexing@%n", @@ -33,7 +33,7 @@ spec: - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: danswer-secrets + name: onyx-secrets key: redis_password - name: DANSWER_VERSION value: "v0.11.0-cloud.beta.8" diff --git a/deployment/cloud_kubernetes/workers/light_worker.yaml b/deployment/cloud_kubernetes/workers/light_worker.yaml index eaa2ad7b92c..b70b6a866ba 100644 --- a/deployment/cloud_kubernetes/workers/light_worker.yaml +++ b/deployment/cloud_kubernetes/workers/light_worker.yaml @@ -14,13 +14,13 @@ spec: spec: containers: - name: celery-worker-light - image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4 + image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4 imagePullPolicy: IfNotPresent command: [ "celery", "-A", - "danswer.background.celery.versioned_apps.light", + "onyx.background.celery.versioned_apps.light", "worker", "--loglevel=INFO", "--hostname=light@%n", @@ -33,7 +33,7 @@ spec: - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: danswer-secrets + name: onyx-secrets key: redis_password - name: DANSWER_VERSION value: "v0.11.0-cloud.beta.8" diff --git a/deployment/cloud_kubernetes/workers/primary.yaml b/deployment/cloud_kubernetes/workers/primary.yaml index ae365b1516c..2d20791c934 100644 --- a/deployment/cloud_kubernetes/workers/primary.yaml +++ b/deployment/cloud_kubernetes/workers/primary.yaml @@ -14,13 +14,13 @@ spec: spec: containers: - name: celery-worker-primary - image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4 + image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4 imagePullPolicy: IfNotPresent command: [ "celery", "-A", - "danswer.background.celery.versioned_apps.primary", + "onyx.background.celery.versioned_apps.primary", "worker", "--loglevel=INFO", "--hostname=primary@%n", @@ -33,7 +33,7 @@ spec: - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: danswer-secrets + name: onyx-secrets key: redis_password - name: DANSWER_VERSION value: "v0.11.0-cloud.beta.8" diff --git a/deployment/data/nginx/run-nginx.sh b/deployment/data/nginx/run-nginx.sh index fed6eb686e8..01f9c1497ca 100755 --- a/deployment/data/nginx/run-nginx.sh +++ b/deployment/data/nginx/run-nginx.sh @@ -5,7 +5,7 @@ envsubst '$DOMAIN $SSL_CERT_FILE_NAME $SSL_CERT_KEY_FILE_NAME' < "/etc/nginx/con echo "Waiting for API server to boot up; this may take a minute or two..." echo "If this takes more than ~5 minutes, check the logs of the API server container for errors with the following command:" echo -echo "docker logs danswer-stack_api_server-1" +echo "docker logs onyx-stack_api_server-1" echo while true; do diff --git a/deployment/docker_compose/README.md b/deployment/docker_compose/README.md index 60d8824ca51..de61e4122d7 100644 --- a/deployment/docker_compose/README.md +++ b/deployment/docker_compose/README.md @@ -1,26 +1,31 @@ - + -# Deploying Danswer using Docker Compose +# Deploying Onyx using Docker Compose -For general information, please read the instructions in this [README](https://github.com/danswer-ai/danswer/blob/main/deployment/README.md). +For general information, please read the instructions in this [README](https://github.com/onyx-dot-app/onyx/blob/main/deployment/README.md). ## Deploy in a system without GPU support -This part is elaborated precisely in this [README](https://github.com/danswer-ai/danswer/blob/main/deployment/README.md) in section *Docker Compose*. If you have any questions, please feel free to open an issue or get in touch in slack for support. + +This part is elaborated precisely in this [README](https://github.com/onyx-dot-app/onyx/blob/main/deployment/README.md) in section _Docker Compose_. If you have any questions, please feel free to open an issue or get in touch in slack for support. ## Deploy in a system with GPU support -Running Model servers with GPU support while indexing and querying can result in significant improvements in performance. This is highly recommended if you have access to resources. Currently, Danswer offloads embedding model and tokenizers to the GPU VRAM and the size needed depends on chosen embedding model. For example, the embedding model `nomic-ai/nomic-embed-text-v1` takes up about 1GB of VRAM. That means running this model for inference and embedding pipeline would require roughly 2GB of VRAM. + +Running Model servers with GPU support while indexing and querying can result in significant improvements in performance. This is highly recommended if you have access to resources. Currently, Onyx offloads embedding model and tokenizers to the GPU VRAM and the size needed depends on chosen embedding model. For example, the embedding model `nomic-ai/nomic-embed-text-v1` takes up about 1GB of VRAM. That means running this model for inference and embedding pipeline would require roughly 2GB of VRAM. ### Setup + To be able to use NVIDIA runtime, following is mandatory: + - proper setup of NVIDIA driver in host system. - installation of `nvidia-container-toolkit` for passing GPU runtime to containers You will find elaborate steps here: #### Installation of NVIDIA Drivers + Visit the official [NVIDIA drivers page](https://www.nvidia.com/Download/index.aspx) to download and install the proper drivers. Reboot your system once you have done so. -Alternatively, you can choose to install the driver versions via package managers of your choice in UNIX based systems. +Alternatively, you can choose to install the driver versions via package managers of your choice in UNIX based systems. #### Installation of `nvidia-container-toolkit` @@ -28,13 +33,12 @@ For GPUs to be accessible to containers, you will need the container toolkit. Pl ### Launching with GPU -1. To run Danswer with GPU, navigate to `docker_compose` directory and run the following: - - `docker compose -f docker-compose.gpu-dev.yml -p danswer-stack up -d --pull always --force-recreate` - - or run: `docker compose -f docker-compose.gpu-dev.yml -p danswer-stack up -d --build --force-recreate` -to build from source - - Downloading images or packages/requirements may take 15+ minutes depending on your internet connection. +1. To run Onyx with GPU, navigate to `docker_compose` directory and run the following: + - `docker compose -f docker-compose.gpu-dev.yml -p onyx-stack up -d --pull always --force-recreate` - or run: `docker compose -f docker-compose.gpu-dev.yml -p onyx-stack up -d --build --force-recreate` + to build from source + - Downloading images or packages/requirements may take 15+ minutes depending on your internet connection. 2. To shut down the deployment, run: - - To stop the containers: `docker compose -f docker-compose.gpu-dev.yml -p danswer-stack stop` - - To delete the containers: `docker compose -f docker-compose.gpu-dev.yml -p danswer-stack down` + - To stop the containers: `docker compose -f docker-compose.gpu-dev.yml -p onyx-stack stop` + - To delete the containers: `docker compose -f docker-compose.gpu-dev.yml -p onyx-stack down` diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index 19991de2d37..3cf9f062b7b 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -1,13 +1,13 @@ services: api_server: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile command: > /bin/sh -c "alembic upgrade head && - echo \"Starting Danswer Api Server\" && - uvicorn danswer.main:app --host 0.0.0.0 --port 8080" + echo \"Starting Onyx Api Server\" && + uvicorn onyx.main:app --host 0.0.0.0 --port 8080" depends_on: - relational_db - index @@ -77,11 +77,11 @@ services: - MODEL_SERVER_HOST=${MODEL_SERVER_HOST:-inference_model_server} - MODEL_SERVER_PORT=${MODEL_SERVER_PORT:-} # Leave this on pretty please? Nothing sensitive is collected! - # https://docs.danswer.dev/more/telemetry + # https://docs.onyx.app/more/telemetry - DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-} - LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs - LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging - # Log all of Danswer prompts and interactions with the LLM + # Log all of Onyx prompts and interactions with the LLM - LOG_DANSWER_MODEL_INTERACTIONS=${LOG_DANSWER_MODEL_INTERACTIONS:-} - LOG_INDIVIDUAL_MODEL_TOKENS=${LOG_INDIVIDUAL_MODEL_TOKENS:-} # If set to `true` will enable additional logs about Vespa query performance @@ -111,7 +111,7 @@ services: max-file: "6" background: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile @@ -131,7 +131,7 @@ services: environment: - ENCRYPTION_KEY_SECRET=${ENCRYPTION_KEY_SECRET:-} - JWT_PUBLIC_KEY_URL=${JWT_PUBLIC_KEY_URL:-} # used for JWT authentication of users via API - # Gen AI Settings (Needed by DanswerBot) + # Gen AI Settings (Needed by OnyxBot) - GEN_AI_MAX_TOKENS=${GEN_AI_MAX_TOKENS:-} - QA_TIMEOUT=${QA_TIMEOUT:-} - MAX_CHUNKS_FED_TO_CHAT=${MAX_CHUNKS_FED_TO_CHAT:-} @@ -163,7 +163,7 @@ services: - DOCUMENT_ENCODER_MODEL=${DOCUMENT_ENCODER_MODEL:-} - DOC_EMBEDDING_DIM=${DOC_EMBEDDING_DIM:-} - NORMALIZE_EMBEDDINGS=${NORMALIZE_EMBEDDINGS:-} - - ASYM_QUERY_PREFIX=${ASYM_QUERY_PREFIX:-} # Needed by DanswerBot + - ASYM_QUERY_PREFIX=${ASYM_QUERY_PREFIX:-} # Needed by OnyxBot - ASYM_PASSAGE_PREFIX=${ASYM_PASSAGE_PREFIX:-} - MODEL_SERVER_HOST=${MODEL_SERVER_HOST:-inference_model_server} - MODEL_SERVER_PORT=${MODEL_SERVER_PORT:-} @@ -196,7 +196,7 @@ services: - CELERY_WORKER_LIGHT_CONCURRENCY=${CELERY_WORKER_LIGHT_CONCURRENCY:-} - CELERY_WORKER_LIGHT_PREFETCH_MULTIPLIER=${CELERY_WORKER_LIGHT_PREFETCH_MULTIPLIER:-} - # Danswer SlackBot Configs + # Onyx SlackBot Configs - DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER=${DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER:-} - DANSWER_BOT_FEEDBACK_VISIBILITY=${DANSWER_BOT_FEEDBACK_VISIBILITY:-} - DANSWER_BOT_DISPLAY_ERROR_MSGS=${DANSWER_BOT_DISPLAY_ERROR_MSGS:-} @@ -207,11 +207,11 @@ services: - DANSWER_BOT_MAX_WAIT_TIME=${DANSWER_BOT_MAX_WAIT_TIME:-} # Logging # Leave this on pretty please? Nothing sensitive is collected! - # https://docs.danswer.dev/more/telemetry + # https://docs.onyx.app/more/telemetry - DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-} - LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs - LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging - # Log all of Danswer prompts and interactions with the LLM + # Log all of Onyx prompts and interactions with the LLM - LOG_DANSWER_MODEL_INTERACTIONS=${LOG_DANSWER_MODEL_INTERACTIONS:-} - LOG_INDIVIDUAL_MODEL_TOKENS=${LOG_INDIVIDUAL_MODEL_TOKENS:-} - LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-} @@ -239,7 +239,7 @@ services: # - ${CA_CERT_PATH:-./custom-ca.crt}:/etc/ssl/certs/custom-ca.crt:ro web_server: - image: danswer/danswer-web-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-web-server:${IMAGE_TAG:-latest} build: context: ../../web dockerfile: Dockerfile @@ -253,7 +253,7 @@ services: # Enterprise Edition only - NEXT_PUBLIC_THEME=${NEXT_PUBLIC_THEME:-} - # DO NOT TURN ON unless you have EXPLICIT PERMISSION from Danswer. + # DO NOT TURN ON unless you have EXPLICIT PERMISSION from Onyx. - NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED=${NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED:-false} depends_on: - api_server @@ -269,7 +269,7 @@ services: - NEXT_PUBLIC_CUSTOM_REFRESH_URL=${NEXT_PUBLIC_CUSTOM_REFRESH_URL:-} inference_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server @@ -298,7 +298,7 @@ services: max-file: "6" indexing_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server diff --git a/deployment/docker_compose/docker-compose.gpu-dev.yml b/deployment/docker_compose/docker-compose.gpu-dev.yml index 3083663fcef..50c367022d6 100644 --- a/deployment/docker_compose/docker-compose.gpu-dev.yml +++ b/deployment/docker_compose/docker-compose.gpu-dev.yml @@ -1,13 +1,13 @@ services: api_server: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile command: > /bin/sh -c "alembic upgrade head && - echo \"Starting Danswer Api Server\" && - uvicorn danswer.main:app --host 0.0.0.0 --port 8080" + echo \"Starting Onyx Api Server\" && + uvicorn onyx.main:app --host 0.0.0.0 --port 8080" depends_on: - relational_db - index @@ -25,8 +25,8 @@ services: - GOOGLE_OAUTH_CLIENT_ID=${GOOGLE_OAUTH_CLIENT_ID:-} - GOOGLE_OAUTH_CLIENT_SECRET=${GOOGLE_OAUTH_CLIENT_SECRET:-} - REQUIRE_EMAIL_VERIFICATION=${REQUIRE_EMAIL_VERIFICATION:-} - - SMTP_SERVER=${SMTP_SERVER:-} # For sending verification emails, if unspecified then defaults to 'smtp.gmail.com' - - SMTP_PORT=${SMTP_PORT:-587} # For sending verification emails, if unspecified then defaults to '587' + - SMTP_SERVER=${SMTP_SERVER:-} # For sending verification emails, if unspecified then defaults to 'smtp.gmail.com' + - SMTP_PORT=${SMTP_PORT:-587} # For sending verification emails, if unspecified then defaults to '587' - SMTP_USER=${SMTP_USER:-} - SMTP_PASS=${SMTP_PASS:-} - EMAIL_FROM=${EMAIL_FROM:-} @@ -49,8 +49,8 @@ services: - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-} - AWS_REGION_NAME=${AWS_REGION_NAME:-} # Query Options - - DOC_TIME_DECAY=${DOC_TIME_DECAY:-} # Recency Bias for search results, decay at 1 / (1 + DOC_TIME_DECAY * x years) - - HYBRID_ALPHA=${HYBRID_ALPHA:-} # Hybrid Search Alpha (0 for entirely keyword, 1 for entirely vector) + - DOC_TIME_DECAY=${DOC_TIME_DECAY:-} # Recency Bias for search results, decay at 1 / (1 + DOC_TIME_DECAY * x years) + - HYBRID_ALPHA=${HYBRID_ALPHA:-} # Hybrid Search Alpha (0 for entirely keyword, 1 for entirely vector) - EDIT_KEYWORD_QUERY=${EDIT_KEYWORD_QUERY:-} - MULTILINGUAL_QUERY_EXPANSION=${MULTILINGUAL_QUERY_EXPANSION:-} - LANGUAGE_HINT=${LANGUAGE_HINT:-} @@ -59,8 +59,8 @@ services: # Other services - POSTGRES_HOST=relational_db - VESPA_HOST=index - - REDIS_HOST=cache - - WEB_DOMAIN=${WEB_DOMAIN:-} # For frontend redirect auth purpose + - REDIS_HOST=cache + - WEB_DOMAIN=${WEB_DOMAIN:-} # For frontend redirect auth purpose # Don't change the NLP model configs unless you know what you're doing - EMBEDDING_BATCH_SIZE=${EMBEDDING_BATCH_SIZE:-} - DOCUMENT_ENCODER_MODEL=${DOCUMENT_ENCODER_MODEL:-} @@ -74,17 +74,17 @@ services: # We do not recommend changing this value - SYSTEM_RECURSION_LIMIT=${SYSTEM_RECURSION_LIMIT:-} # Leave this on pretty please? Nothing sensitive is collected! - # https://docs.danswer.dev/more/telemetry + # https://docs.onyx.app/more/telemetry - DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-} - - LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs - - LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging - # Log all of Danswer prompts and interactions with the LLM + - LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs + - LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging + # Log all of Onyx prompts and interactions with the LLM - LOG_DANSWER_MODEL_INTERACTIONS=${LOG_DANSWER_MODEL_INTERACTIONS:-} # If set to `true` will enable additional logs about Vespa query performance # (time spent on finding the right docs + time spent fetching summaries from disk) - LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-} - CELERY_BROKER_POOL_LIMIT=${CELERY_BROKER_POOL_LIMIT:-} - + # Chat Configs - HARD_DELETE_CHATS=${HARD_DELETE_CHATS:-} @@ -99,9 +99,8 @@ services: max-size: "50m" max-file: "6" - background: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile @@ -115,7 +114,7 @@ services: restart: always environment: - ENCRYPTION_KEY_SECRET=${ENCRYPTION_KEY_SECRET:-} - # Gen AI Settings (Needed by DanswerBot) + # Gen AI Settings (Needed by OnyxBot) - GEN_AI_MAX_TOKENS=${GEN_AI_MAX_TOKENS:-} - QA_TIMEOUT=${QA_TIMEOUT:-} - MAX_CHUNKS_FED_TO_CHAT=${MAX_CHUNKS_FED_TO_CHAT:-} @@ -127,8 +126,8 @@ services: - DISABLE_LITELLM_STREAMING=${DISABLE_LITELLM_STREAMING:-} - LITELLM_EXTRA_HEADERS=${LITELLM_EXTRA_HEADERS:-} # Query Options - - DOC_TIME_DECAY=${DOC_TIME_DECAY:-} # Recency Bias for search results, decay at 1 / (1 + DOC_TIME_DECAY * x years) - - HYBRID_ALPHA=${HYBRID_ALPHA:-} # Hybrid Search Alpha (0 for entirely keyword, 1 for entirely vector) + - DOC_TIME_DECAY=${DOC_TIME_DECAY:-} # Recency Bias for search results, decay at 1 / (1 + DOC_TIME_DECAY * x years) + - HYBRID_ALPHA=${HYBRID_ALPHA:-} # Hybrid Search Alpha (0 for entirely keyword, 1 for entirely vector) - EDIT_KEYWORD_QUERY=${EDIT_KEYWORD_QUERY:-} - MULTILINGUAL_QUERY_EXPANSION=${MULTILINGUAL_QUERY_EXPANSION:-} - LANGUAGE_HINT=${LANGUAGE_HINT:-} @@ -141,12 +140,12 @@ services: - POSTGRES_DB=${POSTGRES_DB:-} - VESPA_HOST=index - REDIS_HOST=cache - - WEB_DOMAIN=${WEB_DOMAIN:-} # For frontend redirect auth purpose for OAuth2 connectors + - WEB_DOMAIN=${WEB_DOMAIN:-} # For frontend redirect auth purpose for OAuth2 connectors # Don't change the NLP model configs unless you know what you're doing - DOCUMENT_ENCODER_MODEL=${DOCUMENT_ENCODER_MODEL:-} - DOC_EMBEDDING_DIM=${DOC_EMBEDDING_DIM:-} - NORMALIZE_EMBEDDINGS=${NORMALIZE_EMBEDDINGS:-} - - ASYM_QUERY_PREFIX=${ASYM_QUERY_PREFIX:-} # Needed by DanswerBot + - ASYM_QUERY_PREFIX=${ASYM_QUERY_PREFIX:-} # Needed by OnyxBot - ASYM_PASSAGE_PREFIX=${ASYM_PASSAGE_PREFIX:-} - MODEL_SERVER_HOST=${MODEL_SERVER_HOST:-inference_model_server} - MODEL_SERVER_PORT=${MODEL_SERVER_PORT:-} @@ -166,22 +165,22 @@ services: - GONG_CONNECTOR_START_TIME=${GONG_CONNECTOR_START_TIME:-} - NOTION_CONNECTOR_ENABLE_RECURSIVE_PAGE_LOOKUP=${NOTION_CONNECTOR_ENABLE_RECURSIVE_PAGE_LOOKUP:-} - GITHUB_CONNECTOR_BASE_URL=${GITHUB_CONNECTOR_BASE_URL:-} - # Danswer SlackBot Configs + # Onyx SlackBot Configs - DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER=${DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER:-} - DANSWER_BOT_FEEDBACK_VISIBILITY=${DANSWER_BOT_FEEDBACK_VISIBILITY:-} - DANSWER_BOT_DISPLAY_ERROR_MSGS=${DANSWER_BOT_DISPLAY_ERROR_MSGS:-} - DANSWER_BOT_RESPOND_EVERY_CHANNEL=${DANSWER_BOT_RESPOND_EVERY_CHANNEL:-} - - DANSWER_BOT_DISABLE_COT=${DANSWER_BOT_DISABLE_COT:-} # Currently unused + - DANSWER_BOT_DISABLE_COT=${DANSWER_BOT_DISABLE_COT:-} # Currently unused - NOTIFY_SLACKBOT_NO_ANSWER=${NOTIFY_SLACKBOT_NO_ANSWER:-} - DANSWER_BOT_MAX_QPM=${DANSWER_BOT_MAX_QPM:-} - DANSWER_BOT_MAX_WAIT_TIME=${DANSWER_BOT_MAX_WAIT_TIME:-} # Logging # Leave this on pretty please? Nothing sensitive is collected! - # https://docs.danswer.dev/more/telemetry + # https://docs.onyx.app/more/telemetry - DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-} - - LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs - - LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging - # Log all of Danswer prompts and interactions with the LLM + - LOG_LEVEL=${LOG_LEVEL:-info} # Set to debug to get more fine-grained logs + - LOG_ALL_MODEL_INTERACTIONS=${LOG_ALL_MODEL_INTERACTIONS:-} # LiteLLM Verbose Logging + # Log all of Onyx prompts and interactions with the LLM - LOG_DANSWER_MODEL_INTERACTIONS=${LOG_DANSWER_MODEL_INTERACTIONS:-} - LOG_VESPA_TIMING_INFORMATION=${LOG_VESPA_TIMING_INFORMATION:-} # Celery Configs (defaults are set in the supervisord.conf file. @@ -201,9 +200,8 @@ services: max-size: "50m" max-file: "6" - web_server: - image: danswer/danswer-web-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-web-server:${IMAGE_TAG:-latest} build: context: ../../web dockerfile: Dockerfile @@ -226,9 +224,8 @@ services: # Enterprise Edition only - ENABLE_PAID_ENTERPRISE_EDITION_FEATURES=${ENABLE_PAID_ENTERPRISE_EDITION_FEATURES:-false} - inference_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} # for GPU support, please read installation guidelines in the README.md # bare minimum to get this working is to install nvidia-container-toolkit deploy: @@ -264,9 +261,8 @@ services: max-size: "50m" max-file: "6" - indexing_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server @@ -302,7 +298,6 @@ services: max-size: "50m" max-file: "6" - relational_db: image: postgres:15.2-alpine command: -c 'max_connections=250' @@ -315,7 +310,6 @@ services: volumes: - db_volume:/var/lib/postgresql/data - # This container name cannot have an underscore in it due to Vespa expectations of the URL index: image: vespaengine/vespa:8.277.17 @@ -331,12 +325,11 @@ services: max-size: "50m" max-file: "6" - nginx: image: nginx:1.23.4-alpine restart: always # nginx will immediately crash with `nginx: [emerg] host not found in upstream` - # if api_server / web_server are not up + # if api_server / web_server are not up depends_on: - api_server - web_server @@ -344,7 +337,7 @@ services: - DOMAIN=localhost ports: - "80:80" - - "3000:80" # allow for localhost:3000 usage, since that is the norm + - "3000:80" # allow for localhost:3000 usage, since that is the norm volumes: - ../data/nginx:/etc/nginx/conf.d logging: @@ -352,26 +345,24 @@ services: options: max-size: "50m" max-file: "6" - # The specified script waits for the api_server to start up. - # Without this we've seen issues where nginx shows no error logs but + # The specified script waits for the api_server to start up. + # Without this we've seen issues where nginx shows no error logs but # does not recieve any traffic # NOTE: we have to use dos2unix to remove Carriage Return chars from the file # in order to make this work on both Unix-like systems and windows - command: > + command: > /bin/sh -c "dos2unix /etc/nginx/conf.d/run-nginx.sh && /etc/nginx/conf.d/run-nginx.sh app.conf.template.dev" - cache: image: redis:7.4-alpine restart: always ports: - - '6379:6379' + - "6379:6379" # docker silently mounts /data even without an explicit volume mount, which enables # persistence. explicitly setting save and appendonly forces ephemeral behavior. command: redis-server --save "" --appendonly no - volumes: db_volume: vespa_volume: diff --git a/deployment/docker_compose/docker-compose.prod-cloud.yml b/deployment/docker_compose/docker-compose.prod-cloud.yml index 392d7c67ad4..49706f525b3 100644 --- a/deployment/docker_compose/docker-compose.prod-cloud.yml +++ b/deployment/docker_compose/docker-compose.prod-cloud.yml @@ -1,13 +1,13 @@ services: api_server: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.cloud command: > /bin/sh -c "alembic -n schema_private upgrade head && - echo \"Starting Danswer Api Server\" && - uvicorn danswer.main:app --host 0.0.0.0 --port 8080" + echo \"Starting Onyx Api Server\" && + uvicorn onyx.main:app --host 0.0.0.0 --port 8080" depends_on: - relational_db - index @@ -30,9 +30,8 @@ services: max-size: "50m" max-file: "6" - background: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile @@ -62,7 +61,7 @@ services: max-file: "6" web_server: - image: danswer/danswer-web-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-web-server:${IMAGE_TAG:-latest} build: context: ../../web dockerfile: Dockerfile @@ -86,7 +85,6 @@ services: max-size: "50m" max-file: "6" - relational_db: image: postgres:15.2-alpine command: -c 'max_connections=250' @@ -102,9 +100,8 @@ services: max-size: "50m" max-file: "6" - inference_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server @@ -129,9 +126,8 @@ services: max-size: "50m" max-file: "6" - indexing_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server @@ -158,7 +154,6 @@ services: max-size: "50m" max-file: "6" - # This container name cannot have an underscore in it due to Vespa expectations of the URL index: image: vespaengine/vespa:8.277.17 @@ -174,12 +169,11 @@ services: max-size: "50m" max-file: "6" - nginx: image: nginx:1.23.4-alpine restart: always # nginx will immediately crash with `nginx: [emerg] host not found in upstream` - # if api_server / web_server are not up + # if api_server / web_server are not up depends_on: - api_server - web_server @@ -190,26 +184,25 @@ services: - ../data/nginx:/etc/nginx/conf.d - ../data/certbot/conf:/etc/letsencrypt - ../data/certbot/www:/var/www/certbot - # sleep a little bit to allow the web_server / api_server to start up. - # Without this we've seen issues where nginx shows no error logs but + # sleep a little bit to allow the web_server / api_server to start up. + # Without this we've seen issues where nginx shows no error logs but # does not recieve any traffic logging: driver: json-file options: max-size: "50m" max-file: "6" - # The specified script waits for the api_server to start up. - # Without this we've seen issues where nginx shows no error logs but - # does not recieve any traffic + # The specified script waits for the api_server to start up. + # Without this we've seen issues where nginx shows no error logs but + # does not recieve any traffic # NOTE: we have to use dos2unix to remove Carriage Return chars from the file # in order to make this work on both Unix-like systems and windows - command: > + command: > /bin/sh -c "dos2unix /etc/nginx/conf.d/run-nginx.sh && /etc/nginx/conf.d/run-nginx.sh app.conf.template" env_file: - .env.nginx - # follows https://pentacent.medium.com/nginx-and-lets-encrypt-with-docker-in-less-than-5-minutes-b4b8a60d3a71 certbot: image: certbot/certbot @@ -224,17 +217,15 @@ services: max-file: "6" entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" - cache: image: redis:7.4-alpine restart: always ports: - - '6379:6379' + - "6379:6379" # docker silently mounts /data even without an explicit volume mount, which enables # persistence. explicitly setting save and appendonly forces ephemeral behavior. command: redis-server --save "" --appendonly no - volumes: db_volume: vespa_volume: diff --git a/deployment/docker_compose/docker-compose.prod-no-letsencrypt.yml b/deployment/docker_compose/docker-compose.prod-no-letsencrypt.yml index 8ec6d437646..69f96031163 100644 --- a/deployment/docker_compose/docker-compose.prod-no-letsencrypt.yml +++ b/deployment/docker_compose/docker-compose.prod-no-letsencrypt.yml @@ -1,13 +1,13 @@ services: api_server: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile command: > /bin/sh -c "alembic upgrade head && - echo \"Starting Danswer Api Server\" && - uvicorn danswer.main:app --host 0.0.0.0 --port 8080" + echo \"Starting Onyx Api Server\" && + uvicorn onyx.main:app --host 0.0.0.0 --port 8080" depends_on: - relational_db - index @@ -30,9 +30,8 @@ services: max-size: "50m" max-file: "6" - background: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile @@ -61,9 +60,8 @@ services: max-size: "50m" max-file: "6" - web_server: - image: danswer/danswer-web-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-web-server:${IMAGE_TAG:-latest} build: context: ../../web dockerfile: Dockerfile @@ -88,9 +86,8 @@ services: max-size: "50m" max-file: "6" - inference_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server @@ -115,9 +112,8 @@ services: max-size: "50m" max-file: "6" - indexing_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server @@ -144,7 +140,6 @@ services: max-size: "50m" max-file: "6" - relational_db: image: postgres:15.2-alpine command: -c 'max_connections=250' @@ -160,7 +155,6 @@ services: max-size: "50m" max-file: "6" - # This container name cannot have an underscore in it due to Vespa expectations of the URL index: image: vespaengine/vespa:8.277.17 @@ -176,12 +170,11 @@ services: max-size: "50m" max-file: "6" - nginx: image: nginx:1.23.4-alpine restart: always # nginx will immediately crash with `nginx: [emerg] host not found in upstream` - # if api_server / web_server are not up + # if api_server / web_server are not up depends_on: - api_server - web_server @@ -196,28 +189,26 @@ services: options: max-size: "50m" max-file: "6" - # The specified script waits for the api_server to start up. - # Without this we've seen issues where nginx shows no error logs but + # The specified script waits for the api_server to start up. + # Without this we've seen issues where nginx shows no error logs but # does not recieve any traffic # NOTE: we have to use dos2unix to remove Carriage Return chars from the file # in order to make this work on both Unix-like systems and windows - command: > + command: > /bin/sh -c "dos2unix /etc/nginx/conf.d/run-nginx.sh && /etc/nginx/conf.d/run-nginx.sh app.conf.template.no-letsencrypt" env_file: - .env.nginx - cache: image: redis:7.4-alpine restart: always ports: - - '6379:6379' + - "6379:6379" # docker silently mounts /data even without an explicit volume mount, which enables # persistence. explicitly setting save and appendonly forces ephemeral behavior. command: redis-server --save "" --appendonly no - volumes: db_volume: vespa_volume: diff --git a/deployment/docker_compose/docker-compose.prod.yml b/deployment/docker_compose/docker-compose.prod.yml index 18afe127955..71bee045092 100644 --- a/deployment/docker_compose/docker-compose.prod.yml +++ b/deployment/docker_compose/docker-compose.prod.yml @@ -1,14 +1,14 @@ services: api_server: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile command: > /bin/sh -c " alembic upgrade head && - echo \"Starting Danswer Api Server\" && - uvicorn danswer.main:app --host 0.0.0.0 --port 8080" + echo \"Starting Onyx Api Server\" && + uvicorn onyx.main:app --host 0.0.0.0 --port 8080" depends_on: - relational_db - index @@ -31,7 +31,7 @@ services: max-size: "50m" max-file: "6" background: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile @@ -74,7 +74,7 @@ services: # - ${CA_CERT_PATH:-./custom-ca.crt}:/etc/ssl/certs/custom-ca.crt:ro web_server: - image: danswer/danswer-web-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-web-server:${IMAGE_TAG:-latest} build: context: ../../web dockerfile: Dockerfile @@ -114,7 +114,7 @@ services: max-file: "6" inference_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server @@ -140,7 +140,7 @@ services: max-file: "6" indexing_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server diff --git a/deployment/docker_compose/docker-compose.search-testing.yml b/deployment/docker_compose/docker-compose.search-testing.yml index fab950c064e..68a1aaedc33 100644 --- a/deployment/docker_compose/docker-compose.search-testing.yml +++ b/deployment/docker_compose/docker-compose.search-testing.yml @@ -1,13 +1,13 @@ services: api_server: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile command: > /bin/sh -c "alembic upgrade head && - echo \"Starting Danswer Api Server\" && - uvicorn danswer.main:app --host 0.0.0.0 --port 8080" + echo \"Starting Onyx Api Server\" && + uvicorn onyx.main:app --host 0.0.0.0 --port 8080" depends_on: - relational_db - index @@ -37,9 +37,8 @@ services: max-size: "50m" max-file: "6" - background: - image: danswer/danswer-backend:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-backend:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile @@ -69,9 +68,8 @@ services: max-size: "50m" max-file: "6" - web_server: - image: danswer/danswer-web-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-web-server:${IMAGE_TAG:-latest} build: context: ../../web dockerfile: Dockerfile @@ -85,7 +83,7 @@ services: # Enterprise Edition only - NEXT_PUBLIC_THEME=${NEXT_PUBLIC_THEME:-} - # DO NOT TURN ON unless you have EXPLICIT PERMISSION from Danswer. + # DO NOT TURN ON unless you have EXPLICIT PERMISSION from Onyx. - NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED=${NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED:-false} depends_on: - api_server @@ -98,9 +96,8 @@ services: # Enterprise Edition only - ENABLE_PAID_ENTERPRISE_EDITION_FEATURES=${ENABLE_PAID_ENTERPRISE_EDITION_FEATURES:-false} - inference_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server @@ -122,9 +119,8 @@ services: max-size: "50m" max-file: "6" - indexing_model_server: - image: danswer/danswer-model-server:${IMAGE_TAG:-latest} + image: onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest} build: context: ../../backend dockerfile: Dockerfile.model_server @@ -148,7 +144,6 @@ services: max-size: "50m" max-file: "6" - relational_db: image: postgres:15.2-alpine command: -c 'max_connections=250' @@ -161,7 +156,6 @@ services: volumes: - db_volume:/var/lib/postgresql/data - # This container name cannot have an underscore in it due to Vespa expectations of the URL index: image: vespaengine/vespa:8.277.17 @@ -177,19 +171,18 @@ services: max-size: "50m" max-file: "6" - nginx: image: nginx:1.23.4-alpine restart: always # nginx will immediately crash with `nginx: [emerg] host not found in upstream` - # if api_server / web_server are not up + # if api_server / web_server are not up depends_on: - api_server - web_server environment: - DOMAIN=localhost - ports: - - "${NGINX_PORT:-3000}:80" # allow for localhost:3000 usage, since that is the norm + ports: + - "${NGINX_PORT:-3000}:80" # allow for localhost:3000 usage, since that is the norm volumes: - ../data/nginx:/etc/nginx/conf.d logging: @@ -197,26 +190,24 @@ services: options: max-size: "50m" max-file: "6" - # The specified script waits for the api_server to start up. - # Without this we've seen issues where nginx shows no error logs but + # The specified script waits for the api_server to start up. + # Without this we've seen issues where nginx shows no error logs but # does not recieve any traffic # NOTE: we have to use dos2unix to remove Carriage Return chars from the file # in order to make this work on both Unix-like systems and windows - command: > + command: > /bin/sh -c "dos2unix /etc/nginx/conf.d/run-nginx.sh && /etc/nginx/conf.d/run-nginx.sh app.conf.template.dev" - cache: image: redis:7.4-alpine restart: always ports: - - '6379:6379' + - "6379:6379" # docker silently mounts /data even without an explicit volume mount, which enables # persistence. explicitly setting save and appendonly forces ephemeral behavior. command: redis-server --save "" --appendonly no - volumes: db_volume: driver: local diff --git a/deployment/docker_compose/env.multilingual.template b/deployment/docker_compose/env.multilingual.template index 1a66dbfbbde..006f0d2a89f 100644 --- a/deployment/docker_compose/env.multilingual.template +++ b/deployment/docker_compose/env.multilingual.template @@ -1,5 +1,5 @@ -# This env template shows how to configure Danswer for custom multilingual use -# Note that for most use cases it will be enough to configure Danswer multilingual purely through the UI +# This env template shows how to configure Onyx for custom multilingual use +# Note that for most use cases it will be enough to configure Onyx multilingual purely through the UI # See "Search Settings" -> "Advanced" for UI options. # To use it, copy it to .env in the docker_compose directory (or the equivalent environment settings file for your deployment) diff --git a/deployment/docker_compose/env.nginx.template b/deployment/docker_compose/env.nginx.template index 2fc2923a9e5..23ba4e6e851 100644 --- a/deployment/docker_compose/env.nginx.template +++ b/deployment/docker_compose/env.nginx.template @@ -3,7 +3,7 @@ DOMAIN= EMAIL= # If using the `no-letsencrypt` setup, the below are required. -# They specify the path within /danswer/deployment/data/sslcerts directory +# They specify the path within /onyx/deployment/data/sslcerts directory # where the certificate / certificate key can be found. You can either # name your certificate / certificate key files to follow the convention # below or adjust these to match your naming conventions. diff --git a/deployment/docker_compose/env.prod.template b/deployment/docker_compose/env.prod.template index 0c09f6283e8..efed4e304cb 100644 --- a/deployment/docker_compose/env.prod.template +++ b/deployment/docker_compose/env.prod.template @@ -3,7 +3,7 @@ # This is only necessary when using the docker-compose.prod.yml compose file. -# Could be something like danswer.companyname.com +# Could be something like onyx.companyname.com WEB_DOMAIN=http://localhost:3000 @@ -14,8 +14,8 @@ WEB_DOMAIN=http://localhost:3000 # disabled # basic (standard username / password) # google_oauth (login with google/gmail account) -# oidc (only in Danswer enterprise edition) -# saml (only in Danswer enterprise edition) +# oidc (only in Onyx enterprise edition) +# saml (only in Onyx enterprise edition) AUTH_TYPE=google_oauth # Set the values below to use with Google OAuth diff --git a/deployment/docker_compose/init-letsencrypt.sh b/deployment/docker_compose/init-letsencrypt.sh index 66161e4dfbe..acbb65863b1 100755 --- a/deployment/docker_compose/init-letsencrypt.sh +++ b/deployment/docker_compose/init-letsencrypt.sh @@ -52,7 +52,7 @@ fi echo "### Creating dummy certificate for $domains ..." path="/etc/letsencrypt/live/$domains" mkdir -p "$data_path/conf/live/$domains" -$COMPOSE_CMD -f docker-compose.prod.yml run --name danswer-stack --rm --entrypoint "\ +$COMPOSE_CMD -f docker-compose.prod.yml run --name onyx-stack --rm --entrypoint "\ openssl req -x509 -nodes -newkey rsa:$rsa_key_size -days 1\ -keyout '$path/privkey.pem' \ -out '$path/fullchain.pem' \ @@ -61,7 +61,7 @@ echo echo "### Starting nginx ..." -$COMPOSE_CMD -f docker-compose.prod.yml -p danswer-stack up --force-recreate -d nginx +$COMPOSE_CMD -f docker-compose.prod.yml -p onyx-stack up --force-recreate -d nginx echo echo "Waiting for nginx to be ready, this may take a minute..." @@ -79,7 +79,7 @@ while true; do done echo "### Deleting dummy certificate for $domains ..." -$COMPOSE_CMD -f docker-compose.prod.yml run --name danswer-stack --rm --entrypoint "\ +$COMPOSE_CMD -f docker-compose.prod.yml run --name onyx-stack --rm --entrypoint "\ rm -Rf /etc/letsencrypt/live/$domains && \ rm -Rf /etc/letsencrypt/archive/$domains && \ rm -Rf /etc/letsencrypt/renewal/$domains.conf" certbot @@ -102,7 +102,7 @@ esac # Enable staging mode if needed if [ $staging != "0" ]; then staging_arg="--staging"; fi -$COMPOSE_CMD -f docker-compose.prod.yml run --name danswer-stack --rm --entrypoint "\ +$COMPOSE_CMD -f docker-compose.prod.yml run --name onyx-stack --rm --entrypoint "\ certbot certonly --webroot -w /var/www/certbot \ $staging_arg \ $email_arg \ @@ -113,7 +113,7 @@ $COMPOSE_CMD -f docker-compose.prod.yml run --name danswer-stack --rm --entrypoi echo echo "### Renaming certificate directory if needed ..." -$COMPOSE_CMD -f docker-compose.prod.yml run --name danswer-stack --rm --entrypoint "\ +$COMPOSE_CMD -f docker-compose.prod.yml run --name onyx-stack --rm --entrypoint "\ sh -c 'for domain in $domains; do \ numbered_dir=\$(find /etc/letsencrypt/live -maxdepth 1 -type d -name \"\$domain-00*\" | sort -r | head -n1); \ if [ -n \"\$numbered_dir\" ]; then \ @@ -122,4 +122,4 @@ $COMPOSE_CMD -f docker-compose.prod.yml run --name danswer-stack --rm --entrypoi done'" certbot echo "### Reloading nginx ..." -$COMPOSE_CMD -f docker-compose.prod.yml -p danswer-stack up --force-recreate -d +$COMPOSE_CMD -f docker-compose.prod.yml -p onyx-stack up --force-recreate -d diff --git a/deployment/helm/charts/danswer/templates/configmap.yaml b/deployment/helm/charts/danswer/templates/configmap.yaml deleted file mode 100755 index e3cbf9d4c41..00000000000 --- a/deployment/helm/charts/danswer/templates/configmap.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Values.config.envConfigMapName }} - labels: - {{- include "danswer-stack.labels" . | nindent 4 }} -data: - INTERNAL_URL: "http://{{ include "danswer-stack.fullname" . }}-api-service:{{ .Values.api.service.port | default 8080 }}" - POSTGRES_HOST: {{ .Release.Name }}-postgresql - VESPA_HOST: da-vespa-0.vespa-service - REDIS_HOST: {{ .Release.Name }}-redis-master - MODEL_SERVER_HOST: "{{ include "danswer-stack.fullname" . }}-inference-model-service" - INDEXING_MODEL_SERVER_HOST: "{{ include "danswer-stack.fullname" . }}-indexing-model-service" -{{- range $key, $value := .Values.configMap }} - {{ $key }}: "{{ $value }}" -{{- end }} \ No newline at end of file diff --git a/deployment/helm/charts/danswer/templates/tests/test-connection.yaml b/deployment/helm/charts/danswer/templates/tests/test-connection.yaml deleted file mode 100644 index d3b57dd4354..00000000000 --- a/deployment/helm/charts/danswer/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "danswer-stack.fullname" . }}-test-connection" - labels: - {{- include "danswer-stack.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "danswer-stack.fullname" . }}-webserver:{{ .Values.webserver.service.port }}'] - restartPolicy: Never diff --git a/deployment/helm/charts/danswer/.gitignore b/deployment/helm/charts/onyx/.gitignore similarity index 100% rename from deployment/helm/charts/danswer/.gitignore rename to deployment/helm/charts/onyx/.gitignore diff --git a/deployment/helm/charts/danswer/.helmignore b/deployment/helm/charts/onyx/.helmignore similarity index 100% rename from deployment/helm/charts/danswer/.helmignore rename to deployment/helm/charts/onyx/.helmignore diff --git a/deployment/helm/charts/danswer/Chart.lock b/deployment/helm/charts/onyx/Chart.lock similarity index 100% rename from deployment/helm/charts/danswer/Chart.lock rename to deployment/helm/charts/onyx/Chart.lock diff --git a/deployment/helm/charts/danswer/Chart.yaml b/deployment/helm/charts/onyx/Chart.yaml similarity index 79% rename from deployment/helm/charts/danswer/Chart.yaml rename to deployment/helm/charts/onyx/Chart.yaml index b033122c0fc..9c1cdbb2350 100644 --- a/deployment/helm/charts/danswer/Chart.yaml +++ b/deployment/helm/charts/onyx/Chart.yaml @@ -1,9 +1,9 @@ apiVersion: v2 -name: danswer-stack +name: onyx-stack description: A Helm chart for Kubernetes -home: https://www.danswer.ai/ +home: https://www.onyx.app/ sources: - - "https://github.com/danswer-ai/danswer" + - "https://github.com/onyx-dot-app/onyx" type: application version: 0.2.1 appVersion: "latest" @@ -12,9 +12,9 @@ annotations: licenses: MIT images: | - name: webserver - image: docker.io/danswer/danswer-web-server:latest + image: docker.io/onyxdotapp/onyx-web-server:latest - name: background - image: docker.io/danswer/danswer-backend:latest + image: docker.io/onyxdotapp/onyx-backend:latest - name: vespa image: vespaengine/vespa:8.277.17 dependencies: diff --git a/deployment/helm/charts/danswer/templates/_helpers.tpl b/deployment/helm/charts/onyx/templates/_helpers.tpl similarity index 69% rename from deployment/helm/charts/danswer/templates/_helpers.tpl rename to deployment/helm/charts/onyx/templates/_helpers.tpl index 483a5b5e5af..4211d02b069 100644 --- a/deployment/helm/charts/danswer/templates/_helpers.tpl +++ b/deployment/helm/charts/onyx/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "danswer-stack.name" -}} +{{- define "onyx-stack.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). If release name contains chart name it will be used as a full name. */}} -{{- define "danswer-stack.fullname" -}} +{{- define "onyx-stack.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "danswer-stack.chart" -}} +{{- define "onyx-stack.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "danswer-stack.labels" -}} -helm.sh/chart: {{ include "danswer-stack.chart" . }} -{{ include "danswer-stack.selectorLabels" . }} +{{- define "onyx-stack.labels" -}} +helm.sh/chart: {{ include "onyx-stack.chart" . }} +{{ include "onyx-stack.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "danswer-stack.selectorLabels" -}} -app.kubernetes.io/name: {{ include "danswer-stack.name" . }} +{{- define "onyx-stack.selectorLabels" -}} +app.kubernetes.io/name: {{ include "onyx-stack.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "danswer-stack.serviceAccountName" -}} +{{- define "onyx-stack.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "danswer-stack.fullname" .) .Values.serviceAccount.name }} +{{- default (include "onyx-stack.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} @@ -64,19 +64,19 @@ Create the name of the service account to use {{/* Set secret name */}} -{{- define "danswer-stack.secretName" -}} -{{- default (default "danswer-secrets" .Values.auth.secretName) .Values.auth.existingSecret }} +{{- define "onyx-stack.secretName" -}} +{{- default (default "onyx-secrets" .Values.auth.secretName) .Values.auth.existingSecret }} {{- end }} {{/* Create env vars from secrets */}} -{{- define "danswer-stack.envSecrets" -}} +{{- define "onyx-stack.envSecrets" -}} {{- range $name, $key := .Values.auth.secretKeys }} - name: {{ $name | upper | replace "-" "_" | quote }} valueFrom: secretKeyRef: - name: {{ include "danswer-stack.secretName" $ }} + name: {{ include "onyx-stack.secretName" $ }} key: {{ default $name $key }} {{- end }} {{- end }} diff --git a/deployment/helm/charts/danswer/templates/api-deployment.yaml b/deployment/helm/charts/onyx/templates/api-deployment.yaml similarity index 75% rename from deployment/helm/charts/danswer/templates/api-deployment.yaml rename to deployment/helm/charts/onyx/templates/api-deployment.yaml index 7f10bffafd0..53784ea531a 100644 --- a/deployment/helm/charts/danswer/templates/api-deployment.yaml +++ b/deployment/helm/charts/onyx/templates/api-deployment.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "danswer-stack.fullname" . }}-api-deployment + name: {{ include "onyx-stack.fullname" . }}-api-deployment labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} spec: {{- if not .Values.api.autoscaling.enabled }} replicas: {{ .Values.api.replicaCount }} {{- end }} selector: matchLabels: - {{- include "danswer-stack.selectorLabels" . | nindent 6 }} + {{- include "onyx-stack.selectorLabels" . | nindent 6 }} {{- if .Values.api.deploymentLabels }} {{- toYaml .Values.api.deploymentLabels | nindent 6 }} {{- end }} @@ -21,7 +21,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "danswer-stack.labels" . | nindent 8 }} + {{- include "onyx-stack.labels" . | nindent 8 }} {{- with .Values.api.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} @@ -30,7 +30,7 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "danswer-stack.serviceAccountName" . }} + serviceAccountName: {{ include "onyx-stack.serviceAccountName" . }} securityContext: {{- toYaml .Values.api.podSecurityContext | nindent 8 }} containers: @@ -44,8 +44,8 @@ spec: - "-c" - | alembic upgrade head && - echo "Starting Danswer Api Server" && - uvicorn danswer.main:app --host 0.0.0.0 --port 8080 + echo "Starting Onyx Api Server" && + uvicorn onyx.main:app --host 0.0.0.0 --port 8080 ports: - name: api-server-port containerPort: {{ .Values.api.service.port }} @@ -56,4 +56,4 @@ spec: - configMapRef: name: {{ .Values.config.envConfigMapName }} env: - {{- include "danswer-stack.envSecrets" . | nindent 12}} + {{- include "onyx-stack.envSecrets" . | nindent 12}} diff --git a/deployment/helm/charts/danswer/templates/api-hpa.yaml b/deployment/helm/charts/onyx/templates/api-hpa.yaml similarity index 84% rename from deployment/helm/charts/danswer/templates/api-hpa.yaml rename to deployment/helm/charts/onyx/templates/api-hpa.yaml index 378c39715ad..9f97d20428b 100644 --- a/deployment/helm/charts/danswer/templates/api-hpa.yaml +++ b/deployment/helm/charts/onyx/templates/api-hpa.yaml @@ -2,14 +2,14 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "danswer-stack.fullname" . }}-api + name: {{ include "onyx-stack.fullname" . }}-api labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "danswer-stack.fullname" . }} + name: {{ include "onyx-stack.fullname" . }} minReplicas: {{ .Values.api.autoscaling.minReplicas }} maxReplicas: {{ .Values.api.autoscaling.maxReplicas }} metrics: diff --git a/deployment/helm/charts/danswer/templates/api-service.yaml b/deployment/helm/charts/onyx/templates/api-service.yaml similarity index 75% rename from deployment/helm/charts/danswer/templates/api-service.yaml rename to deployment/helm/charts/onyx/templates/api-service.yaml index 1fd74d4ddf5..c5cf5577a8d 100644 --- a/deployment/helm/charts/danswer/templates/api-service.yaml +++ b/deployment/helm/charts/onyx/templates/api-service.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: Service metadata: # INTERNAL_URL env variable depends on this, don't change without changing INTERNAL_URL - name: {{ include "danswer-stack.fullname" . }}-api-service + name: {{ include "onyx-stack.fullname" . }}-api-service labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} {{- if .Values.api.deploymentLabels }} {{- toYaml .Values.api.deploymentLabels | nindent 4 }} {{- end }} @@ -16,7 +16,7 @@ spec: protocol: TCP name: api-server-port selector: - {{- include "danswer-stack.selectorLabels" . | nindent 4 }} + {{- include "onyx-stack.selectorLabels" . | nindent 4 }} {{- if .Values.api.deploymentLabels }} {{- toYaml .Values.api.deploymentLabels | nindent 4 }} {{- end }} diff --git a/deployment/helm/charts/danswer/templates/background-deployment.yaml b/deployment/helm/charts/onyx/templates/background-deployment.yaml similarity index 79% rename from deployment/helm/charts/danswer/templates/background-deployment.yaml rename to deployment/helm/charts/onyx/templates/background-deployment.yaml index f4ac25fe0bc..cc42e29ad56 100644 --- a/deployment/helm/charts/danswer/templates/background-deployment.yaml +++ b/deployment/helm/charts/onyx/templates/background-deployment.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "danswer-stack.fullname" . }}-background + name: {{ include "onyx-stack.fullname" . }}-background labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} spec: {{- if not .Values.background.autoscaling.enabled }} replicas: {{ .Values.background.replicaCount }} {{- end }} selector: matchLabels: - {{- include "danswer-stack.selectorLabels" . | nindent 6 }} + {{- include "onyx-stack.selectorLabels" . | nindent 6 }} {{- if .Values.background.deploymentLabels }} {{- toYaml .Values.background.deploymentLabels | nindent 6 }} {{- end }} @@ -21,7 +21,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "danswer-stack.labels" . | nindent 8 }} + {{- include "onyx-stack.labels" . | nindent 8 }} {{- with .Values.background.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} @@ -30,7 +30,7 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "danswer-stack.serviceAccountName" . }} + serviceAccountName: {{ include "onyx-stack.serviceAccountName" . }} securityContext: {{- toYaml .Values.background.podSecurityContext | nindent 8 }} containers: @@ -48,4 +48,4 @@ spec: env: - name: ENABLE_MULTIPASS_INDEXING value: "{{ .Values.background.enableMiniChunk }}" - {{- include "danswer-stack.envSecrets" . | nindent 12}} + {{- include "onyx-stack.envSecrets" . | nindent 12}} diff --git a/deployment/helm/charts/danswer/templates/background-hpa.yaml b/deployment/helm/charts/onyx/templates/background-hpa.yaml similarity index 84% rename from deployment/helm/charts/danswer/templates/background-hpa.yaml rename to deployment/helm/charts/onyx/templates/background-hpa.yaml index 009daf10f05..b49ccc99ab5 100644 --- a/deployment/helm/charts/danswer/templates/background-hpa.yaml +++ b/deployment/helm/charts/onyx/templates/background-hpa.yaml @@ -2,14 +2,14 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "danswer-stack.fullname" . }}-background + name: {{ include "onyx-stack.fullname" . }}-background labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "danswer-stack.fullname" . }} + name: {{ include "onyx-stack.fullname" . }} minReplicas: {{ .Values.background.autoscaling.minReplicas }} maxReplicas: {{ .Values.background.autoscaling.maxReplicas }} metrics: diff --git a/deployment/helm/charts/onyx/templates/configmap.yaml b/deployment/helm/charts/onyx/templates/configmap.yaml new file mode 100755 index 00000000000..3a79eca7da7 --- /dev/null +++ b/deployment/helm/charts/onyx/templates/configmap.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.config.envConfigMapName }} + labels: + {{- include "onyx-stack.labels" . | nindent 4 }} +data: + INTERNAL_URL: "http://{{ include "onyx-stack.fullname" . }}-api-service:{{ .Values.api.service.port | default 8080 }}" + POSTGRES_HOST: {{ .Release.Name }}-postgresql + VESPA_HOST: da-vespa-0.vespa-service + REDIS_HOST: {{ .Release.Name }}-redis-master + MODEL_SERVER_HOST: "{{ include "onyx-stack.fullname" . }}-inference-model-service" + INDEXING_MODEL_SERVER_HOST: "{{ include "onyx-stack.fullname" . }}-indexing-model-service" +{{- range $key, $value := .Values.configMap }} + {{ $key }}: "{{ $value }}" +{{- end }} \ No newline at end of file diff --git a/deployment/helm/charts/danswer/templates/danswer-secret.yaml b/deployment/helm/charts/onyx/templates/danswer-secret.yaml similarity index 81% rename from deployment/helm/charts/danswer/templates/danswer-secret.yaml rename to deployment/helm/charts/onyx/templates/danswer-secret.yaml index 6b2aa317204..d05ca25642b 100644 --- a/deployment/helm/charts/danswer/templates/danswer-secret.yaml +++ b/deployment/helm/charts/onyx/templates/danswer-secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: {{ include "danswer-stack.secretName" . }} + name: {{ include "onyx-stack.secretName" . }} type: Opaque stringData: {{- range $name, $value := .Values.auth.secrets }} diff --git a/deployment/helm/charts/danswer/templates/indexing-model-deployment.yaml b/deployment/helm/charts/onyx/templates/indexing-model-deployment.yaml similarity index 79% rename from deployment/helm/charts/danswer/templates/indexing-model-deployment.yaml rename to deployment/helm/charts/onyx/templates/indexing-model-deployment.yaml index cc88aefb79a..14b30e676cc 100644 --- a/deployment/helm/charts/danswer/templates/indexing-model-deployment.yaml +++ b/deployment/helm/charts/onyx/templates/indexing-model-deployment.yaml @@ -1,14 +1,14 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "danswer-stack.fullname" . }}-indexing-model + name: {{ include "onyx-stack.fullname" . }}-indexing-model labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} spec: replicas: 1 selector: matchLabels: - {{- include "danswer-stack.selectorLabels" . | nindent 6 }} + {{- include "onyx-stack.selectorLabels" . | nindent 6 }} {{- if .Values.indexCapability.deploymentLabels }} {{- toYaml .Values.indexCapability.deploymentLabels | nindent 6 }} {{- end }} @@ -19,14 +19,14 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "danswer-stack.labels" . | nindent 8 }} + {{- include "onyx-stack.labels" . | nindent 8 }} {{- with .Values.indexCapability.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: containers: - name: indexing-model-server - image: danswer/danswer-model-server:latest + image: onyxdotapp/onyx-model-server:latest imagePullPolicy: IfNotPresent command: [ "uvicorn", "model_server.main:app", "--host", "0.0.0.0", "--port", "9000", "--limit-concurrency", "10" ] ports: @@ -37,7 +37,7 @@ spec: env: - name: INDEXING_ONLY value: "{{ default "True" .Values.indexCapability.indexingOnly }}" - {{- include "danswer-stack.envSecrets" . | nindent 10}} + {{- include "onyx-stack.envSecrets" . | nindent 10}} volumeMounts: {{- range .Values.indexCapability.volumeMounts }} - name: {{ .name }} diff --git a/deployment/helm/charts/danswer/templates/indexing-model-pvc.yaml b/deployment/helm/charts/onyx/templates/indexing-model-pvc.yaml similarity index 100% rename from deployment/helm/charts/danswer/templates/indexing-model-pvc.yaml rename to deployment/helm/charts/onyx/templates/indexing-model-pvc.yaml diff --git a/deployment/helm/charts/danswer/templates/indexing-model-service.yaml b/deployment/helm/charts/onyx/templates/indexing-model-service.yaml similarity index 70% rename from deployment/helm/charts/danswer/templates/indexing-model-service.yaml rename to deployment/helm/charts/onyx/templates/indexing-model-service.yaml index fbbeb6bee86..8d4070957d6 100644 --- a/deployment/helm/charts/danswer/templates/indexing-model-service.yaml +++ b/deployment/helm/charts/onyx/templates/indexing-model-service.yaml @@ -1,12 +1,12 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "danswer-stack.fullname" . }}-indexing-model-service + name: {{ include "onyx-stack.fullname" . }}-indexing-model-service labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} spec: selector: - {{- include "danswer-stack.selectorLabels" . | nindent 4 }} + {{- include "onyx-stack.selectorLabels" . | nindent 4 }} {{- if .Values.indexCapability.deploymentLabels }} {{- toYaml .Values.indexCapability.deploymentLabels | nindent 4 }} {{- end }} diff --git a/deployment/helm/charts/danswer/templates/inference-model-deployment.yaml b/deployment/helm/charts/onyx/templates/inference-model-deployment.yaml similarity index 92% rename from deployment/helm/charts/danswer/templates/inference-model-deployment.yaml rename to deployment/helm/charts/onyx/templates/inference-model-deployment.yaml index 43caddd29c3..9b02be41223 100644 --- a/deployment/helm/charts/danswer/templates/inference-model-deployment.yaml +++ b/deployment/helm/charts/onyx/templates/inference-model-deployment.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "danswer-stack.fullname" . }}-inference-model + name: {{ include "onyx-stack.fullname" . }}-inference-model labels: {{- range .Values.inferenceCapability.deployment.labels }} {{ .key }}: {{ .value }} @@ -31,7 +31,7 @@ spec: - configMapRef: name: {{ .Values.config.envConfigMapName }} env: - {{- include "danswer-stack.envSecrets" . | nindent 12}} + {{- include "onyx-stack.envSecrets" . | nindent 12}} volumeMounts: {{- range .Values.inferenceCapability.deployment.volumeMounts }} - name: {{ .name }} diff --git a/deployment/helm/charts/danswer/templates/inference-model-pvc.yaml b/deployment/helm/charts/onyx/templates/inference-model-pvc.yaml similarity index 100% rename from deployment/helm/charts/danswer/templates/inference-model-pvc.yaml rename to deployment/helm/charts/onyx/templates/inference-model-pvc.yaml diff --git a/deployment/helm/charts/danswer/templates/inference-model-service.yaml b/deployment/helm/charts/onyx/templates/inference-model-service.yaml similarity index 85% rename from deployment/helm/charts/danswer/templates/inference-model-service.yaml rename to deployment/helm/charts/onyx/templates/inference-model-service.yaml index 74433ac11da..720ffebd334 100644 --- a/deployment/helm/charts/danswer/templates/inference-model-service.yaml +++ b/deployment/helm/charts/onyx/templates/inference-model-service.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "danswer-stack.fullname" . }}-inference-model-service + name: {{ include "onyx-stack.fullname" . }}-inference-model-service spec: type: {{ .Values.inferenceCapability.service.type }} ports: diff --git a/deployment/helm/charts/danswer/templates/nginx-conf.yaml b/deployment/helm/charts/onyx/templates/nginx-conf.yaml similarity index 81% rename from deployment/helm/charts/danswer/templates/nginx-conf.yaml rename to deployment/helm/charts/onyx/templates/nginx-conf.yaml index 81ecbaaa2f6..769ffdb808d 100644 --- a/deployment/helm/charts/danswer/templates/nginx-conf.yaml +++ b/deployment/helm/charts/onyx/templates/nginx-conf.yaml @@ -1,15 +1,15 @@ apiVersion: v1 kind: ConfigMap metadata: - name: danswer-nginx-conf + name: onyx-nginx-conf data: nginx.conf: | upstream api_server { - server {{ include "danswer-stack.fullname" . }}-api-service:{{ .Values.api.service.port }} fail_timeout=0; + server {{ include "onyx-stack.fullname" . }}-api-service:{{ .Values.api.service.port }} fail_timeout=0; } upstream web_server { - server {{ include "danswer-stack.fullname" . }}-webserver:{{ .Values.webserver.service.port }} fail_timeout=0; + server {{ include "onyx-stack.fullname" . }}-webserver:{{ .Values.webserver.service.port }} fail_timeout=0; } server { diff --git a/deployment/helm/charts/danswer/templates/serviceaccount.yaml b/deployment/helm/charts/onyx/templates/serviceaccount.yaml similarity index 71% rename from deployment/helm/charts/danswer/templates/serviceaccount.yaml rename to deployment/helm/charts/onyx/templates/serviceaccount.yaml index afd351217ba..72a8567a5fb 100644 --- a/deployment/helm/charts/danswer/templates/serviceaccount.yaml +++ b/deployment/helm/charts/onyx/templates/serviceaccount.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "danswer-stack.serviceAccountName" . }} + name: {{ include "onyx-stack.serviceAccountName" . }} labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/deployment/helm/charts/onyx/templates/tests/test-connection.yaml b/deployment/helm/charts/onyx/templates/tests/test-connection.yaml new file mode 100644 index 00000000000..8360525377b --- /dev/null +++ b/deployment/helm/charts/onyx/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "onyx-stack.fullname" . }}-test-connection" + labels: + {{- include "onyx-stack.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "onyx-stack.fullname" . }}-webserver:{{ .Values.webserver.service.port }}'] + restartPolicy: Never diff --git a/deployment/helm/charts/danswer/templates/webserver-deployment.yaml b/deployment/helm/charts/onyx/templates/webserver-deployment.yaml similarity index 82% rename from deployment/helm/charts/danswer/templates/webserver-deployment.yaml rename to deployment/helm/charts/onyx/templates/webserver-deployment.yaml index c3505248fc6..ad04a4dcdf7 100644 --- a/deployment/helm/charts/danswer/templates/webserver-deployment.yaml +++ b/deployment/helm/charts/onyx/templates/webserver-deployment.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "danswer-stack.fullname" . }}-webserver + name: {{ include "onyx-stack.fullname" . }}-webserver labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} spec: {{- if not .Values.webserver.autoscaling.enabled }} replicas: {{ .Values.webserver.replicaCount }} {{- end }} selector: matchLabels: - {{- include "danswer-stack.selectorLabels" . | nindent 6 }} + {{- include "onyx-stack.selectorLabels" . | nindent 6 }} {{- if .Values.webserver.deploymentLabels }} {{- toYaml .Values.webserver.deploymentLabels | nindent 6 }} {{- end }} @@ -21,7 +21,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "danswer-stack.labels" . | nindent 8 }} + {{- include "onyx-stack.labels" . | nindent 8 }} {{- with .Values.webserver.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} @@ -30,7 +30,7 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "danswer-stack.serviceAccountName" . }} + serviceAccountName: {{ include "onyx-stack.serviceAccountName" . }} securityContext: {{- toYaml .Values.webserver.podSecurityContext | nindent 8 }} containers: @@ -49,7 +49,7 @@ spec: - configMapRef: name: {{ .Values.config.envConfigMapName }} env: - {{- include "danswer-stack.envSecrets" . | nindent 12}} + {{- include "onyx-stack.envSecrets" . | nindent 12}} {{- with .Values.webserver.volumeMounts }} volumeMounts: {{- toYaml . | nindent 12 }} diff --git a/deployment/helm/charts/danswer/templates/webserver-hpa.yaml b/deployment/helm/charts/onyx/templates/webserver-hpa.yaml similarity index 84% rename from deployment/helm/charts/danswer/templates/webserver-hpa.yaml rename to deployment/helm/charts/onyx/templates/webserver-hpa.yaml index b46820a7fac..97db98ffe0d 100644 --- a/deployment/helm/charts/danswer/templates/webserver-hpa.yaml +++ b/deployment/helm/charts/onyx/templates/webserver-hpa.yaml @@ -2,14 +2,14 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "danswer-stack.fullname" . }}-webserver + name: {{ include "onyx-stack.fullname" . }}-webserver labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "danswer-stack.fullname" . }} + name: {{ include "onyx-stack.fullname" . }} minReplicas: {{ .Values.webserver.autoscaling.minReplicas }} maxReplicas: {{ .Values.webserver.autoscaling.maxReplicas }} metrics: diff --git a/deployment/helm/charts/danswer/templates/webserver-service.yaml b/deployment/helm/charts/onyx/templates/webserver-service.yaml similarity index 73% rename from deployment/helm/charts/danswer/templates/webserver-service.yaml rename to deployment/helm/charts/onyx/templates/webserver-service.yaml index 3e33566fce1..43073bf8c84 100644 --- a/deployment/helm/charts/danswer/templates/webserver-service.yaml +++ b/deployment/helm/charts/onyx/templates/webserver-service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "danswer-stack.fullname" . }}-webserver + name: {{ include "onyx-stack.fullname" . }}-webserver labels: - {{- include "danswer-stack.labels" . | nindent 4 }} + {{- include "onyx-stack.labels" . | nindent 4 }} {{- if .Values.webserver.deploymentLabels }} {{- toYaml .Values.webserver.deploymentLabels | nindent 4 }} {{- end }} @@ -15,7 +15,7 @@ spec: protocol: TCP name: http selector: - {{- include "danswer-stack.selectorLabels" . | nindent 4 }} + {{- include "onyx-stack.selectorLabels" . | nindent 4 }} {{- if .Values.webserver.deploymentLabels }} {{- toYaml .Values.webserver.deploymentLabels | nindent 4 }} {{- end }} diff --git a/deployment/helm/charts/danswer/values.yaml b/deployment/helm/charts/onyx/values.yaml similarity index 84% rename from deployment/helm/charts/danswer/values.yaml rename to deployment/helm/charts/onyx/values.yaml index 7ed77e8e944..127ce531be7 100644 --- a/deployment/helm/charts/danswer/values.yaml +++ b/deployment/helm/charts/onyx/values.yaml @@ -1,4 +1,4 @@ -# Default values for danswer-stack. +# Default values for onyx-stack. # This is a YAML-formatted file. # Declare variables to be passed into your templates. @@ -23,10 +23,18 @@ inferenceCapability: - key: app value: inference-model-server image: - repository: danswer/danswer-model-server + repository: onyxdotapp/onyx-model-server tag: latest pullPolicy: IfNotPresent - command: ["uvicorn", "model_server.main:app", "--host", "0.0.0.0", "--port", "9000"] + command: + [ + "uvicorn", + "model_server.main:app", + "--host", + "0.0.0.0", + "--port", + "9000", + ] port: 9000 volumeMounts: - name: inference-model-storage @@ -82,9 +90,9 @@ postgresql: size: 5Gi enabled: true auth: - existingSecret: danswer-secrets + existingSecret: onyx-secrets secretKeys: - adminPasswordKey: postgres_password # overwriting as postgres typically expects 'postgres-password' + adminPasswordKey: postgres_password # overwriting as postgres typically expects 'postgres-password' nginx: containerPorts: @@ -95,17 +103,17 @@ nginx: service: ports: http: 80 - danswer: 3000 + onyx: 3000 targetPort: http: http - danswer: http + onyx: http - existingServerBlockConfigmap: danswer-nginx-conf + existingServerBlockConfigmap: onyx-nginx-conf webserver: replicaCount: 1 image: - repository: danswer/danswer-web-server + repository: onyxdotapp/onyx-web-server pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "" @@ -114,10 +122,12 @@ webserver: podAnnotations: {} podLabels: app: web-server - podSecurityContext: {} + podSecurityContext: + {} # fsGroup: 2000 - securityContext: {} + securityContext: + {} # capabilities: # drop: # - ALL @@ -168,7 +178,7 @@ webserver: api: replicaCount: 1 image: - repository: danswer/danswer-backend + repository: onyxdotapp/onyx-backend pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "" @@ -176,13 +186,15 @@ api: app: api-server podAnnotations: {} podLabels: - scope: danswer-backend + scope: onyx-backend app: api-server - podSecurityContext: {} + podSecurityContext: + {} # fsGroup: 2000 - securityContext: {} + securityContext: + {} # capabilities: # drop: # - ALL @@ -229,24 +241,25 @@ api: nodeSelector: {} tolerations: [] - background: replicaCount: 1 image: - repository: danswer/danswer-backend + repository: onyxdotapp/onyx-backend pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: latest podAnnotations: {} podLabels: - scope: danswer-backend + scope: onyx-backend app: background deploymentLabels: app: background - podSecurityContext: {} + podSecurityContext: + {} # fsGroup: 2000 - securityContext: {} + securityContext: + {} # capabilities: # drop: # - ALL @@ -299,10 +312,11 @@ vespa: podAnnotations: {} podLabels: app: vespa - app.kubernetes.io/instance: danswer + app.kubernetes.io/instance: onyx app.kubernetes.io/name: vespa - podSecurityContext: {} + podSecurityContext: + {} # fsGroup: 2000 securityContext: @@ -310,8 +324,8 @@ vespa: runAsUser: 0 resources: - # The Vespa Helm chart specifies default resources, which are quite modest. We override - # them here to increase chances of the chart running successfully. + # The Vespa Helm chart specifies default resources, which are quite modest. We override + # them here to increase chances of the chart running successfully. requests: cpu: 1500m memory: 4000Mi @@ -323,7 +337,6 @@ vespa: tolerations: [] affinity: {} - redis: enabled: true architecture: standalone @@ -345,10 +358,9 @@ redis: type: ClusterIP port: 6379 auth: - existingSecret: danswer-secrets + existingSecret: onyx-secrets existingSecretPasswordKey: redis_password - # ingress: # enabled: false # className: "" @@ -377,7 +389,7 @@ persistence: auth: # for storing smtp, oauth, slack, and other secrets # keys are lowercased version of env vars (e.g. SMTP_USER -> smtp_user) - existingSecret: "" # danswer-secrets + existingSecret: "" # onyx-secrets # optionally override the secret keys to reference in the secret # this is used to populate the env vars in individual deployments # the values here reference the keys in secrets below @@ -389,7 +401,7 @@ auth: oauth_cookie_secret: "" redis_password: "redis_password" # will be overridden by the existingSecret if set - secretName: "danswer-secrets" + secretName: "onyx-secrets" # set values as strings, they will be base64 encoded # this is used to populate the secrets yaml secrets: @@ -401,14 +413,14 @@ auth: redis_password: "password" configMap: - AUTH_TYPE: "disabled" # Change this for production uses unless Danswer is only accessible behind VPN - SESSION_EXPIRE_TIME_SECONDS: "86400" # 1 Day Default - VALID_EMAIL_DOMAINS: "" # Can be something like danswer.ai, as an extra double-check - SMTP_SERVER: "" # For sending verification emails, if unspecified then defaults to 'smtp.gmail.com' - SMTP_PORT: "" # For sending verification emails, if unspecified then defaults to '587' - SMTP_USER: "" # 'your-email@company.com' + AUTH_TYPE: "disabled" # Change this for production uses unless Onyx is only accessible behind VPN + SESSION_EXPIRE_TIME_SECONDS: "86400" # 1 Day Default + VALID_EMAIL_DOMAINS: "" # Can be something like onyx.app, as an extra double-check + SMTP_SERVER: "" # For sending verification emails, if unspecified then defaults to 'smtp.gmail.com' + SMTP_PORT: "" # For sending verification emails, if unspecified then defaults to '587' + SMTP_USER: "" # 'your-email@company.com' # SMTP_PASS: "" # 'your-gmail-password' - EMAIL_FROM: "" # 'your-email@company.com' SMTP_USER missing used instead + EMAIL_FROM: "" # 'your-email@company.com' SMTP_USER missing used instead # Gen AI Settings GEN_AI_MAX_TOKENS: "" QA_TIMEOUT: "60" @@ -446,22 +458,22 @@ configMap: JIRA_API_VERSION: "" GONG_CONNECTOR_START_TIME: "" NOTION_CONNECTOR_ENABLE_RECURSIVE_PAGE_LOOKUP: "" - # DanswerBot SlackBot Configs + # OnyxBot SlackBot Configs DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER: "" DANSWER_BOT_DISPLAY_ERROR_MSGS: "" DANSWER_BOT_RESPOND_EVERY_CHANNEL: "" - DANSWER_BOT_DISABLE_COT: "" # Currently unused + DANSWER_BOT_DISABLE_COT: "" # Currently unused NOTIFY_SLACKBOT_NO_ANSWER: "" # Logging # Optional Telemetry, please keep it on (nothing sensitive is collected)? <3 - # https://docs.danswer.dev/more/telemetry + # https://docs.onyx.app/more/telemetry DISABLE_TELEMETRY: "" LOG_LEVEL: "" LOG_ALL_MODEL_INTERACTIONS: "" LOG_DANSWER_MODEL_INTERACTIONS: "" LOG_VESPA_TIMING_INFORMATION: "" # Shared or Non-backend Related - WEB_DOMAIN: "http://localhost:3000" # for web server and api server - DOMAIN: "localhost" # for nginx + WEB_DOMAIN: "http://localhost:3000" # for web server and api server + DOMAIN: "localhost" # for nginx # Chat Configs HARD_DELETE_CHATS: "" diff --git a/deployment/kubernetes/api_server-service-deployment.yaml b/deployment/kubernetes/api_server-service-deployment.yaml index 0e1cd79af58..a4eb27b364a 100644 --- a/deployment/kubernetes/api_server-service-deployment.yaml +++ b/deployment/kubernetes/api_server-service-deployment.yaml @@ -28,15 +28,15 @@ spec: spec: containers: - name: api-server - image: danswer/danswer-backend:latest + image: onyxdotapp/onyx-backend:latest imagePullPolicy: IfNotPresent command: - "/bin/sh" - "-c" - | alembic upgrade head && - echo "Starting Danswer Api Server" && - uvicorn danswer.main:app --host 0.0.0.0 --port 8080 + echo "Starting Onyx Api Server" && + uvicorn onyx.main:app --host 0.0.0.0 --port 8080 ports: - containerPort: 8080 # There are some extra values since this is shared between services @@ -45,17 +45,17 @@ spec: - name: OAUTH_CLIENT_ID valueFrom: secretKeyRef: - name: danswer-secrets + name: onyx-secrets key: google_oauth_client_id - name: OAUTH_CLIENT_SECRET valueFrom: secretKeyRef: - name: danswer-secrets + name: onyx-secrets key: google_oauth_client_secret - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: danswer-secrets + name: onyx-secrets key: redis_password envFrom: - configMapRef: diff --git a/deployment/kubernetes/background-deployment.yaml b/deployment/kubernetes/background-deployment.yaml index 25b6f4a7f81..f009a2da62b 100644 --- a/deployment/kubernetes/background-deployment.yaml +++ b/deployment/kubernetes/background-deployment.yaml @@ -14,7 +14,7 @@ spec: spec: containers: - name: background - image: danswer/danswer-backend:latest + image: onyxdotapp/onyx-backend:latest imagePullPolicy: IfNotPresent command: - "/bin/sh" @@ -28,7 +28,7 @@ spec: - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: danswer-secrets + name: onyx-secrets key: redis_password envFrom: - configMapRef: diff --git a/deployment/kubernetes/env-configmap.yaml b/deployment/kubernetes/env-configmap.yaml index 84bd6747973..0ce70ec29b2 100644 --- a/deployment/kubernetes/env-configmap.yaml +++ b/deployment/kubernetes/env-configmap.yaml @@ -2,18 +2,17 @@ apiVersion: v1 kind: ConfigMap metadata: name: env-configmap -data: - +data: # Auth Setting, also check the secrets file - AUTH_TYPE: "disabled" # Change this for production uses unless Danswer is only accessible behind VPN - ENCRYPTION_KEY_SECRET: "" # This should not be specified directly in the yaml, this is just for reference - SESSION_EXPIRE_TIME_SECONDS: "86400" # 1 Day Default - VALID_EMAIL_DOMAINS: "" # Can be something like danswer.ai, as an extra double-check + AUTH_TYPE: "disabled" # Change this for production uses unless Onyx is only accessible behind VPN + ENCRYPTION_KEY_SECRET: "" # This should not be specified directly in the yaml, this is just for reference + SESSION_EXPIRE_TIME_SECONDS: "86400" # 1 Day Default + VALID_EMAIL_DOMAINS: "" # Can be something like onyx.app, as an extra double-check SMTP_SERVER: "" # For sending verification emails, if unspecified then defaults to 'smtp.gmail.com' SMTP_PORT: "" # For sending verification emails, if unspecified then defaults to '587' - SMTP_USER: "" # 'your-email@company.com' - SMTP_PASS: "" # 'your-gmail-password' - EMAIL_FROM: "" # 'your-email@company.com' SMTP_USER missing used instead + SMTP_USER: "" # 'your-email@company.com' + SMTP_PASS: "" # 'your-gmail-password' + EMAIL_FROM: "" # 'your-email@company.com' SMTP_USER missing used instead CORS_ALLOWED_ORIGIN: "" # Gen AI Settings GEN_AI_MAX_TOKENS: "" @@ -63,23 +62,23 @@ data: NOTION_CONNECTOR_ENABLE_RECURSIVE_PAGE_LOOKUP: "" MAX_DOCUMENT_CHARS: "" MAX_FILE_SIZE_BYTES: "" - # DanswerBot SlackBot Configs + # OnyxBot SlackBot Configs DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER: "" DANSWER_BOT_DISPLAY_ERROR_MSGS: "" DANSWER_BOT_RESPOND_EVERY_CHANNEL: "" - DANSWER_BOT_DISABLE_COT: "" # Currently unused + DANSWER_BOT_DISABLE_COT: "" # Currently unused NOTIFY_SLACKBOT_NO_ANSWER: "" # Logging # Optional Telemetry, please keep it on (nothing sensitive is collected)? <3 - # https://docs.danswer.dev/more/telemetry + # https://docs.onyx.app/more/telemetry DISABLE_TELEMETRY: "" LOG_LEVEL: "" LOG_ALL_MODEL_INTERACTIONS: "" LOG_DANSWER_MODEL_INTERACTIONS: "" LOG_VESPA_TIMING_INFORMATION: "" # Shared or Non-backend Related - INTERNAL_URL: "http://api-server-service:80" # for web server - WEB_DOMAIN: "http://localhost:3000" # for web server and api server - DOMAIN: "localhost" # for nginx + INTERNAL_URL: "http://api-server-service:80" # for web server + WEB_DOMAIN: "http://localhost:3000" # for web server and api server + DOMAIN: "localhost" # for nginx # Chat Configs HARD_DELETE_CHATS: "" diff --git a/deployment/kubernetes/indexing_model_server-service-deployment.yaml b/deployment/kubernetes/indexing_model_server-service-deployment.yaml index 4092633d2f7..12d1e93768d 100644 --- a/deployment/kubernetes/indexing_model_server-service-deployment.yaml +++ b/deployment/kubernetes/indexing_model_server-service-deployment.yaml @@ -27,15 +27,23 @@ spec: app: indexing-model-server spec: containers: - - name: indexing-model-server - image: danswer/danswer-model-server:latest - imagePullPolicy: IfNotPresent - command: [ "uvicorn", "model_server.main:app", "--host", "0.0.0.0", "--port", "9000" ] - ports: - - containerPort: 9000 - envFrom: - - configMapRef: - name: env-configmap - env: - - name: INDEXING_ONLY - value: "True" + - name: indexing-model-server + image: onyxdotapp/onyx-model-server:latest + imagePullPolicy: IfNotPresent + command: + [ + "uvicorn", + "model_server.main:app", + "--host", + "0.0.0.0", + "--port", + "9000", + ] + ports: + - containerPort: 9000 + envFrom: + - configMapRef: + name: env-configmap + env: + - name: INDEXING_ONLY + value: "True" diff --git a/deployment/kubernetes/inference_model_server-service-deployment.yaml b/deployment/kubernetes/inference_model_server-service-deployment.yaml index c75731c6086..35c71e24217 100644 --- a/deployment/kubernetes/inference_model_server-service-deployment.yaml +++ b/deployment/kubernetes/inference_model_server-service-deployment.yaml @@ -27,12 +27,20 @@ spec: app: inference-model-server spec: containers: - - name: inference-model-server - image: danswer/danswer-model-server:latest - imagePullPolicy: IfNotPresent - command: [ "uvicorn", "model_server.main:app", "--host", "0.0.0.0", "--port", "9000" ] - ports: - - containerPort: 9000 - envFrom: - - configMapRef: - name: env-configmap + - name: inference-model-server + image: onyxdotapp/onyx-model-server:latest + imagePullPolicy: IfNotPresent + command: + [ + "uvicorn", + "model_server.main:app", + "--host", + "0.0.0.0", + "--port", + "9000", + ] + ports: + - containerPort: 9000 + envFrom: + - configMapRef: + name: env-configmap diff --git a/deployment/kubernetes/nginx-service-deployment.yaml b/deployment/kubernetes/nginx-service-deployment.yaml index 27b14794ee3..e4d888f6530 100644 --- a/deployment/kubernetes/nginx-service-deployment.yaml +++ b/deployment/kubernetes/nginx-service-deployment.yaml @@ -10,7 +10,7 @@ spec: protocol: TCP port: 80 targetPort: 80 - - name: danswer + - name: onyx protocol: TCP port: 3000 targetPort: 80 @@ -31,25 +31,25 @@ spec: app: nginx spec: containers: - - name: nginx - image: nginx:1.23.4-alpine - ports: - - containerPort: 80 - env: - - name: DOMAIN - valueFrom: - configMapKeyRef: - name: env-configmap - key: DOMAIN - volumeMounts: - - name: nginx-conf - mountPath: /etc/nginx/conf.d - command: - - /bin/sh - - -c - - | - while :; do sleep 6h & wait $$!; nginx -s reload; done & nginx -g "daemon off;" + - name: nginx + image: nginx:1.23.4-alpine + ports: + - containerPort: 80 + env: + - name: DOMAIN + valueFrom: + configMapKeyRef: + name: env-configmap + key: DOMAIN + volumeMounts: + - name: nginx-conf + mountPath: /etc/nginx/conf.d + command: + - /bin/sh + - -c + - | + while :; do sleep 6h & wait $$!; nginx -s reload; done & nginx -g "daemon off;" volumes: - - name: nginx-conf - configMap: - name: nginx-configmap + - name: nginx-conf + configMap: + name: nginx-configmap diff --git a/deployment/kubernetes/postgres-service-deployment.yaml b/deployment/kubernetes/postgres-service-deployment.yaml index e89e625589d..eeaaf71e812 100644 --- a/deployment/kubernetes/postgres-service-deployment.yaml +++ b/deployment/kubernetes/postgres-service-deployment.yaml @@ -27,32 +27,32 @@ spec: app: relational-db spec: containers: - - name: relational-db - image: postgres:15.2-alpine - env: - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: danswer-secrets - key: postgres_user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: danswer-secrets - key: postgres_password - args: ["-c", "max_connections=250"] - ports: - - containerPort: 5432 - volumeMounts: - - mountPath: /var/lib/postgresql/data - name: db-storage - subPath: postgres + - name: relational-db + image: postgres:15.2-alpine + env: + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: onyx-secrets + key: postgres_user + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: onyx-secrets + key: postgres_password + args: ["-c", "max_connections=250"] + ports: + - containerPort: 5432 + volumeMounts: + - mountPath: /var/lib/postgresql/data + name: db-storage + subPath: postgres volumeClaimTemplates: - - metadata: - name: db-storage - spec: - accessModes: ["ReadWriteOnce"] - resources: - requests: - # Adjust the storage request size as needed. - storage: 10Gi + - metadata: + name: db-storage + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + # Adjust the storage request size as needed. + storage: 10Gi diff --git a/deployment/kubernetes/redis-service-deployment.yaml b/deployment/kubernetes/redis-service-deployment.yaml index 2744c27157b..08dcd6a4a39 100644 --- a/deployment/kubernetes/redis-service-deployment.yaml +++ b/deployment/kubernetes/redis-service-deployment.yaml @@ -27,22 +27,25 @@ spec: app: redis spec: containers: - - name: redis - image: redis:7.4-alpine - ports: - - containerPort: 6379 - env: - - name: REDIS_PASSWORD - valueFrom: - secretKeyRef: - name: danswer-secrets - key: redis_password - command: ["redis-server"] - args: - # save and appendonly are not strictly necessary because kubernetes doesn't mount - # /data silently like docker, but add the save and appendonly for consistency - [ - "--requirepass", "$(REDIS_PASSWORD)", - "--save", "", - "--appendonly", "no" - ] + - name: redis + image: redis:7.4-alpine + ports: + - containerPort: 6379 + env: + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: onyx-secrets + key: redis_password + command: ["redis-server"] + args: + # save and appendonly are not strictly necessary because kubernetes doesn't mount + # /data silently like docker, but add the save and appendonly for consistency + [ + "--requirepass", + "$(REDIS_PASSWORD)", + "--save", + "", + "--appendonly", + "no", + ] diff --git a/deployment/kubernetes/slackbot-service-deployment.yaml b/deployment/kubernetes/slackbot-service-deployment.yaml index 2986525c28d..bb7348fe6de 100644 --- a/deployment/kubernetes/slackbot-service-deployment.yaml +++ b/deployment/kubernetes/slackbot-service-deployment.yaml @@ -16,9 +16,9 @@ spec: spec: containers: - name: slack-bot - image: danswer/danswer-backend:latest + image: onyxdotapp/onyx-backend:latest imagePullPolicy: IfNotPresent - command: ["python", "danswer/danswerbot/slack/listener.py"] + command: ["python", "onyxdotapp/onyxbot/slack/listener.py"] ports: - containerPort: 8000 resources: diff --git a/deployment/kubernetes/web_server-service-deployment.yaml b/deployment/kubernetes/web_server-service-deployment.yaml index b54c1b7f3d0..b37535b4a01 100644 --- a/deployment/kubernetes/web_server-service-deployment.yaml +++ b/deployment/kubernetes/web_server-service-deployment.yaml @@ -26,19 +26,19 @@ spec: app: web-server spec: containers: - - name: web-server - image: danswer/danswer-web-server:latest - imagePullPolicy: IfNotPresent - ports: - - containerPort: 3000 - # There are some extra values since this is shared between services - # There are no conflicts though, extra env variables are simply ignored - env: - - name: REDIS_PASSWORD - valueFrom: - secretKeyRef: - name: danswer-secrets - key: redis_password - envFrom: - - configMapRef: - name: env-configmap + - name: web-server + image: onyxdotapp/onyx-web-server:latest + imagePullPolicy: IfNotPresent + ports: + - containerPort: 3000 + # There are some extra values since this is shared between services + # There are no conflicts though, extra env variables are simply ignored + env: + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: onyx-secrets + key: redis_password + envFrom: + - configMapRef: + name: env-configmap diff --git a/examples/assistants-api/topics_analyzer.py b/examples/assistants-api/topics_analyzer.py index d99c384363a..0f96ea651bf 100644 --- a/examples/assistants-api/topics_analyzer.py +++ b/examples/assistants-api/topics_analyzer.py @@ -52,14 +52,14 @@ def analyze_topics(topics: list[str]) -> None: openai_api_key = os.environ.get( "OPENAI_API_KEY", "" ) - danswer_api_key = os.environ.get( - "DANSWER_API_KEY", "" + onyx_api_key = os.environ.get( + "DANSWER_API_KEY", "" ) client = OpenAI( api_key=openai_api_key, base_url="http://localhost:8080/openai-assistants", default_headers={ - "Authorization": f"Bearer {danswer_api_key}", + "Authorization": f"Bearer {onyx_api_key}", }, ) diff --git a/examples/widget/.env.example b/examples/widget/.env.example index b92284bf274..1d6173fdbd9 100644 --- a/examples/widget/.env.example +++ b/examples/widget/.env.example @@ -1,2 +1,2 @@ -NEXT_PUBLIC_API_URL=https://example.danswer.ai +NEXT_PUBLIC_API_URL=https://example.onyx.app NEXT_PUBLIC_API_KEY=some_long_api_key_here \ No newline at end of file diff --git a/examples/widget/README.md b/examples/widget/README.md index cb32ecd073a..e475bf4459d 100644 --- a/examples/widget/README.md +++ b/examples/widget/README.md @@ -1,7 +1,8 @@ -# Danswer Chat Bot Widget -Note: The widget requires a Danswer API key, which is a paid (cloud/enterprise) feature. +# Onyx Chat Bot Widget -This is a code example for how you can use Danswer's APIs to build a chat bot widget for a website! The main code to look at can be found in `src/app/widget/Widget.tsx`. +Note: The widget requires a Onyx API key, which is a paid (cloud/enterprise) feature. + +This is a code example for how you can use Onyx's APIs to build a chat bot widget for a website! The main code to look at can be found in `src/app/widget/Widget.tsx`. ## Getting Started @@ -10,11 +11,11 @@ To get the widget working on your webpage, follow these steps: ### 1. Install Dependencies Ensure you have the necessary dependencies installed. From the `examples/widget/README.md` file: + ```bash npm i ``` - ### 2. Set Environment Variables Make sure to set the environment variables `NEXT_PUBLIC_API_URL` and `NEXT_PUBLIC_API_KEY` in a `.env` file at the root of your project: @@ -39,19 +40,18 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the To integrate the widget into your webpage, you can use the `ChatWidget` component. Here’s an example of how to include it in a page component: ```jsx -import ChatWidget from 'path/to/ChatWidget'; +import ChatWidget from "path/to/ChatWidget"; function MyPage() { -return ( -
-

My Webpage

- -
-); + return ( +
+

My Webpage

+ +
+ ); } export default MyPage; ``` - ### 5. Deploy Once you are satisfied with the widget, you can build and start the application for production: @@ -67,4 +67,4 @@ If you need to customize the widget, you can modify the `ChatWidget` component i By following these steps, you should be able to get the chat widget working on your webpage. -If you want to get fancier, then take a peek at the Chat implementation within Danswer itself [here](https://github.com/danswer-ai/danswer/blob/main/web/src/app/chat/ChatPage.tsx#L82). \ No newline at end of file +If you want to get fancier, then take a peek at the Chat implementation within Onyx itself [here](https://github.com/onyx-dot-app/onyx/blob/main/web/src/app/chat/ChatPage.tsx#L82). diff --git a/examples/widget/src/app/layout.tsx b/examples/widget/src/app/layout.tsx index 2cabefe9681..2fcec90111b 100644 --- a/examples/widget/src/app/layout.tsx +++ b/examples/widget/src/app/layout.tsx @@ -6,8 +6,8 @@ import "./globals.css"; const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { - title: "Example Danswer Widget", - description: "Example Danswer Widget", + title: "Example Onyx Widget", + description: "Example Onyx Widget", }; export default function RootLayout({ diff --git a/examples/widget/src/app/widget/Widget.tsx b/examples/widget/src/app/widget/Widget.tsx index 3104ee0c8e0..491f6976d30 100644 --- a/examples/widget/src/app/widget/Widget.tsx +++ b/examples/widget/src/app/widget/Widget.tsx @@ -133,7 +133,7 @@ async function* sendMessage({ prompt_id: null, search_doc_ids: null, file_descriptors: [], - // checkout https://github.com/danswer-ai/danswer/blob/main/backend/danswer/search/models.py#L105 for + // checkout https://github.com/onyx-dot-app/onyx/blob/main/backend/onyx/search/models.py#L105 for // all available options retrieval_options: { run_search: "always", diff --git a/iii.ipynb b/iii.ipynb new file mode 100644 index 00000000000..a7d022c8410 --- /dev/null +++ b/iii.ipynb @@ -0,0 +1,132 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "ename": "", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[1;31mThe kernel failed to start as the Python Environment 'Python 3.11.10' is no longer available. Consider selecting another kernel or refreshing the list of Python Environments." + ] + } + ], + "source": [ + "import os\n", + "import shutil\n", + "\n", + "import os\n", + "import shutil\n", + "\n", + "def rename_files(directory):\n", + " for root, dirs, files in os.walk(directory, topdown=True):\n", + " # Skip .git directory\n", + " if '.git' in dirs:\n", + " dirs.remove('.git')\n", + " \n", + " # Rename files\n", + " for filename in files:\n", + " if not filename.startswith('.'): # Avoid dotfiles\n", + " new_filename = filename.replace(\"danswer\", \"onyx\").replace(\"Danswer\", \"Onyx\")\n", + " if new_filename != filename:\n", + " old_path = os.path.join(root, filename)\n", + " new_path = os.path.join(root, new_filename)\n", + " os.rename(old_path, new_path)\n", + " print(f\"Renamed file: {old_path} -> {new_path}\")\n", + " \n", + " # Rename directories\n", + " for dir_name in dirs:\n", + " if not dir_name.startswith('.'): # Avoid dotfiles\n", + " new_dir_name = dir_name.replace(\"danswer\", \"onyx\").replace(\"Danswer\", \"Onyx\")\n", + " if new_dir_name != dir_name:\n", + " old_dir_path = os.path.join(root, dir_name)\n", + " new_dir_path = os.path.join(root, new_dir_name)\n", + " try:\n", + " os.rename(old_dir_path, new_dir_path)\n", + " print(f\"Renamed directory: {old_dir_path} -> {new_dir_path}\")\n", + " except OSError as e:\n", + " if e.errno == 66: # Directory not empty\n", + " # Move all contents to the new directory\n", + " if not os.path.exists(new_dir_path):\n", + " os.makedirs(new_dir_path)\n", + " for item in os.listdir(old_dir_path):\n", + " s = os.path.join(old_dir_path, item)\n", + " d = os.path.join(new_dir_path, item)\n", + " if os.path.isdir(s):\n", + " shutil.copytree(s, d, dirs_exist_ok=True)\n", + " else:\n", + " shutil.copy2(s, d)\n", + " shutil.rmtree(old_dir_path)\n", + " print(f\"Moved contents and renamed directory: {old_dir_path} -> {new_dir_path}\")\n", + " else:\n", + " raise\n", + "\n", + "def process_directory(directory):\n", + " rename_files(directory)\n", + " print(\"File and directory renaming complete.\")\n", + "\n", + "# Specify the directory path here\n", + "directory_path = \"./\"\n", + "\n", + "# Confirm before proceeding\n", + "# confirm = input(f\"This will rename files and directories in {os.path.abspath(directory_path)}. Are you sure? (y/n): \")\n", + "# if confirm.lower() != 'y':\n", + "# print(\"Operation cancelled.\")\n", + "# else:\n", + "# process_directory(directory_path)\n", + "# print(\"File and directory renaming complete.\")\n", + "\n", + "def process_directory(directory):\n", + " rename_files(directory)\n", + " print(\"File and directory renaming complete.\")\n", + "\n", + "# # Specify the directory path here\n", + "# directory_path = \"./\"\n", + "\n", + "# process_directory(directory_path)\n", + "# print(\"File and directory renaming complete.\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "ename": "", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[1;31mThe kernel failed to start as the Python Environment 'Python 3.11.10' is no longer available. Consider selecting another kernel or refreshing the list of Python Environments." + ] + } + ], + "source": [ + "process_directory(directory_path)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python", + "version": "3.11.10" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/remove.ipynb b/remove.ipynb new file mode 100644 index 00000000000..e69de29bb2d diff --git a/web/Dockerfile b/web/Dockerfile index 8b91615f359..f6cb717d906 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,11 +1,11 @@ FROM node:20-alpine AS base -LABEL com.danswer.maintainer="founders@danswer.ai" -LABEL com.danswer.description="This image is the web/frontend container of Danswer which \ -contains code for both the Community and Enterprise editions of Danswer. If you do not \ +LABEL com.onyx.maintainer="founders@onyx.app" +LABEL com.onyx.description="This image is the web/frontend container of Onyx which \ +contains code for both the Community and Enterprise editions of Onyx. If you do not \ have a contract or agreement with DanswerAI, you are not permitted to use the Enterprise \ Edition features outside of personal development or testing purposes. Please reach out to \ -founders@danswer.ai for more information. Please visit https://github.com/danswer-ai/danswer" +founders@onyx.app for more information. Please visit https://github.com/onyx-dot-app/onyx" # Default DANSWER_VERSION, typically overriden during builds by GitHub Actions. ARG DANSWER_VERSION=0.8-dev diff --git a/web/README.md b/web/README.md index 05e94698626..38af9cd582e 100644 --- a/web/README.md +++ b/web/README.md @@ -1,4 +1,4 @@ - + This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). diff --git a/web/next.config.js b/web/next.config.js index a44bd7924ca..8110841cfab 100644 --- a/web/next.config.js +++ b/web/next.config.js @@ -1,4 +1,4 @@ -// Get Danswer Web Version +// Get Onyx Web Version const { version: package_version } = require("./package.json"); // version from package.json const env_version = process.env.DANSWER_VERSION; // version from env variable // Use env version if set & valid, otherwise default to package version @@ -71,7 +71,7 @@ const sentryEnabled = Boolean( // Sentry webpack plugin options const sentryWebpackPluginOptions = { - org: process.env.SENTRY_ORG || "danswer", + org: process.env.SENTRY_ORG || "onyx", project: process.env.SENTRY_PROJECT || "data-plane-web", authToken: process.env.SENTRY_AUTH_TOKEN, silent: !sentryEnabled, // Silence output when Sentry is disabled diff --git a/web/public/danswer.ico b/web/public/danswer.ico deleted file mode 100644 index 77ba78f4802..00000000000 Binary files a/web/public/danswer.ico and /dev/null differ diff --git a/web/public/logo.png b/web/public/logo.png index e9a7cf5868a..0a5aecd7c82 100644 Binary files a/web/public/logo.png and b/web/public/logo.png differ diff --git a/web/public/logotype.png b/web/public/logotype.png new file mode 100644 index 00000000000..509e2c714bf Binary files /dev/null and b/web/public/logotype.png differ diff --git a/web/public/onyx.ico b/web/public/onyx.ico new file mode 100644 index 00000000000..1a0541cfa80 Binary files /dev/null and b/web/public/onyx.ico differ diff --git a/web/src/app/admin/api-key/DanswerApiKeyForm.tsx b/web/src/app/admin/api-key/OnyxApiKeyForm.tsx similarity index 97% rename from web/src/app/admin/api-key/DanswerApiKeyForm.tsx rename to web/src/app/admin/api-key/OnyxApiKeyForm.tsx index 27d6457d141..d973ea4ec05 100644 --- a/web/src/app/admin/api-key/DanswerApiKeyForm.tsx +++ b/web/src/app/admin/api-key/OnyxApiKeyForm.tsx @@ -13,19 +13,19 @@ import Text from "@/components/ui/text"; import { USER_ROLE_LABELS, UserRole } from "@/lib/types"; import { APIKey } from "./types"; -interface DanswerApiKeyFormProps { +interface OnyxApiKeyFormProps { onClose: () => void; setPopup: (popupSpec: PopupSpec | null) => void; onCreateApiKey: (apiKey: APIKey) => void; apiKey?: APIKey; } -export const DanswerApiKeyForm = ({ +export const OnyxApiKeyForm = ({ onClose, setPopup, onCreateApiKey, apiKey, -}: DanswerApiKeyFormProps) => { +}: OnyxApiKeyFormProps) => { const isUpdate = apiKey !== undefined; return ( diff --git a/web/src/app/admin/api-key/page.tsx b/web/src/app/admin/api-key/page.tsx index 988aa3f60f9..165476581f9 100644 --- a/web/src/app/admin/api-key/page.tsx +++ b/web/src/app/admin/api-key/page.tsx @@ -26,10 +26,10 @@ import { FiCopy, FiEdit2, FiRefreshCw, FiX } from "react-icons/fi"; import { Modal } from "@/components/Modal"; import { Spinner } from "@/components/Spinner"; import { deleteApiKey, regenerateApiKey } from "./lib"; -import { DanswerApiKeyForm } from "./DanswerApiKeyForm"; +import { OnyxApiKeyForm } from "./OnyxApiKeyForm"; import { APIKey } from "./types"; -const API_KEY_TEXT = `API Keys allow you to access Danswer APIs programmatically. Click the button below to generate a new API Key.`; +const API_KEY_TEXT = `API Keys allow you to access Onyx APIs programmatically. Click the button below to generate a new API Key.`; function NewApiKeyModal({ apiKey, @@ -129,7 +129,7 @@ function Main() { {newApiKeyButton} {showCreateUpdateForm && ( - { setFullApiKey(apiKey.api_key); }} @@ -257,7 +257,7 @@ function Main() { {showCreateUpdateForm && ( - { setFullApiKey(apiKey.api_key); }} diff --git a/web/src/app/admin/assistants/AssistantEditor.tsx b/web/src/app/admin/assistants/AssistantEditor.tsx index 38b81f6b11e..bee83a19a0a 100644 --- a/web/src/app/admin/assistants/AssistantEditor.tsx +++ b/web/src/app/admin/assistants/AssistantEditor.tsx @@ -885,8 +885,8 @@ export function AssistantEditor({ {user?.role !== "admin" && ( <> If this functionality would be useful, - reach out to the administrators of - Danswer for assistance. + reach out to the administrators of Onyx + for assistance. )}

@@ -1185,7 +1185,7 @@ export function AssistantEditor({ setFieldValue("task_prompt", e.target.value); }} explanationText="Learn about prompting in our docs!" - explanationLink="https://docs.danswer.dev/guides/assistants" + explanationLink="https://docs.onyx.app/guides/assistants" /> )} diff --git a/web/src/app/admin/bots/SlackTokensForm.tsx b/web/src/app/admin/bots/SlackTokensForm.tsx index 62ce5f8240e..eb5a18d2da8 100644 --- a/web/src/app/admin/bots/SlackTokensForm.tsx +++ b/web/src/app/admin/bots/SlackTokensForm.tsx @@ -93,7 +93,7 @@ export const SlackTokensForm = ({ Please refer to our{" "} diff --git a/web/src/app/admin/bots/[bot-id]/SlackChannelConfigsTable.tsx b/web/src/app/admin/bots/[bot-id]/SlackChannelConfigsTable.tsx index 1f99b7ca214..7cee96af903 100644 --- a/web/src/app/admin/bots/[bot-id]/SlackChannelConfigsTable.tsx +++ b/web/src/app/admin/bots/[bot-id]/SlackChannelConfigsTable.tsx @@ -139,7 +139,7 @@ export function SlackChannelConfigsTable({ className="text-center text-muted-foreground" > Please add a New Slack Bot Configuration to begin chatting - with Danswer! + with Onyx! )} diff --git a/web/src/app/admin/bots/[bot-id]/channels/SlackChannelConfigCreationForm.tsx b/web/src/app/admin/bots/[bot-id]/channels/SlackChannelConfigCreationForm.tsx index 6e22c7b5ea1..d3aa8486302 100644 --- a/web/src/app/admin/bots/[bot-id]/channels/SlackChannelConfigCreationForm.tsx +++ b/web/src/app/admin/bots/[bot-id]/channels/SlackChannelConfigCreationForm.tsx @@ -170,8 +170,8 @@ export const SlackChannelConfigCreationForm = ({ const errorMsg = responseJson.detail || responseJson.message; setPopup({ message: isUpdate - ? `Error updating DanswerBot config - ${errorMsg}` - : `Error creating DanswerBot config - ${errorMsg}`, + ? `Error updating OnyxBot config - ${errorMsg}` + : `Error creating OnyxBot config - ${errorMsg}`, type: "error", }); } @@ -188,7 +188,7 @@ export const SlackChannelConfigCreationForm = ({
- Controls which information DanswerBot will pull from when + Controls which information OnyxBot will pull from when answering questions. @@ -209,7 +209,7 @@ export const SlackChannelConfigCreationForm = ({ - Select the assistant DanswerBot will use while answering + Select the assistant OnyxBot will use while answering questions in Slack. - Select the document sets DanswerBot will use while + Select the document sets OnyxBot will use while answering questions in Slack. - Note: If No Document Sets are selected, DanswerBot will + Note: If No Document Sets are selected, OnyxBot will search through all connected documents.
{values.still_need_help_enabled && ( @@ -337,14 +337,14 @@ export const SlackChannelConfigCreationForm = ({ } - title="Configure DanswerBot for Slack Channel" + title="Configure OnyxBot for Slack Channel" /> { {/* {popup} */}

- Setup Slack bots that connect to Danswer. Once setup, you will be able - to ask questions to Danswer directly from Slack. Additionally, you can: + Setup Slack bots that connect to Onyx. Once setup, you will be able to + ask questions to Onyx directly from Slack. Additionally, you can:

  • - Setup DanswerBot to automatically answer questions in certain - channels. + Setup OnyxBot to automatically answer questions in certain channels.
  • - Choose which document sets DanswerBot should answer from, depending - on the channel the question is being asked. + Choose which document sets OnyxBot should answer from, depending on + the channel the question is being asked.
  • - Directly message DanswerBot to search just as you would in the web - UI. + Directly message OnyxBot to search just as you would in the web UI.
@@ -64,13 +62,13 @@ const Main = () => { Follow the{" "}
guide{" "} - found in the Danswer documentation to get started! + found in the Onyx documentation to get started!

Unstructured extracts and transforms complex data from formats like - .pdf, .docx, .png, .pptx, etc. into clean text for Danswer to - ingest. Provide an API key to enable Unstructured document - processing. + .pdf, .docx, .png, .pptx, etc. into clean text for Onyx to ingest. + Provide an API key to enable Unstructured document processing.

Note: this will send documents to Unstructured servers for processing. diff --git a/web/src/app/admin/configuration/llm/LLMConfiguration.tsx b/web/src/app/admin/configuration/llm/LLMConfiguration.tsx index a4161e63a21..b1a82c7892a 100644 --- a/web/src/app/admin/configuration/llm/LLMConfiguration.tsx +++ b/web/src/app/admin/configuration/llm/LLMConfiguration.tsx @@ -158,7 +158,7 @@ export function LLMConfiguration() { ) : ( - Please set one up below in order to start using Danswer! + Please set one up below in order to start using Onyx! )} diff --git a/web/src/app/admin/connectors/[connector]/Sidebar.tsx b/web/src/app/admin/connectors/[connector]/Sidebar.tsx index e227159ed9d..f8ca7753b7c 100644 --- a/web/src/app/admin/connectors/[connector]/Sidebar.tsx +++ b/web/src/app/admin/connectors/[connector]/Sidebar.tsx @@ -85,7 +85,7 @@ export default function Sidebar() { {enterpriseSettings && enterpriseSettings.application_name ? ( {enterpriseSettings.application_name} ) : ( - Danswer + Onyx )}

diff --git a/web/src/app/admin/connectors/[connector]/pages/gdrive/Credential.tsx b/web/src/app/admin/connectors/[connector]/pages/gdrive/Credential.tsx index f3781219645..c2bd0a253a2 100644 --- a/web/src/app/admin/connectors/[connector]/pages/gdrive/Credential.tsx +++ b/web/src/app/admin/connectors/[connector]/pages/gdrive/Credential.tsx @@ -285,7 +285,7 @@ export const DriveJsonUploadSection = ({ here diff --git a/web/src/app/admin/connectors/[connector]/pages/gdrive/GoogleDrivePage.tsx b/web/src/app/admin/connectors/[connector]/pages/gdrive/GoogleDrivePage.tsx index 3c52903b565..c92c401c3cd 100644 --- a/web/src/app/admin/connectors/[connector]/pages/gdrive/GoogleDrivePage.tsx +++ b/web/src/app/admin/connectors/[connector]/pages/gdrive/GoogleDrivePage.tsx @@ -194,7 +194,7 @@ const GDriveMain = ({}: {}) => { {isAdmin && ( <> - Step 2: Authenticate with Danswer + Step 2: Authenticate with Onyx here diff --git a/web/src/app/admin/connectors/[connector]/pages/gmail/GmailPage.tsx b/web/src/app/admin/connectors/[connector]/pages/gmail/GmailPage.tsx index 9db5892ebb0..ec98bfcdbd5 100644 --- a/web/src/app/admin/connectors/[connector]/pages/gmail/GmailPage.tsx +++ b/web/src/app/admin/connectors/[connector]/pages/gmail/GmailPage.tsx @@ -140,7 +140,7 @@ export const GmailMain = () => { {isAdmin && ( <> - Step 2: Authenticate with Danswer + Step 2: Authenticate with Onyx void; setPopup: (popupSpec: PopupSpec | null) => void; }) => { @@ -117,7 +117,7 @@ export function Explorer({ const [query, setQuery] = useState(initialSearchValue || ""); const [timeoutId, setTimeoutId] = useState(null); - const [results, setResults] = useState([]); + const [results, setResults] = useState([]); const filterManager = useFilters(); diff --git a/web/src/app/admin/documents/sets/page.tsx b/web/src/app/admin/documents/sets/page.tsx index af4ba8532a4..d2192929f09 100644 --- a/web/src/app/admin/documents/sets/page.tsx +++ b/web/src/app/admin/documents/sets/page.tsx @@ -314,7 +314,7 @@ const Main = () => { Document Sets allow you to group logically connected documents into a single bundle. These can then be used as a filter when performing - searches to control the scope of information Danswer searches over. + searches to control the scope of information Onyx searches over.
diff --git a/web/src/app/admin/embeddings/modals/ModelSelectionModal.tsx b/web/src/app/admin/embeddings/modals/ModelSelectionModal.tsx index ca341a9b308..a8c59afddea 100644 --- a/web/src/app/admin/embeddings/modals/ModelSelectionModal.tsx +++ b/web/src/app/admin/embeddings/modals/ModelSelectionModal.tsx @@ -29,14 +29,14 @@ export function ModelSelectionConfirmationModal({ We will re-index all your documents in the background so you will be - able to continue to use Danswer as normal with the old model in the + able to continue to use Onyx as normal with the old model in the meantime. Depending on how many documents you have indexed, this may take a while. NOTE: this re-indexing process will consume more resources than normal. If you are self-hosting, we recommend that you allocate - at least 16GB of RAM to Danswer during this process. + at least 16GB of RAM to Onyx during this process. {isCustom && ( diff --git a/web/src/app/admin/embeddings/pages/OpenEmbeddingPage.tsx b/web/src/app/admin/embeddings/pages/OpenEmbeddingPage.tsx index 54317605541..e84781f377e 100644 --- a/web/src/app/admin/embeddings/pages/OpenEmbeddingPage.tsx +++ b/web/src/app/admin/embeddings/pages/OpenEmbeddingPage.tsx @@ -57,9 +57,9 @@ export default function OpenEmbeddingPage({
.
- NOTE: not all models listed will work with Danswer, since some - have unique interfaces or special requirements. If in doubt, reach out - to the Danswer team. + NOTE: not all models listed will work with Onyx, since some have + unique interfaces or special requirements. If in doubt, reach out to the + Onyx team. {!configureModel && (

- We couldn't find your account in our records. To access Danswer, - you need to either: + We couldn't find your account in our records. To access Onyx, you + need to either:

- Note: This feature is only available for @danswer.ai administrators + Note: This feature is only available for @onyx.app administrators
diff --git a/web/src/app/auth/login/LoginText.tsx b/web/src/app/auth/login/LoginText.tsx index 7b5eb97fb8e..2aa733456f2 100644 --- a/web/src/app/auth/login/LoginText.tsx +++ b/web/src/app/auth/login/LoginText.tsx @@ -8,8 +8,7 @@ export const LoginText = () => { return ( <> Log In to{" "} - {(settings && settings?.enterpriseSettings?.application_name) || - "Danswer"} + {(settings && settings?.enterpriseSettings?.application_name) || "Onyx"} ); }; diff --git a/web/src/app/auth/signup/page.tsx b/web/src/app/auth/signup/page.tsx index 94a7d1967bb..3e25e36c4c8 100644 --- a/web/src/app/auth/signup/page.tsx +++ b/web/src/app/auth/signup/page.tsx @@ -69,7 +69,7 @@ const Page = async (props: {

- {cloud ? "Complete your sign up" : "Sign Up for Danswer"} + {cloud ? "Complete your sign up" : "Sign Up for Onyx"}

{cloud && ( <> diff --git a/web/src/app/chat/ChatPage.tsx b/web/src/app/chat/ChatPage.tsx index 22337a90d43..3dde26a8bc2 100644 --- a/web/src/app/chat/ChatPage.tsx +++ b/web/src/app/chat/ChatPage.tsx @@ -60,7 +60,7 @@ import { LlmOverride, useFilters, useLlmOverride } from "@/lib/hooks"; import { computeAvailableFilters } from "@/lib/filters"; import { ChatState, FeedbackType, RegenerationState } from "./types"; import { ChatFilters } from "./documentSidebar/ChatFilters"; -import { DanswerInitializingLoader } from "@/components/DanswerInitializingLoader"; +import { OnyxInitializingLoader } from "@/components/OnyxInitializingLoader"; import { FeedbackModal } from "./modal/FeedbackModal"; import { ShareChatSessionModal } from "./modal/ShareChatSessionModal"; import { FiArrowDown } from "react-icons/fi"; @@ -69,7 +69,7 @@ import { AIMessage, HumanMessage } from "./message/Messages"; import { StarterMessages } from "../../components/assistants/StarterMessage"; import { AnswerPiecePacket, - DanswerDocument, + OnyxDocument, DocumentInfoPacket, StreamStopInfo, StreamStopReason, @@ -281,7 +281,7 @@ export function ChatPage({ useState(null); const [presentingDocument, setPresentingDocument] = - useState(null); + useState(null); const { visibleAssistants: assistants, @@ -361,7 +361,7 @@ export function ChatPage({ // this is used to track which assistant is being used to generate the current message // for example, this would come into play when: - // 1. default assistant is `Danswer` + // 1. default assistant is `Onyx` // 2. we "@"ed the `GPT` assistant and sent a message // 3. while the `GPT` assistant message is generating, we "@" the `Paraphrase` assistant const [alternativeGeneratingAssistant, setAlternativeGeneratingAssistant] = @@ -1189,7 +1189,7 @@ export function ChatPage({ selectedDocuments.length > 0 ? RetrievalType.SelectedDocs : RetrievalType.None; - let documents: DanswerDocument[] = selectedDocuments; + let documents: OnyxDocument[] = selectedDocuments; let aiMessageImages: FileDescriptor[] | null = null; let error: string | null = null; let stackTrace: string | null = null; @@ -2834,7 +2834,7 @@ export function ChatPage({ }`} />
- +
)} diff --git a/web/src/app/chat/ChatPopup.tsx b/web/src/app/chat/ChatPopup.tsx index 8fb6b1503bd..0a355590ff8 100644 --- a/web/src/app/chat/ChatPopup.tsx +++ b/web/src/app/chat/ChatPopup.tsx @@ -33,7 +33,7 @@ export function ChatPopup() { enterpriseSettings?.custom_popup_header || (isConsentScreen ? "Terms of Use" - : `Welcome to ${enterpriseSettings?.application_name || "Danswer"}!`); + : `Welcome to ${enterpriseSettings?.application_name || "Onyx"}!`); const popupContent = enterpriseSettings?.custom_popup_content || diff --git a/web/src/app/chat/documentSidebar/ChatDocumentDisplay.tsx b/web/src/app/chat/documentSidebar/ChatDocumentDisplay.tsx index 0c39f631422..2c9f1cc2e3b 100644 --- a/web/src/app/chat/documentSidebar/ChatDocumentDisplay.tsx +++ b/web/src/app/chat/documentSidebar/ChatDocumentDisplay.tsx @@ -1,5 +1,5 @@ import { SourceIcon } from "@/components/SourceIcon"; -import { DanswerDocument } from "@/lib/search/interfaces"; +import { OnyxDocument } from "@/lib/search/interfaces"; import { FiTag } from "react-icons/fi"; import { DocumentSelector } from "./DocumentSelector"; import { buildDocumentSummaryDisplay } from "@/components/search/DocumentDisplay"; @@ -11,12 +11,12 @@ import { ValidSources } from "@/lib/types"; interface DocumentDisplayProps { closeSidebar: () => void; - document: DanswerDocument; + document: OnyxDocument; modal?: boolean; isSelected: boolean; handleSelect: (documentId: string) => void; tokenLimitReached: boolean; - setPresentingDocument: Dispatch>; + setPresentingDocument: Dispatch>; } export function DocumentMetadataBlock({ @@ -24,7 +24,7 @@ export function DocumentMetadataBlock({ document, }: { modal?: boolean; - document: DanswerDocument; + document: OnyxDocument; }) { const MAX_METADATA_ITEMS = 3; const metadataEntries = Object.entries(document.metadata); diff --git a/web/src/app/chat/documentSidebar/ChatFilters.tsx b/web/src/app/chat/documentSidebar/ChatFilters.tsx index a5761e8108a..585a33c59a8 100644 --- a/web/src/app/chat/documentSidebar/ChatFilters.tsx +++ b/web/src/app/chat/documentSidebar/ChatFilters.tsx @@ -1,4 +1,4 @@ -import { DanswerDocument } from "@/lib/search/interfaces"; +import { OnyxDocument } from "@/lib/search/interfaces"; import { ChatDocumentDisplay } from "./ChatDocumentDisplay"; import { usePopup } from "@/components/admin/connectors/Popup"; import { removeDuplicateDocs } from "@/lib/documentUtils"; @@ -20,8 +20,8 @@ interface ChatFiltersProps { filterManager: FilterManager; closeSidebar: () => void; selectedMessage: Message | null; - selectedDocuments: DanswerDocument[] | null; - toggleDocumentSelection: (document: DanswerDocument) => void; + selectedDocuments: OnyxDocument[] | null; + toggleDocumentSelection: (document: OnyxDocument) => void; clearSelectedDocuments: () => void; selectedDocumentTokens: number; maxTokens: number; @@ -32,7 +32,7 @@ interface ChatFiltersProps { tags: Tag[]; documentSets: DocumentSet[]; showFilters: boolean; - setPresentingDocument: Dispatch>; + setPresentingDocument: Dispatch>; } export const ChatFilters = forwardRef( @@ -84,7 +84,7 @@ export const ChatFilters = forwardRef( return (
void; }) { return ( diff --git a/web/src/app/chat/input/ChatInputBar.tsx b/web/src/app/chat/input/ChatInputBar.tsx index 0909d054594..ed828ad9a5f 100644 --- a/web/src/app/chat/input/ChatInputBar.tsx +++ b/web/src/app/chat/input/ChatInputBar.tsx @@ -18,7 +18,7 @@ import { SendIcon, StopGeneratingIcon, } from "@/components/icons/icons"; -import { DanswerDocument, SourceMetadata } from "@/lib/search/interfaces"; +import { OnyxDocument, SourceMetadata } from "@/lib/search/interfaces"; import { AssistantIcon } from "@/components/assistants/AssistantIcon"; import { Tooltip, @@ -49,7 +49,7 @@ interface ChatInputBarProps { openModelSettings: () => void; showDocs: () => void; showConfigureAPIKey: () => void; - selectedDocuments: DanswerDocument[]; + selectedDocuments: OnyxDocument[]; message: string; setMessage: (message: string) => void; stopGenerating: () => void; @@ -234,7 +234,7 @@ export function ChatInputBar({ }; return ( -
+
{ const matchingDocument = message.documents!.find( (document) => document.db_doc_id === documentDbId diff --git a/web/src/app/chat/message/MemoizedTextComponents.tsx b/web/src/app/chat/message/MemoizedTextComponents.tsx index efdce4ca86b..876a5e26835 100644 --- a/web/src/app/chat/message/MemoizedTextComponents.tsx +++ b/web/src/app/chat/message/MemoizedTextComponents.tsx @@ -1,6 +1,6 @@ import { Citation } from "@/components/search/results/Citation"; import { WebResultIcon } from "@/components/WebResultIcon"; -import { LoadedDanswerDocument } from "@/lib/search/interfaces"; +import { LoadedOnyxDocument } from "@/lib/search/interfaces"; import { getSourceMetadata, SOURCE_METADATA_MAP } from "@/lib/sources"; import { ValidSources } from "@/lib/types"; import React, { memo } from "react"; @@ -57,7 +57,7 @@ export const MemoizedLink = memo((props: any) => { url={document?.url} icon={document?.icon as React.ReactNode} link={rest?.href} - document={document as LoadedDanswerDocument} + document={document as LoadedOnyxDocument} updatePresentingDocument={updatePresentingDocument} > {rest.children} diff --git a/web/src/app/chat/message/Messages.tsx b/web/src/app/chat/message/Messages.tsx index 75e583cfc59..fe28a07b5bf 100644 --- a/web/src/app/chat/message/Messages.tsx +++ b/web/src/app/chat/message/Messages.tsx @@ -20,9 +20,9 @@ import React, { } from "react"; import ReactMarkdown from "react-markdown"; import { - DanswerDocument, - FilteredDanswerDocument, - LoadedDanswerDocument, + OnyxDocument, + FilteredOnyxDocument, + LoadedOnyxDocument, } from "@/lib/search/interfaces"; import { SearchSummary } from "./SearchSummary"; @@ -98,7 +98,7 @@ function FileDisplay({ <> {nonImgFiles && nonImgFiles.length > 0 && (
@@ -119,7 +119,7 @@ function FileDisplay({ {imageFiles && imageFiles.length > 0 && (
@@ -200,9 +200,9 @@ export const AIMessage = ({ continueGenerating?: () => void; otherMessagesCanSwitchTo?: number[]; onMessageSelection?: (messageId: number) => void; - selectedDocuments?: DanswerDocument[] | null; + selectedDocuments?: OnyxDocument[] | null; toggleDocumentSelection?: () => void; - docs?: DanswerDocument[] | null; + docs?: OnyxDocument[] | null; alternativeAssistant?: Persona | null; currentPersona: Persona; messageId: number | null; @@ -210,7 +210,7 @@ export const AIMessage = ({ documentSelectionToggled?: boolean; files?: FileDescriptor[]; query?: string; - citedDocuments?: [string, DanswerDocument][] | null; + citedDocuments?: [string, OnyxDocument][] | null; toolCall?: ToolCallMetadata | null; isComplete?: boolean; hasDocs?: boolean; @@ -221,7 +221,7 @@ export const AIMessage = ({ retrievalDisabled?: boolean; overriddenModel?: string; regenerate?: (modelOverRide: LlmOverride) => Promise; - setPresentingDocument?: (document: DanswerDocument) => void; + setPresentingDocument?: (document: OnyxDocument) => void; }) => { const toolCallGenerating = toolCall && !toolCall.tool_result; const processContent = (content: string | JSX.Element) => { @@ -284,7 +284,7 @@ export const AIMessage = ({ content = trimIncompleteCodeSection(content); } - let filteredDocs: FilteredDanswerDocument[] = []; + let filteredDocs: FilteredOnyxDocument[] = []; if (docs) { filteredDocs = docs @@ -297,7 +297,7 @@ export const AIMessage = ({ .filter((doc) => { return citedDocumentIds.includes(doc.document_id); }) - .map((doc: DanswerDocument, ind: number) => { + .map((doc: OnyxDocument, ind: number) => { return { ...doc, included: selectedDocumentIds.includes(doc.document_id), @@ -371,7 +371,7 @@ export const AIMessage = ({ otherMessagesCanSwitchTo.length > 1; return (
@@ -762,7 +762,7 @@ export const HumanMessage = ({ return (
setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} diff --git a/web/src/app/chat/modifiers/SelectedDocuments.tsx b/web/src/app/chat/modifiers/SelectedDocuments.tsx index fbae7029ce4..046633bbbaa 100644 --- a/web/src/app/chat/modifiers/SelectedDocuments.tsx +++ b/web/src/app/chat/modifiers/SelectedDocuments.tsx @@ -1,11 +1,11 @@ import { BasicClickable } from "@/components/BasicClickable"; -import { DanswerDocument } from "@/lib/search/interfaces"; +import { OnyxDocument } from "@/lib/search/interfaces"; import { FiBook } from "react-icons/fi"; export function SelectedDocuments({ selectedDocuments, }: { - selectedDocuments: DanswerDocument[]; + selectedDocuments: OnyxDocument[]; }) { if (selectedDocuments.length === 0) { return null; diff --git a/web/src/app/chat/shared/[chatId]/SharedChatDisplay.tsx b/web/src/app/chat/shared/[chatId]/SharedChatDisplay.tsx index 7f302904c64..13ef287a620 100644 --- a/web/src/app/chat/shared/[chatId]/SharedChatDisplay.tsx +++ b/web/src/app/chat/shared/[chatId]/SharedChatDisplay.tsx @@ -14,13 +14,13 @@ import { Separator } from "@/components/ui/separator"; import { useRouter } from "next/navigation"; import { useContext, useEffect, useState } from "react"; import { SettingsContext } from "@/components/settings/SettingsProvider"; -import { DanswerInitializingLoader } from "@/components/DanswerInitializingLoader"; +import { OnyxInitializingLoader } from "@/components/OnyxInitializingLoader"; import { Persona } from "@/app/admin/assistants/interfaces"; import { Button } from "@/components/ui/button"; -import { DanswerDocument } from "@/lib/search/interfaces"; +import { OnyxDocument } from "@/lib/search/interfaces"; import TextView from "@/components/chat_search/TextView"; -function BackToDanswerButton() { +function BackToOnyxButton() { const router = useRouter(); const enterpriseSettings = useContext(SettingsContext)?.enterpriseSettings; @@ -28,7 +28,7 @@ function BackToDanswerButton() {
@@ -44,7 +44,7 @@ export function SharedChatDisplay({ }) { const [isReady, setIsReady] = useState(false); const [presentingDocument, setPresentingDocument] = - useState(null); + useState(null); useEffect(() => { Prism.highlightAll(); @@ -58,7 +58,7 @@ export function SharedChatDisplay({ Did not find a shared chat with the specified ID.
- +
); } @@ -122,7 +122,7 @@ export function SharedChatDisplay({ ) : (
- +
)} @@ -130,7 +130,7 @@ export function SharedChatDisplay({
- +
); diff --git a/web/src/app/chat/shared_chat_search/FixedLogo.tsx b/web/src/app/chat/shared_chat_search/FixedLogo.tsx index d05917b25b2..894a08177e1 100644 --- a/web/src/app/chat/shared_chat_search/FixedLogo.tsx +++ b/web/src/app/chat/shared_chat_search/FixedLogo.tsx @@ -35,12 +35,12 @@ export default function FixedLogo({ {enterpriseSettings.application_name} {!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && ( -

Powered by Danswer

+

Powered by Onyx

)}
) : ( - Danswer + Onyx )}
diff --git a/web/src/app/chat/useDocumentSelection.ts b/web/src/app/chat/useDocumentSelection.ts index df33f13c3f6..10da5543d12 100644 --- a/web/src/app/chat/useDocumentSelection.ts +++ b/web/src/app/chat/useDocumentSelection.ts @@ -1,4 +1,4 @@ -import { DanswerDocument } from "@/lib/search/interfaces"; +import { OnyxDocument } from "@/lib/search/interfaces"; import { useState } from "react"; interface DocumentInfo { @@ -18,12 +18,12 @@ async function fetchDocumentLength(documentId: string) { } export function useDocumentSelection(): [ - DanswerDocument[], - (document: DanswerDocument) => void, + OnyxDocument[], + (document: OnyxDocument) => void, () => void, number, ] { - const [selectedDocuments, setSelectedDocuments] = useState( + const [selectedDocuments, setSelectedDocuments] = useState( [] ); const [totalTokens, setTotalTokens] = useState(0); @@ -32,7 +32,7 @@ export function useDocumentSelection(): [ ); const documentIdToLength = new Map(); - function toggleDocumentSelection(document: DanswerDocument) { + function toggleDocumentSelection(document: OnyxDocument) { const documentId = document.document_id; const isAdding = !selectedDocumentIds.includes(documentId); if (!isAdding) { diff --git a/web/src/app/ee/LICENSE b/web/src/app/ee/LICENSE index 1f2d7c15faa..034eb0995f0 100644 --- a/web/src/app/ee/LICENSE +++ b/web/src/app/ee/LICENSE @@ -1,20 +1,20 @@ The DanswerAI Enterprise license (the “Enterprise License”) Copyright (c) 2023-present DanswerAI, Inc. -With regard to the Danswer Software: +With regard to the Onyx Software: This software and associated documentation files (the "Software") may only be used in production, if you (and any entity that you represent) have agreed to, and are in compliance with, the DanswerAI Subscription Terms of Service, available -at https://danswer.ai/terms (the “Enterprise Terms”), or other +at https://onyx.app/terms (the “Enterprise Terms”), or other agreement governing the use of the Software, as agreed by you and DanswerAI, -and otherwise have a valid Danswer Enterprise license for the +and otherwise have a valid Onyx Enterprise license for the correct number of user seats. Subject to the foregoing sentence, you are free to modify this Software and publish patches to the Software. You agree that DanswerAI and/or its licensors (as applicable) retain all right, title and interest in and to all such modifications and/or patches, and all such modifications and/or patches may only be used, copied, modified, displayed, distributed, or otherwise -exploited with a valid Danswer Enterprise license for the correct +exploited with a valid Onyx Enterprise license for the correct number of user seats. Notwithstanding the foregoing, you may copy and modify the Software for development and testing purposes, without requiring a subscription. You agree that DanswerAI and/or its licensors (as applicable) retain @@ -31,6 +31,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -For all third party components incorporated into the Danswer Software, those +For all third party components incorporated into the Onyx Software, those components are licensed under the original license provided by the owner of the applicable component. diff --git a/web/src/app/ee/admin/performance/custom-analytics/CustomAnalyticsUpdateForm.tsx b/web/src/app/ee/admin/performance/custom-analytics/CustomAnalyticsUpdateForm.tsx index debd1504462..49bade86917 100644 --- a/web/src/app/ee/admin/performance/custom-analytics/CustomAnalyticsUpdateForm.tsx +++ b/web/src/app/ee/admin/performance/custom-analytics/CustomAnalyticsUpdateForm.tsx @@ -91,7 +91,7 @@ export function CustomAnalyticsUpdateForm() { For security reasons, you must provide a secret key to update this script. This should be the value of the{" "} CUSTOM_ANALYTICS_SECRET_KEY environment variable set when - initially setting up Danswer. + initially setting up Onyx. To set up custom analytics scripts, please work with the team who - setup Danswer in your organization to set the{" "} + setup Onyx in your organization to set the{" "} CUSTOM_ANALYTICS_SECRET_KEY environment variable.
@@ -23,9 +23,9 @@ function Main() { return (
- This allows you to bring your own analytics tool to Danswer! Copy the - Web snippet from your analytics provider into the box below, and - we'll start sending usage events. + This allows you to bring your own analytics tool to Onyx! Copy the Web + snippet from your analytics provider into the box below, and we'll + start sending usage events. diff --git a/web/src/app/ee/admin/performance/lib.ts b/web/src/app/ee/admin/performance/lib.ts index 59042a38766..f85181b84c7 100644 --- a/web/src/app/ee/admin/performance/lib.ts +++ b/web/src/app/ee/admin/performance/lib.ts @@ -2,7 +2,7 @@ import { errorHandlingFetcher } from "@/lib/fetcher"; import useSWR, { mutate } from "swr"; import { ChatSessionMinimal, - DanswerBotAnalytics, + OnyxBotAnalytics, QueryAnalytics, UserAnalytics, } from "./usage/types"; @@ -52,16 +52,16 @@ export const useUserAnalytics = (timeRange: DateRangePickerValue) => { }; }; -export const useDanswerBotAnalytics = (timeRange: DateRangePickerValue) => { - const url = buildApiPath("/api/analytics/admin/danswerbot", { +export const useOnyxBotAnalytics = (timeRange: DateRangePickerValue) => { + const url = buildApiPath("/api/analytics/admin/onyxbot", { start: convertDateToStartOfDay(timeRange.from)?.toISOString(), end: convertDateToEndOfDay(timeRange.to)?.toISOString(), }); - const swrResponse = useSWR(url, errorHandlingFetcher); // TODO + const swrResponse = useSWR(url, errorHandlingFetcher); // TODO return { ...swrResponse, - refreshDanswerBotAnalytics: () => mutate(url), + refreshOnyxBotAnalytics: () => mutate(url), }; }; diff --git a/web/src/app/ee/admin/performance/usage/DanswerBotChart.tsx b/web/src/app/ee/admin/performance/usage/OnyxBotChart.tsx similarity index 61% rename from web/src/app/ee/admin/performance/usage/DanswerBotChart.tsx rename to web/src/app/ee/admin/performance/usage/OnyxBotChart.tsx index 2d0ff26cb9c..9b512352571 100644 --- a/web/src/app/ee/admin/performance/usage/DanswerBotChart.tsx +++ b/web/src/app/ee/admin/performance/usage/OnyxBotChart.tsx @@ -1,30 +1,30 @@ import { ThreeDotsLoader } from "@/components/Loading"; -import { getDatesList, useDanswerBotAnalytics } from "../lib"; +import { getDatesList, useOnyxBotAnalytics } from "../lib"; import { DateRangePickerValue } from "@/app/ee/admin/performance/DateRangeSelector"; import Text from "@/components/ui/text"; import Title from "@/components/ui/title"; import CardSection from "@/components/admin/CardSection"; import { AreaChartDisplay } from "@/components/ui/areaChart"; -export function DanswerBotChart({ +export function OnyxBotChart({ timeRange, }: { timeRange: DateRangePickerValue; }) { const { - data: danswerBotAnalyticsData, - isLoading: isDanswerBotAnalyticsLoading, - error: danswerBotAnalyticsError, - } = useDanswerBotAnalytics(timeRange); + data: onyxBotAnalyticsData, + isLoading: isOnyxBotAnalyticsLoading, + error: onyxBotAnalyticsError, + } = useOnyxBotAnalytics(timeRange); let chart; - if (isDanswerBotAnalyticsLoading) { + if (isOnyxBotAnalyticsLoading) { chart = (
); - } else if (!danswerBotAnalyticsData || danswerBotAnalyticsError) { + } else if (!onyxBotAnalyticsData || onyxBotAnalyticsError) { chart = (

Failed to fetch feedback data...

@@ -32,13 +32,13 @@ export function DanswerBotChart({ ); } else { const initialDate = - timeRange.from || new Date(danswerBotAnalyticsData[0].date); + timeRange.from || new Date(onyxBotAnalyticsData[0].date); const dateRange = getDatesList(initialDate); - const dateToDanswerBotAnalytics = new Map( - danswerBotAnalyticsData.map((danswerBotAnalyticsEntry) => [ - danswerBotAnalyticsEntry.date, - danswerBotAnalyticsEntry, + const dateToOnyxBotAnalytics = new Map( + onyxBotAnalyticsData.map((onyxBotAnalyticsEntry) => [ + onyxBotAnalyticsEntry.date, + onyxBotAnalyticsEntry, ]) ); @@ -46,13 +46,12 @@ export function DanswerBotChart({ { - const danswerBotAnalyticsForDate = - dateToDanswerBotAnalytics.get(dateStr); + const onyxBotAnalyticsForDate = dateToOnyxBotAnalytics.get(dateStr); return { Day: dateStr, - "Total Queries": danswerBotAnalyticsForDate?.total_queries || 0, + "Total Queries": onyxBotAnalyticsForDate?.total_queries || 0, "Automatically Resolved": - danswerBotAnalyticsForDate?.auto_resolved || 0, + onyxBotAnalyticsForDate?.auto_resolved || 0, }; })} categories={["Total Queries", "Automatically Resolved"]} diff --git a/web/src/app/ee/admin/performance/usage/page.tsx b/web/src/app/ee/admin/performance/usage/page.tsx index 967f16a377e..013ee555728 100644 --- a/web/src/app/ee/admin/performance/usage/page.tsx +++ b/web/src/app/ee/admin/performance/usage/page.tsx @@ -1,7 +1,7 @@ "use client"; import { DateRangeSelector } from "../DateRangeSelector"; -import { DanswerBotChart } from "./DanswerBotChart"; +import { OnyxBotChart } from "./OnyxBotChart"; import { FeedbackChart } from "./FeedbackChart"; import { QueryPerformanceChart } from "./QueryPerformanceChart"; import { PersonaMessagesChart } from "./PersonaMessagesChart"; @@ -26,7 +26,7 @@ export default function AnalyticsPage() { /> - + diff --git a/web/src/app/ee/admin/performance/usage/types.ts b/web/src/app/ee/admin/performance/usage/types.ts index 163dc54f878..d5d9cd7c399 100644 --- a/web/src/app/ee/admin/performance/usage/types.ts +++ b/web/src/app/ee/admin/performance/usage/types.ts @@ -12,7 +12,7 @@ export interface UserAnalytics { date: string; } -export interface DanswerBotAnalytics { +export interface OnyxBotAnalytics { total_queries: number; auto_resolved: number; date: string; diff --git a/web/src/app/ee/admin/whitelabeling/WhitelabelingForm.tsx b/web/src/app/ee/admin/whitelabeling/WhitelabelingForm.tsx index cd977d44c1c..300cd37155d 100644 --- a/web/src/app/ee/admin/whitelabeling/WhitelabelingForm.tsx +++ b/web/src/app/ee/admin/whitelabeling/WhitelabelingForm.tsx @@ -137,8 +137,8 @@ export function WhitelabelingForm() { @@ -178,7 +178,7 @@ export function WhitelabelingForm() {
) : ( - Specify your own logo to replace the standard Danswer logo. + Specify your own logo to replace the standard Onyx logo. )} @@ -199,7 +199,7 @@ export function WhitelabelingForm() { Read{" "} the docs @@ -234,7 +234,7 @@ export function WhitelabelingForm() { values.enable_consent_screen ? `The title for the consent screen that will be displayed for each user on their initial visit to the application. If left blank, title will default to "Terms of Use".` : `The title for the popup that will be displayed for each user on their initial visit to the application. If left blank AND Custom Popup Content is specified, will use "Welcome to ${ - values.application_name || "Danswer" + values.application_name || "Onyx" }!".` } placeholder={ diff --git a/web/src/app/layout.tsx b/web/src/app/layout.tsx index eb8d4e4d7ea..e3997cee8ee 100644 --- a/web/src/app/layout.tsx +++ b/web/src/app/layout.tsx @@ -31,18 +31,18 @@ const inter = Inter({ }); export async function generateMetadata(): Promise { - let logoLocation = buildClientUrl("/danswer.ico"); + let logoLocation = buildClientUrl("/onyx.ico"); let enterpriseSettings: EnterpriseSettings | null = null; if (SERVER_SIDE_ONLY__PAID_ENTERPRISE_FEATURES_ENABLED) { enterpriseSettings = await (await fetchEnterpriseSettingsSS()).json(); logoLocation = enterpriseSettings && enterpriseSettings.use_custom_logo ? "/api/enterprise-settings/logo" - : buildClientUrl("/danswer.ico"); + : buildClientUrl("/onyx.ico"); } return { - title: enterpriseSettings?.application_name ?? "Danswer", + title: enterpriseSettings?.application_name ?? "Onyx", description: "Question answering for your documents", icons: { icon: logoLocation, @@ -115,14 +115,14 @@ export default async function RootLayout({ return getPageContent(
- Danswer + Onyx

Error

- Your Danswer instance was not configured properly and your settings + Your Onyx instance was not configured properly and your settings could not be loaded. This could be due to an admin configuration issue or an incomplete setup.

@@ -130,21 +130,21 @@ export default async function RootLayout({ If you're an admin, please check{" "} our docs {" "} - to see how to configure Danswer properly. If you're a user, - please contact your admin to fix this error. + to see how to configure Onyx properly. If you're a user, please + contact your admin to fix this error.

For additional support and guidance, you can reach out to our community on{" "} @@ -160,7 +160,7 @@ export default async function RootLayout({ return getPageContent(

); } + +export default function LogoType() { + return ( + Logo + ); +} diff --git a/web/src/components/LogoType.tsx b/web/src/components/LogoType.tsx new file mode 100644 index 00000000000..b789686dd2e --- /dev/null +++ b/web/src/components/LogoType.tsx @@ -0,0 +1,38 @@ +import { NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED } from "@/lib/constants"; +import { HeaderTitle } from "./header/HeaderTitle"; +import LogoType, { Logo } from "./Logo"; +import { EnterpriseSettings } from "@/app/admin/settings/interfaces"; + +export default function LogoTypeContainer({ + enterpriseSettings, +}: { + enterpriseSettings: EnterpriseSettings | null; +}) { + const onlyLogo = + !enterpriseSettings || + !enterpriseSettings.use_custom_logo || + !enterpriseSettings.application_name; + + return ( +
+
+ {onlyLogo ? : } +
+ + {!onlyLogo && ( +
+ {enterpriseSettings && enterpriseSettings.application_name ? ( +
+ {enterpriseSettings.application_name} + {!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && ( +

Powered by Onyx

+ )} +
+ ) : ( + Onyx + )} +
+ )} +
+ ); +} diff --git a/web/src/components/DanswerInitializingLoader.tsx b/web/src/components/OnyxInitializingLoader.tsx similarity index 72% rename from web/src/components/DanswerInitializingLoader.tsx rename to web/src/components/OnyxInitializingLoader.tsx index f548126f0a6..18fc024f6c6 100644 --- a/web/src/components/DanswerInitializingLoader.tsx +++ b/web/src/components/OnyxInitializingLoader.tsx @@ -2,15 +2,14 @@ import { Logo } from "./Logo"; import { useContext } from "react"; import { SettingsContext } from "./settings/SettingsProvider"; -export function DanswerInitializingLoader() { +export function OnyxInitializingLoader() { const settings = useContext(SettingsContext); return (

- Initializing{" "} - {settings?.enterpriseSettings?.application_name ?? "Danswer"} + Initializing {settings?.enterpriseSettings?.application_name ?? "Onyx"}

); diff --git a/web/src/components/SwitchModelModal.tsx b/web/src/components/SwitchModelModal.tsx index 1008a0ad79b..9c356003b74 100644 --- a/web/src/components/SwitchModelModal.tsx +++ b/web/src/components/SwitchModelModal.tsx @@ -25,7 +25,7 @@ export function SwitchModelModal({
Please click the button below to choose a new model. Don't worry, the re-indexing necessary for the switch will happen in the background - - your use of Danswer will not be interrupted. + - your use of Onyx will not be interrupted.
diff --git a/web/src/components/WebResultIcon.tsx b/web/src/components/WebResultIcon.tsx index 09475f2a22d..3bc382f366d 100644 --- a/web/src/components/WebResultIcon.tsx +++ b/web/src/components/WebResultIcon.tsx @@ -3,7 +3,7 @@ import { SourceIcon } from "./SourceIcon"; export function WebResultIcon({ url }: { url: string }) { const hostname = new URL(url).hostname; - return hostname == "https://docs.danswer.dev" ? ( + return hostname == "https://docs.onyx.app" ? ( {!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && ( -

Powered by Danswer

+

Powered by Onyx

)}
) : ( - Danswer + Onyx )}
@@ -104,10 +104,10 @@ export function AdminSidebar({ collections }: { collections: Collection[] }) { {combinedSettings.webVersion && (

- Danswer version: {combinedSettings.webVersion} + Onyx version: {combinedSettings.webVersion}

)} diff --git a/web/src/components/chat_search/TextView.tsx b/web/src/components/chat_search/TextView.tsx index d4aec38a4c8..cfed37c8884 100644 --- a/web/src/components/chat_search/TextView.tsx +++ b/web/src/components/chat_search/TextView.tsx @@ -9,11 +9,11 @@ import { DialogTitle, } from "@/components/ui/dialog"; import { Download, XIcon, ZoomIn, ZoomOut } from "lucide-react"; -import { DanswerDocument } from "@/lib/search/interfaces"; +import { OnyxDocument } from "@/lib/search/interfaces"; import { MinimalMarkdown } from "./MinimalMarkdown"; interface TextViewProps { - presentingDocument: DanswerDocument; + presentingDocument: OnyxDocument; onClose: () => void; } export default function TextView({ diff --git a/web/src/components/chat_search/sources/SourceCard.tsx b/web/src/components/chat_search/sources/SourceCard.tsx index 1c888228a83..bbd018578a9 100644 --- a/web/src/components/chat_search/sources/SourceCard.tsx +++ b/web/src/components/chat_search/sources/SourceCard.tsx @@ -1,6 +1,6 @@ import { WebResultIcon } from "@/components/WebResultIcon"; import { SourceIcon } from "@/components/SourceIcon"; -import { DanswerDocument } from "@/lib/search/interfaces"; +import { OnyxDocument } from "@/lib/search/interfaces"; import { truncateString } from "@/lib/utils"; import { SetStateAction } from "react"; import { Dispatch } from "react"; @@ -10,8 +10,8 @@ export default function SourceCard({ doc, setPresentingDocument, }: { - doc: DanswerDocument; - setPresentingDocument?: (document: DanswerDocument) => void; + doc: OnyxDocument; + setPresentingDocument?: (document: OnyxDocument) => void; }) { return (
void; - uniqueSources: DanswerDocument["source_type"][]; + uniqueSources: OnyxDocument["source_type"][]; } export function SeeMoreBlock({ diff --git a/web/src/components/embedding/EmbeddingSidebar.tsx b/web/src/components/embedding/EmbeddingSidebar.tsx index 27894c6001e..9e0b76c131f 100644 --- a/web/src/components/embedding/EmbeddingSidebar.tsx +++ b/web/src/components/embedding/EmbeddingSidebar.tsx @@ -41,7 +41,7 @@ export default function EmbeddingSidebar() { {enterpriseSettings && enterpriseSettings.application_name ? ( {enterpriseSettings.application_name} ) : ( - Danswer + Onyx )}
@@ -79,7 +79,9 @@ export default function EmbeddingSidebar() {
{step}
diff --git a/web/src/components/embedding/interfaces.tsx b/web/src/components/embedding/interfaces.tsx index 87a16959864..db4c64b3ef3 100644 --- a/web/src/components/embedding/interfaces.tsx +++ b/web/src/components/embedding/interfaces.tsx @@ -110,7 +110,7 @@ export const AVAILABLE_MODELS: HostedEmbeddingModel[] = [ model_dim: 384, normalize: true, description: - "The smallest and fastest version of the E5 line of models. If you're running Danswer on a resource constrained system, then this may be a good choice.", + "The smallest and fastest version of the E5 line of models. If you're running Onyx on a resource constrained system, then this may be a good choice.", link: "https://huggingface.co/intfloat/e5-small-v2", query_prefix: "query: ", passage_prefix: "passage: ", @@ -177,8 +177,7 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [ provider_type: EmbeddingProvider.COHERE, website: "https://cohere.ai", icon: CohereIcon, - docsLink: - "https://docs.danswer.dev/guides/embedding_providers#cohere-models", + docsLink: "https://docs.onyx.app/guides/embedding_providers#cohere-models", description: "AI company specializing in NLP models for various text-based tasks", apiLink: "https://dashboard.cohere.ai/api-keys", @@ -220,8 +219,7 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [ icon: OpenAIIcon, description: "AI industry leader known for ChatGPT and DALL-E", apiLink: "https://platform.openai.com/api-keys", - docsLink: - "https://docs.danswer.dev/guides/embedding_providers#openai-models", + docsLink: "https://docs.onyx.app/guides/embedding_providers#openai-models", costslink: "https://openai.com/pricing", embedding_models: [ { @@ -260,7 +258,7 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [ website: "https://ai.google", icon: GoogleIcon, docsLink: - "https://docs.danswer.dev/guides/embedding_providers#vertex-ai-google-model", + "https://docs.onyx.app/guides/embedding_providers#vertex-ai-google-model", description: "Offers a wide range of AI services including language and vision models", apiLink: "https://console.cloud.google.com/apis/credentials", @@ -299,8 +297,7 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [ website: "https://www.voyageai.com", icon: VoyageIcon, description: "Advanced NLP research startup born from Stanford AI Labs", - docsLink: - "https://docs.danswer.dev/guides/embedding_providers#voyage-models", + docsLink: "https://docs.onyx.app/guides/embedding_providers#voyage-models", apiLink: "https://www.voyageai.com/dashboard", costslink: "https://www.voyageai.com/pricing", embedding_models: [ diff --git a/web/src/components/header/AnnouncementBanner.tsx b/web/src/components/header/AnnouncementBanner.tsx index 1312e321bdb..a4a1b05dc78 100644 --- a/web/src/components/header/AnnouncementBanner.tsx +++ b/web/src/components/header/AnnouncementBanner.tsx @@ -80,7 +80,7 @@ export function AnnouncementBanner() { ) : notification.notif_type == "two_day_trial_ending" ? (

Your trial is ending soon - submit your billing information to - continue using Danswer.{" "} + continue using Onyx.{" "} {children} diff --git a/web/src/components/header/LogoType.tsx b/web/src/components/header/LogoType.tsx index b581f988260..47d044e649d 100644 --- a/web/src/components/header/LogoType.tsx +++ b/web/src/components/header/LogoType.tsx @@ -39,6 +39,9 @@ export default function LogoType({ }) { const combinedSettings = useContext(SettingsContext); const enterpriseSettings = combinedSettings?.enterpriseSettings; + const useLogoType = + !enterpriseSettings?.use_custom_logo && + !enterpriseSettings?.application_name; return (

{!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && ( -

Powered by Danswer

+

Powered by Onyx

)}
) : ( - Danswer + Onyx )} @@ -113,7 +116,6 @@ export default function LogoType({ )} - {showArrow && toggleSidebar && ( diff --git a/web/src/components/health/healthcheck.tsx b/web/src/components/health/healthcheck.tsx index d571572dc51..6bf9de378b4 100644 --- a/web/src/components/health/healthcheck.tsx +++ b/web/src/components/health/healthcheck.tsx @@ -157,7 +157,7 @@ export const HealthCheckBanner = () => {

The backend is currently unavailable.

- If this is your initial setup or you just updated your Danswer + If this is your initial setup or you just updated your Onyx deployment, this is likely because the backend is still starting up. Give it a minute or two, and then refresh the page. If that does not work, make sure the backend is setup and/or contact an administrator. diff --git a/web/src/components/health/refreshUtils.ts b/web/src/components/health/refreshUtils.ts index fea9c76b210..59480f2cc6c 100644 --- a/web/src/components/health/refreshUtils.ts +++ b/web/src/components/health/refreshUtils.ts @@ -34,7 +34,7 @@ export function mockedRefreshToken(): CustomRefreshTokenResponse { givenName: "Mock name", fullName: "Mock name", userId: "Mock User ID", - email: "email@danswer.ai", + email: "email@onyx.app", }, }; return data; diff --git a/web/src/components/initialSetup/welcome/WelcomeModal.tsx b/web/src/components/initialSetup/welcome/WelcomeModal.tsx index 5e8f3109404..40e07443aef 100644 --- a/web/src/components/initialSetup/welcome/WelcomeModal.tsx +++ b/web/src/components/initialSetup/welcome/WelcomeModal.tsx @@ -62,18 +62,18 @@ export function _WelcomeModal({ user }: { user: User | null }) { setWelcomeFlowComplete(); router.refresh(); }} - title={"Welcome to Danswer!"} + title={"Welcome to Onyx!"} width="w-full max-h-[900px] overflow-y-scroll max-w-3xl" >

- Danswer brings all your company's knowledge to your fingertips, + Onyx brings all your company's knowledge to your fingertips, ready to be accessed instantly. To get started, we need to set up an API key for the Language Model - (LLM) provider. This key allows Danswer to interact with the AI - model, enabling intelligent responses to your queries. + (LLM) provider. This key allows Onyx to interact with the AI model, + enabling intelligent responses to your queries.
diff --git a/web/src/components/search/DocumentDisplay.tsx b/web/src/components/search/DocumentDisplay.tsx index 17867e1edde..4caedde48b5 100644 --- a/web/src/components/search/DocumentDisplay.tsx +++ b/web/src/components/search/DocumentDisplay.tsx @@ -1,10 +1,10 @@ "use client"; import React from "react"; import { - DanswerDocument, + OnyxDocument, DocumentRelevance, - LoadedDanswerDocument, - SearchDanswerDocument, + LoadedOnyxDocument, + SearchOnyxDocument, } from "@/lib/search/interfaces"; import { DocumentFeedbackBlock } from "./DocumentFeedbackBlock"; import { useContext, useState } from "react"; @@ -127,7 +127,7 @@ export const buildDocumentSummaryDisplay = ( export function DocumentMetadataBlock({ document, }: { - document: DanswerDocument; + document: OnyxDocument; }) { // don't display super long tags, as they are ugly const MAXIMUM_TAG_LENGTH = 40; @@ -163,7 +163,7 @@ export function DocumentMetadataBlock({ } interface DocumentDisplayProps { - document: SearchDanswerDocument; + document: SearchOnyxDocument; messageId: number | null; documentRank: number; isSelected: boolean; @@ -191,7 +191,7 @@ export const DocumentDisplay = ({ document.relevance_explanation ?? additional_relevance?.content; const settings = useContext(SettingsContext); const [presentingDocument, setPresentingDocument] = - useState(null); + useState(null); const handleViewFile = async () => { setPresentingDocument(document); @@ -316,7 +316,7 @@ export const AgenticDocumentDisplay = ({ }: DocumentDisplayProps) => { const [isHovered, setIsHovered] = useState(false); const [presentingDocument, setPresentingDocument] = - useState(null); + useState(null); const [alternativeToggled, setAlternativeToggled] = useState(false); @@ -428,10 +428,10 @@ export function CompactDocumentCard({ url, updatePresentingDocument, }: { - document: LoadedDanswerDocument; + document: LoadedOnyxDocument; icon?: React.ReactNode; url?: string; - updatePresentingDocument: (documentIndex: LoadedDanswerDocument) => void; + updatePresentingDocument: (documentIndex: LoadedOnyxDocument) => void; }) { return (
void; - document: LoadedDanswerDocument; + updatePresentingDocument: (documentIndex: LoadedOnyxDocument) => void; + document: LoadedOnyxDocument; icon?: React.ReactNode; url?: string; }) { diff --git a/web/src/lib/connectors/connectors.tsx b/web/src/lib/connectors/connectors.tsx index d6a0dc2f592..f6c9b890b8c 100644 --- a/web/src/lib/connectors/connectors.tsx +++ b/web/src/lib/connectors/connectors.tsx @@ -135,8 +135,7 @@ export const connectorConfigs: Record< values: [ { type: "text", - query: - "Enter the website URL to scrape e.g. https://docs.danswer.dev/:", + query: "Enter the website URL to scrape e.g. https://docs.onyx.app/:", label: "Base URL", name: "base_url", optional: false, @@ -246,8 +245,8 @@ export const connectorConfigs: Record< label: "Include shared drives?", description: (currentCredential) => { return currentCredential?.credential_json?.google_tokens - ? "This will allow Danswer to index everything in the shared drives you have access to." - : "This will allow Danswer to index everything in your Organization's shared drives."; + ? "This will allow Onyx to index everything in the shared drives you have access to." + : "This will allow Onyx to index everything in your Organization's shared drives."; }, name: "include_shared_drives", default: false, @@ -261,8 +260,8 @@ export const connectorConfigs: Record< }, description: (currentCredential) => { return currentCredential?.credential_json?.google_tokens - ? "This will allow Danswer to index everything in your My Drive." - : "This will allow Danswer to index everything in everyone's My Drives."; + ? "This will allow Onyx to index everything in your My Drive." + : "This will allow Onyx to index everything in everyone's My Drives."; }, name: "include_my_drives", default: false, @@ -270,7 +269,7 @@ export const connectorConfigs: Record< { type: "checkbox", description: - "This will allow Danswer to index all files shared with you.", + "This will allow Onyx to index all files shared with you.", label: "Include All Files Shared With You?", name: "include_files_shared_with_me", visibleCondition: (values, currentCredential) => @@ -435,7 +434,7 @@ export const connectorConfigs: Record< }, jira: { description: "Configure Jira connector", - subtext: `Specify any link to a Jira page below and click "Index" to Index. Based on the provided link, we will index the ENTIRE PROJECT, not just the specified page. For example, entering https://danswer.atlassian.net/jira/software/projects/DAN/boards/1 and clicking the Index button will index the whole DAN Jira project.`, + subtext: `Specify any link to a Jira page below and click "Index" to Index. Based on the provided link, we will index the ENTIRE PROJECT, not just the specified page. For example, entering https://onyx.atlassian.net/jira/software/projects/DAN/boards/1 and clicking the Index button will index the whole DAN Jira project.`, values: [ { type: "text", @@ -465,7 +464,7 @@ export const connectorConfigs: Record< label: "Requested Objects", name: "requested_objects", optional: true, - description: `Specify the Salesforce object types you want us to index. If unsure, don't specify any objects and Danswer will default to indexing by 'Account'. + description: `Specify the Salesforce object types you want us to index. If unsure, don't specify any objects and Onyx will default to indexing by 'Account'. Hint: Use the singular form of the object name (e.g., 'Opportunity' instead of 'Opportunities').`, }, @@ -482,8 +481,8 @@ Hint: Use the singular form of the object name (e.g., 'Opportunity' instead of ' name: "sites", optional: true, description: `• If no sites are specified, all sites in your organization will be indexed (Sites.Read.All permission required). -• Specifying 'https://danswerai.sharepoint.com/sites/support' for example will only index documents within this site. -• Specifying 'https://danswerai.sharepoint.com/sites/support/subfolder' for example will only index documents within this folder. +• Specifying 'https://onyxai.sharepoint.com/sites/support' for example will only index documents within this site. +• Specifying 'https://onyxai.sharepoint.com/sites/support/subfolder' for example will only index documents within this folder. `, }, ], @@ -498,7 +497,7 @@ Hint: Use the singular form of the object name (e.g., 'Opportunity' instead of ' label: "Teams", name: "teams", optional: true, - description: `Specify 0 or more Teams to index. For example, specifying the Team 'Support' for the 'danswerai' Org will cause us to only index messages sent in channels belonging to the 'Support' Team. If no Teams are specified, all Teams in your organization will be indexed.`, + description: `Specify 0 or more Teams to index. For example, specifying the Team 'Support' for the 'onyxai' Org will cause us to only index messages sent in channels belonging to the 'Support' Team. If no Teams are specified, all Teams in your organization will be indexed.`, }, ], advanced_values: [], @@ -578,7 +577,7 @@ For example, specifying .*-support.* as a "channel" will cause the connector to label: "Base URL", name: "base_url", optional: false, - description: `Specify the base URL for your Slab team. This will look something like: https://danswer.slab.com/`, + description: `Specify the base URL for your Slab team. This will look something like: https://onyx.slab.com/`, }, ], advanced_values: [], diff --git a/web/src/lib/documentUtils.ts b/web/src/lib/documentUtils.ts index 32bd051d21f..2c07b4122f2 100644 --- a/web/src/lib/documentUtils.ts +++ b/web/src/lib/documentUtils.ts @@ -1,12 +1,12 @@ -import { DanswerDocument } from "./search/interfaces"; +import { OnyxDocument } from "./search/interfaces"; export function removeDuplicateDocs( - documents: DanswerDocument[], + documents: OnyxDocument[], agentic?: boolean, relevance?: any ) { const seen = new Set(); - const output: DanswerDocument[] = []; + const output: OnyxDocument[] = []; documents.forEach((document) => { if ( document.document_id && diff --git a/web/src/lib/search/interfaces.ts b/web/src/lib/search/interfaces.ts index 91f87b5d0fd..ad1f45513cb 100644 --- a/web/src/lib/search/interfaces.ts +++ b/web/src/lib/search/interfaces.ts @@ -45,7 +45,7 @@ export interface QuotesInfoPacket { quotes: Quote[]; } -export interface DanswerDocument { +export interface OnyxDocument { document_id: string; link: string; source_type: ValidSources; @@ -62,20 +62,20 @@ export interface DanswerDocument { is_internet: boolean; validationState?: null | "good" | "bad"; } -export interface LoadedDanswerDocument extends DanswerDocument { +export interface LoadedOnyxDocument extends OnyxDocument { icon: React.FC<{ size?: number; className?: string }>; } -export interface SearchDanswerDocument extends DanswerDocument { +export interface SearchOnyxDocument extends OnyxDocument { is_relevant: boolean; relevance_explanation: string; } -export interface FilteredDanswerDocument extends DanswerDocument { +export interface FilteredOnyxDocument extends OnyxDocument { included: boolean; } export interface DocumentInfoPacket { - top_documents: DanswerDocument[]; + top_documents: OnyxDocument[]; predicted_flow: FlowType | null; predicted_search: SearchType | null; time_cutoff: string | null; @@ -100,7 +100,7 @@ export interface SearchResponse { suggestedFlowType: FlowType | null; answer: string | null; quotes: Quote[] | null; - documents: SearchDanswerDocument[] | null; + documents: SearchOnyxDocument[] | null; selectedDocIndices: number[] | null; error: string | null; messageId: number | null; @@ -149,7 +149,7 @@ export interface SearchRequestArgs { updateDocumentRelevance: (relevance: any) => void; updateCurrentAnswer: (val: string) => void; updateQuotes: (quotes: Quote[]) => void; - updateDocs: (documents: DanswerDocument[]) => void; + updateDocs: (documents: OnyxDocument[]) => void; updateSelectedDocIndices: (docIndices: number[]) => void; updateSuggestedSearchType: (searchType: SearchType) => void; updateSuggestedFlowType: (flowType: FlowType) => void; diff --git a/web/src/lib/search/keyword.ts b/web/src/lib/search/keyword.ts deleted file mode 100644 index 62dd36dd863..00000000000 --- a/web/src/lib/search/keyword.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { DanswerDocument, SearchRequestArgs } from "./interfaces"; - -interface KeywordResponse { - top_ranked_docs: DanswerDocument[]; - lower_ranked_docs: DanswerDocument[]; -} - -export const keywordSearch = async ({ - query, - sources, - updateDocs, -}: SearchRequestArgs): Promise => { - const response = await fetch("/api/keyword-search", { - method: "POST", - body: JSON.stringify({ - query, - collection: "danswer_index", - ...(sources.length > 0 - ? { - filters: [ - { - source_type: sources.map((source) => source.internalName), - }, - ], - } - : {}), - }), - headers: { - "Content-Type": "application/json", - }, - }); - - if (!response.ok) { - return; - } - - const keywordResults = (await response.json()) as KeywordResponse; - - let matchingDocs = keywordResults.top_ranked_docs; - if (keywordResults.lower_ranked_docs) { - matchingDocs = matchingDocs.concat(keywordResults.lower_ranked_docs); - } - - updateDocs(matchingDocs); -}; diff --git a/web/src/lib/search/streamingQa.ts b/web/src/lib/search/streamingQa.ts index b0e4888b118..3fe8b87eeae 100644 --- a/web/src/lib/search/streamingQa.ts +++ b/web/src/lib/search/streamingQa.ts @@ -4,7 +4,7 @@ import { } from "@/app/chat/interfaces"; import { AnswerPiecePacket, - DanswerDocument, + OnyxDocument, ErrorMessagePacket, DocumentInfoPacket, Quote, @@ -37,7 +37,7 @@ export const searchRequestStreamed = async ({ }: SearchRequestArgs) => { let answer = ""; let quotes: Quote[] | null = null; - let relevantDocuments: DanswerDocument[] | null = null; + let relevantDocuments: OnyxDocument[] | null = null; try { const filters = buildFilters(sources, documentSets, timeRange, tags); @@ -137,7 +137,7 @@ export const searchRequestStreamed = async ({ // These all come together if (Object.hasOwn(chunk, "top_documents")) { chunk = chunk as DocumentInfoPacket; - const topDocuments = chunk.top_documents as DanswerDocument[] | null; + const topDocuments = chunk.top_documents as OnyxDocument[] | null; if (topDocuments) { relevantDocuments = topDocuments; updateDocs(relevantDocuments); diff --git a/web/src/lib/sources.ts b/web/src/lib/sources.ts index 381c97bfa67..7c057a42cfd 100644 --- a/web/src/lib/sources.ts +++ b/web/src/lib/sources.ts @@ -42,7 +42,7 @@ import { } from "@/components/icons/icons"; import { ValidSources } from "./types"; import { - DanswerDocument, + OnyxDocument, SourceCategory, SourceMetadata, } from "./search/interfaces"; @@ -64,129 +64,129 @@ export const SOURCE_METADATA_MAP: SourceMap = { icon: GlobeIcon, displayName: "Web", category: SourceCategory.Other, - docs: "https://docs.danswer.dev/connectors/web", + docs: "https://docs.onyx.app/connectors/web", }, file: { icon: FileIcon, displayName: "File", category: SourceCategory.Storage, - docs: "https://docs.danswer.dev/connectors/file", + docs: "https://docs.onyx.app/connectors/file", }, slack: { icon: ColorSlackIcon, displayName: "Slack", category: SourceCategory.Messaging, - docs: "https://docs.danswer.dev/connectors/slack", + docs: "https://docs.onyx.app/connectors/slack", oauthSupported: true, }, gmail: { icon: GmailIcon, displayName: "Gmail", category: SourceCategory.Messaging, - docs: "https://docs.danswer.dev/connectors/gmail/overview", + docs: "https://docs.onyx.app/connectors/gmail/overview", }, google_drive: { icon: GoogleDriveIcon, displayName: "Google Drive", category: SourceCategory.Storage, - docs: "https://docs.danswer.dev/connectors/google_drive/overview", + docs: "https://docs.onyx.app/connectors/google_drive/overview", oauthSupported: true, }, github: { icon: GithubIcon, displayName: "Github", category: SourceCategory.CodeRepository, - docs: "https://docs.danswer.dev/connectors/github", + docs: "https://docs.onyx.app/connectors/github", }, gitlab: { icon: GitlabIcon, displayName: "Gitlab", category: SourceCategory.CodeRepository, - docs: "https://docs.danswer.dev/connectors/gitlab", + docs: "https://docs.onyx.app/connectors/gitlab", }, confluence: { icon: ConfluenceIcon, displayName: "Confluence", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/confluence", + docs: "https://docs.onyx.app/connectors/confluence", }, jira: { icon: JiraIcon, displayName: "Jira", category: SourceCategory.ProjectManagement, - docs: "https://docs.danswer.dev/connectors/jira", + docs: "https://docs.onyx.app/connectors/jira", }, notion: { icon: NotionIcon, displayName: "Notion", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/notion", + docs: "https://docs.onyx.app/connectors/notion", }, zendesk: { icon: ZendeskIcon, displayName: "Zendesk", category: SourceCategory.CustomerSupport, - docs: "https://docs.danswer.dev/connectors/zendesk", + docs: "https://docs.onyx.app/connectors/zendesk", }, gong: { icon: GongIcon, displayName: "Gong", category: SourceCategory.Other, - docs: "https://docs.danswer.dev/connectors/gong", + docs: "https://docs.onyx.app/connectors/gong", }, linear: { icon: LinearIcon, displayName: "Linear", category: SourceCategory.ProjectManagement, - docs: "https://docs.danswer.dev/connectors/linear", + docs: "https://docs.onyx.app/connectors/linear", }, productboard: { icon: ProductboardIcon, displayName: "Productboard", category: SourceCategory.ProjectManagement, - docs: "https://docs.danswer.dev/connectors/productboard", + docs: "https://docs.onyx.app/connectors/productboard", }, slab: { icon: SlabIcon, displayName: "Slab", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/slab", + docs: "https://docs.onyx.app/connectors/slab", }, zulip: { icon: ZulipIcon, displayName: "Zulip", category: SourceCategory.Messaging, - docs: "https://docs.danswer.dev/connectors/zulip", + docs: "https://docs.onyx.app/connectors/zulip", }, guru: { icon: GuruIcon, displayName: "Guru", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/guru", + docs: "https://docs.onyx.app/connectors/guru", }, hubspot: { icon: HubSpotIcon, displayName: "HubSpot", category: SourceCategory.CustomerSupport, - docs: "https://docs.danswer.dev/connectors/hubspot", + docs: "https://docs.onyx.app/connectors/hubspot", }, document360: { icon: Document360Icon, displayName: "Document360", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/document360", + docs: "https://docs.onyx.app/connectors/document360", }, bookstack: { icon: BookstackIcon, displayName: "BookStack", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/bookstack", + docs: "https://docs.onyx.app/connectors/bookstack", }, google_sites: { icon: GoogleSitesIcon, displayName: "Google Sites", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/google_sites", + docs: "https://docs.onyx.app/connectors/google_sites", }, loopio: { icon: LoopioIcon, @@ -197,85 +197,85 @@ export const SOURCE_METADATA_MAP: SourceMap = { icon: DropboxIcon, displayName: "Dropbox", category: SourceCategory.Storage, - docs: "https://docs.danswer.dev/connectors/dropbox", + docs: "https://docs.onyx.app/connectors/dropbox", }, salesforce: { icon: SalesforceIcon, displayName: "Salesforce", category: SourceCategory.CustomerSupport, - docs: "https://docs.danswer.dev/connectors/salesforce", + docs: "https://docs.onyx.app/connectors/salesforce", }, sharepoint: { icon: SharepointIcon, displayName: "Sharepoint", category: SourceCategory.Storage, - docs: "https://docs.danswer.dev/connectors/sharepoint", + docs: "https://docs.onyx.app/connectors/sharepoint", }, teams: { icon: TeamsIcon, displayName: "Teams", category: SourceCategory.Messaging, - docs: "https://docs.danswer.dev/connectors/teams", + docs: "https://docs.onyx.app/connectors/teams", }, discourse: { icon: DiscourseIcon, displayName: "Discourse", category: SourceCategory.Messaging, - docs: "https://docs.danswer.dev/connectors/discourse", + docs: "https://docs.onyx.app/connectors/discourse", }, axero: { icon: AxeroIcon, displayName: "Axero", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/axero", + docs: "https://docs.onyx.app/connectors/axero", }, wikipedia: { icon: WikipediaIcon, displayName: "Wikipedia", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/wikipedia", + docs: "https://docs.onyx.app/connectors/wikipedia", }, asana: { icon: AsanaIcon, displayName: "Asana", category: SourceCategory.ProjectManagement, - docs: "https://docs.danswer.dev/connectors/asana", + docs: "https://docs.onyx.app/connectors/asana", }, mediawiki: { icon: MediaWikiIcon, displayName: "MediaWiki", category: SourceCategory.Wiki, - docs: "https://docs.danswer.dev/connectors/mediawiki", + docs: "https://docs.onyx.app/connectors/mediawiki", }, clickup: { icon: ClickupIcon, displayName: "Clickup", category: SourceCategory.ProjectManagement, - docs: "https://docs.danswer.dev/connectors/clickup", + docs: "https://docs.onyx.app/connectors/clickup", }, s3: { icon: S3Icon, displayName: "S3", category: SourceCategory.Storage, - docs: "https://docs.danswer.dev/connectors/s3", + docs: "https://docs.onyx.app/connectors/s3", }, r2: { icon: R2Icon, displayName: "R2", category: SourceCategory.Storage, - docs: "https://docs.danswer.dev/connectors/r2", + docs: "https://docs.onyx.app/connectors/r2", }, oci_storage: { icon: OCIStorageIcon, displayName: "Oracle Storage", category: SourceCategory.Storage, - docs: "https://docs.danswer.dev/connectors/oci_storage", + docs: "https://docs.onyx.app/connectors/oci_storage", }, google_cloud_storage: { icon: GoogleStorageIcon, displayName: "Google Storage", category: SourceCategory.Storage, - docs: "https://docs.danswer.dev/connectors/google_storage", + docs: "https://docs.onyx.app/connectors/google_storage", }, xenforo: { icon: XenforoIcon, @@ -291,13 +291,13 @@ export const SOURCE_METADATA_MAP: SourceMap = { icon: FreshdeskIcon, displayName: "Freshdesk", category: SourceCategory.CustomerSupport, - docs: "https://docs.danswer.dev/connectors/freshdesk", + docs: "https://docs.onyx.app/connectors/freshdesk", }, fireflies: { icon: FirefliesIcon, displayName: "Fireflies", category: SourceCategory.Other, - docs: "https://docs.danswer.dev/connectors/fireflies", + docs: "https://docs.onyx.app/connectors/fireflies", }, // currently used for the Internet Search tool docs, which is why // a globe is used @@ -310,7 +310,7 @@ export const SOURCE_METADATA_MAP: SourceMap = { icon: EgnyteIcon, displayName: "Egnyte", category: SourceCategory.Storage, - docs: "https://docs.danswer.dev/connectors/egnyte", + docs: "https://docs.onyx.app/connectors/egnyte", }, } as SourceMap; diff --git a/web/src/lib/types.ts b/web/src/lib/types.ts index 505f4fce1f8..439066aa6df 100644 --- a/web/src/lib/types.ts +++ b/web/src/lib/types.ts @@ -45,7 +45,7 @@ export const INVALID_ROLE_HOVER_TEXT: Partial> = { "Global Curator users can perform admin actions for all groups they are a member of", [UserRole.CURATOR]: "Curator role must be assigned in the Groups tab", [UserRole.SLACK_USER]: - "This role is automatically assigned to users who only use Danswer via Slack", + "This role is automatically assigned to users who only use Onyx via Slack", }; export interface User { diff --git a/web/src/lib/userSS.ts b/web/src/lib/userSS.ts index b0c9609391f..7360d549415 100644 --- a/web/src/lib/userSS.ts +++ b/web/src/lib/userSS.ts @@ -29,7 +29,7 @@ export const getAuthTypeMetadataSS = async (): Promise => { } // for SAML / OIDC, we auto-redirect the user to the IdP when the user visits - // Danswer in an un-authenticated state + // Onyx in an un-authenticated state if (authType === "oidc" || authType === "saml") { return { authType, @@ -51,7 +51,9 @@ export const getAuthDisabledSS = async (): Promise => { const getOIDCAuthUrlSS = async (nextUrl: string | null): Promise => { const res = await fetch( buildUrl( - `/auth/oidc/authorize${nextUrl ? `?next=${encodeURIComponent(nextUrl)}` : ""}` + `/auth/oidc/authorize${ + nextUrl ? `?next=${encodeURIComponent(nextUrl)}` : "" + }` ) ); if (!res.ok) { @@ -65,7 +67,9 @@ const getOIDCAuthUrlSS = async (nextUrl: string | null): Promise => { const getGoogleOAuthUrlSS = async (nextUrl: string | null): Promise => { const res = await fetch( buildUrl( - `/auth/oauth/authorize${nextUrl ? `?next=${encodeURIComponent(nextUrl)}` : ""}` + `/auth/oauth/authorize${ + nextUrl ? `?next=${encodeURIComponent(nextUrl)}` : "" + }` ), { headers: { @@ -84,7 +88,9 @@ const getGoogleOAuthUrlSS = async (nextUrl: string | null): Promise => { const getSAMLAuthUrlSS = async (nextUrl: string | null): Promise => { const res = await fetch( buildUrl( - `/auth/saml/authorize${nextUrl ? `?next=${encodeURIComponent(nextUrl)}` : ""}` + `/auth/saml/authorize${ + nextUrl ? `?next=${encodeURIComponent(nextUrl)}` : "" + }` ) ); if (!res.ok) { diff --git a/web/tests/e2e/admin_api_key.spec.ts b/web/tests/e2e/admin_api_key.spec.ts index 46ada8d6464..6feb6be20cf 100644 --- a/web/tests/e2e/admin_api_key.spec.ts +++ b/web/tests/e2e/admin_api_key.spec.ts @@ -10,7 +10,7 @@ test( await page.goto("http://localhost:3000/admin/api-key"); await expect(page.locator("h1.text-3xl")).toHaveText("API Keys"); await expect(page.locator("p.text-sm")).toHaveText( - /^API Keys allow you to access Danswer APIs programmatically/ + /^API Keys allow you to access Onyx APIs programmatically/ ); await expect( page.getByRole("button", { name: "Create API Key" }) diff --git a/web/tests/e2e/admin_auth.setup.ts b/web/tests/e2e/admin_auth.setup.ts index c4dcf8eedfd..500b87c0f6a 100644 --- a/web/tests/e2e/admin_auth.setup.ts +++ b/web/tests/e2e/admin_auth.setup.ts @@ -10,7 +10,7 @@ setup("authenticate", async ({ page }) => { await page.waitForURL("http://localhost:3000/auth/login?next=%2Fchat"); - await expect(page).toHaveTitle("Danswer"); + await expect(page).toHaveTitle("Onyx"); await page.fill("#email", email); await page.fill("#password", password); diff --git a/web/tests/e2e/admin_bots.spec.ts b/web/tests/e2e/admin_bots.spec.ts index e577696a546..309b0e90d89 100644 --- a/web/tests/e2e/admin_bots.spec.ts +++ b/web/tests/e2e/admin_bots.spec.ts @@ -10,7 +10,7 @@ test( await page.goto("http://localhost:3000/admin/bots"); await expect(page.locator("h1.text-3xl")).toHaveText("Slack Bots"); await expect(page.locator("p.text-sm").nth(0)).toHaveText( - /^Setup Slack bots that connect to Danswer./ + /^Setup Slack bots that connect to Onyx./ ); } ); diff --git a/web/tests/e2e/admin_settings.spec.ts b/web/tests/e2e/admin_settings.spec.ts index 79c8e0d1233..d48fe13a736 100644 --- a/web/tests/e2e/admin_settings.spec.ts +++ b/web/tests/e2e/admin_settings.spec.ts @@ -10,7 +10,7 @@ test( await page.goto("http://localhost:3000/admin/settings"); await expect(page.locator("h1.text-3xl")).toHaveText("Workspace Settings"); await expect(page.locator("p.text-sm").nth(0)).toHaveText( - /^Manage general Danswer settings applicable to all users in the workspace./ + /^Manage general Onyx settings applicable to all users in the workspace./ ); await expect( page.getByRole("button", { name: "Set Retention Limit" }) diff --git a/web/tests/e2e/home.spec.ts b/web/tests/e2e/home.spec.ts index a9b88244392..a57f19ad6e8 100644 --- a/web/tests/e2e/home.spec.ts +++ b/web/tests/e2e/home.spec.ts @@ -16,7 +16,7 @@ test( await page.waitForURL("http://localhost:3000/auth/login?next=%2Fchat"); - await expect(page).toHaveTitle("Danswer"); + await expect(page).toHaveTitle("Onyx"); await takeSnapshot(page, "Before login", testInfo); @@ -30,8 +30,6 @@ test( await page.getByPlaceholder("Send a message or try using @ or /"); - await expect(page.locator("body")).not.toContainText( - "Initializing Danswer" - ); + await expect(page.locator("body")).not.toContainText("Initializing Onyx"); } );