diff --git a/README.md b/README.md index 7adbe9f1..19934a36 100644 --- a/README.md +++ b/README.md @@ -63,22 +63,6 @@ poetry install This creates a new virtual environment and installs the project's dependencies. -### Activate the Virtual Environment - -To use the virtual environment, follow this procedure. - -> [!NOTE] Run these commands in the root directory of your project, where the `pyproject.toml` file is located. - -1. Use `poetry shell` to start a new shell session with the virtual environment activated: - - ```bash - poetry shell - ``` - - Now, you can run Python and any installed packages in this shell. They will use the virtual environment. -2. Use `poetry run` to execute a command. -3. Use the `deactivate` command to exit the virtual environment. - If you are a PyCharm user and want to use the virtual environment created by Poetry, follow the [configuration guides](https://www.jetbrains.com/help/pycharm/poetry.html). ## Use Poe the Poet as Task Runner @@ -144,7 +128,7 @@ poetry poe codecheck To fix linting and formatting issues, use the following command: ```bash -poetry poe codefix +poetry poe code-fix ``` Mypy does not support fixing issues automatically. diff --git a/config/config-example.json b/config/config-example.json new file mode 100644 index 00000000..499140ba --- /dev/null +++ b/config/config-example.json @@ -0,0 +1,43 @@ +{ + "AICORE_AUTH_URL": "", + "AICORE_BASE_URL": "", + "AICORE_CLIENT_ID": "", + "AICORE_CLIENT_SECRET": "", + "AICORE_RESOURCE_GROUP": "default", + + "REDIS_URL": "redis://localhost:6379", + "REDIS_HOST": "localhost", + "REDIS_PORT": "6379", + + "TEST_CLUSTER_URL": "", + "TEST_CLUSTER_CA_DATA": "", + "TEST_CLUSTER_AUTH_TOKEN": "", + + "LANGFUSE_HOST": "", + "LANGFUSE_SECRET_KEY": "", + "LANGFUSE_PUBLIC_KEY": "", + "LANGFUSE_ENABLED": "True", + + "DATABASE_URL": "", + "DATABASE_USER": "", + "DATABASE_PASSWORD": "", + "DATABASE_PORT": "443", + "DOCS_TABLE_NAME": "", + + "models": [ + { + "name": "gpt-4o", + "deployment_id": "", + "temperature": 0 + }, + { + "name": "gpt-4o-mini", + "deployment_id": "", + "temperature": 0 + }, + { + "name": "text-embedding-3-large", + "deployment_id": "" + } + ] +} diff --git a/doc_indexer/README.md b/doc_indexer/README.md index 8becf36c..45b36441 100644 --- a/doc_indexer/README.md +++ b/doc_indexer/README.md @@ -19,35 +19,10 @@ To run the project locally, follow these steps: poetry install ``` -2. Create .env file in the root of the project and add the following variables: -```yaml -LOG_LEVEL=INFO # Set the log level to INFO, DEBUG, WARNING, or ERROR - -# AI Core credentials -AICORE_AUTH_URL= -AICORE_CLIENT_ID= -AICORE_CLIENT_SECRET= -AICORE_RESOURCE_GROUP= -AICORE_BASE_URL= - -# Embedding Model -EMBEDDING_MODEL_DEPLOYMENT_ID= -EMBEDDING_MODEL_NAME= - -# Kyma docs path -DOCS_SOURCES_FILE_PATH= # Path to the file with the list of documentation sources. Default: "docs_sources.json" -DOCS_PATH=... - -# HANA Cloud DB -DATABASE_URL= -DATABASE_PORT= -DATABASE_USER= -DATABASE_PASSWORD= -``` +2. Prepare the `config-doc-indexer.json` file based on the [template](../../config/config-example.json). -It is important to pay attention that `DOCS_PATH` is the path to the Kyma documentation markdown files. +3. Run the fetcher to pull documents from the specified sources in the `docs_sources.json` [file](./docs_sources.json): -3. Run the fetcher to pull documents from the specified sources in the `DOCS_SOURCES_FILE_PATH` file: ```bash poetry run python src/main.py fetch ``` @@ -59,7 +34,7 @@ poetry run python src/main.py index ## Testing -The `.env` file can also be used for testing. You can create a separate `.env.test` file with similar content to `.env`. +The `config-doc-indexer.json` file can also be used for testing. To run the unit and integration tests, use the following command: ```bash diff --git a/tests/blackbox/evaluation.md b/tests/blackbox/evaluation.md index 9a175eb6..4810d582 100644 --- a/tests/blackbox/evaluation.md +++ b/tests/blackbox/evaluation.md @@ -23,40 +23,16 @@ To run the Evaluation tests, follow these steps: poetry install ``` -2. Prepare the `.env.evaluation` file based on the following template: +2. Prepare the `config-evaluation.json` file based on the [template](../../config/config-example.json). - ``` - LOG_LEVEL= # Allowed values: "INFO", "DEBUG", "ERROR", "WARNING" - TEST_DATA_PATH= # Directory path of test data. e.g. "/Users//git/kyma-project/kyma-companion/tests/data". - MODEL_NAME= # [Optional] Model name to use for validator. - COMPANION_API_URL= # Kyma Companion API URL. e.g. "http://localhost:8080/api/v1/pods/stream". - COMPANION_TOKEN= # [Optional] Kyma Companion API Authentication Token. - TEST_CLUSTER_URL= # Kubernetes Cluster (with test-cases configured) URL. - TEST_CLUSTER_CA_DATA= # Kubernetes Cluster (with test-cases configured) Certificate Authority Data. - TEST_CLUSTER_AUTH_TOKEN= # Kubernetes Cluster (with test-cases configured) Authentication Token. - AICORE_AUTH_URL= # AI-Core Auth URL. - AICORE_BASE_URL= # AI-Core Base URL. - AICORE_CLIENT_ID= # AI-Core Client ID. - AICORE_CLIENT_SECRET= # AI-Core Client Secret. - AICORE_RESOURCE_GROUP= # AI-Core Resource Group. - AICORE_CONFIGURATION_ID_GPT4_MINI= # AI-Core Configuration ID for GPT-4 mini. - AICORE_DEPLOYMENT_ID_GPT4_MINI= # AI-Core Deployment ID for GPT-4 mini. - DEFAULT_RETRY_WAIT_TIME= # [Optional] The number of seconds we increase the retry wait time by when querying the Companion API. Default is 60. - DEFAULT_RETRY_MAX_WAIT_TIME= # [Optional] The maximum retry wait time in seconds when querying the Companion API. Default is 600. - - ``` - -3. Run the following command to set up the environment variables in your system: +3. Run the following command to set up `CONFIG_PATH` environment variable in your system: ```bash - export $(xargs < .env.evaluation) + export CONFIG_PATH= ``` 4. Run the Evaluation tests: ```bash poetry run python src/run_evaluation.py - # OR - poetry shell - python src/run_evaluation.py ``` diff --git a/tests/blackbox/validation.md b/tests/blackbox/validation.md index 7f587e13..394cb4f9 100644 --- a/tests/blackbox/validation.md +++ b/tests/blackbox/validation.md @@ -12,39 +12,16 @@ To run the validation, follow these steps: poetry install ``` -2. Add LLMs data to `config/validation/models.yml` that are to be validated. The data should be in the following format: +2. Prepare the `config-validation.json` file based on the [template](../../config/config-example.json). - ```yaml - - name: "gpt-4" - deployment_id: {deployment_id_gpt_4} - - name: "gemini-1.5-pro" - deployment_id: {deployment_id_gemini_1_5_pro} - ``` - -3. Prepare the `.env.validation` file based on the following template: - - ``` - AICORE_AUTH_URL= # AI-Core Auth URL. - AICORE_BASE_URL= # AI-Core Base URL. - AICORE_CLIENT_ID= # AI-Core Client ID. - AICORE_CLIENT_SECRET= # AI-Core Client Secret. - AICORE_RESOURCE_GROUP= # AI-Core Resource Group. - - VALIDATION_DATA_PATH= # Optional: Path to the validation data folder, default is ./data - MODEL_CONFIG_PATH= # Optional: Path to the model config file, default is ./config/validation/models.yml - ``` - -3. Run the following command to set up the environment variables in your system: +3. Run the following command to set up `CONFIG_PATH` environment variable in your system: ```bash - export $(xargs < .env.validation) + export CONFIG_PATH= ``` 4. Run the validation: ```bash poetry run python src/run_validation.py - # OR - poetry shell - python src/run_validation.py ``` diff --git a/tests/integration/README.md b/tests/integration/README.md index 744abf2c..76354780 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -16,32 +16,17 @@ To run the Integration tests, follow these steps: poetry install ``` -2. Prepare the `.env.test` file based on the following template: +2. Prepare the `config-integration.json` file based on the [template](../../config/config-example.json). - ``` - LOG_LEVEL= # Allowed values: "INFO", "DEBUG", "ERROR", "WARNING" - TEST_CLUSTER_URL= # Kubernetes Cluster (with test-cases configured) URL. - TEST_CLUSTER_CA_DATA= # Kubernetes Cluster (with test-cases configured) Certificate Authority Data. - TEST_CLUSTER_AUTH_TOKEN= # Kubernetes Cluster (with test-cases configured) Authentication Token. - AICORE_AUTH_URL= # AI-Core Auth URL. - AICORE_BASE_URL= # AI-Core Base URL. - AICORE_CLIENT_ID= # AI-Core Client ID. - AICORE_CLIENT_SECRET= # AI-Core Client Secret. - AICORE_RESOURCE_GROUP= # AI-Core Resource Group. - ``` - -3. Run the following command to set up the environment variables in your system: +3. Run the following command to set up `CONFIG_PATH` environment variable in your system: ```bash - export $(xargs < .env.test) + export CONFIG_PATH= ``` 4. Run the integration tests: ```bash poetry run poe test-integration - # OR - poetry shell - poe test-integration ```