mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-01 09:27:43 +00:00
7adade22bf
* Add a table & factor debug * Congfig setting * Update env example and configuration list. Also change api priority * Add a TODO for the rst * CI: shorter line * Update docs/installation_and_configuration.rst * Update docs/installation_and_configuration.rst * Update links & standard config * Add TODO * Fix bug * Update rdagent/oai/llm_utils.py --------- Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
143 lines
7.7 KiB
ReStructuredText
143 lines
7.7 KiB
ReStructuredText
==============================
|
|
Installation and Configuration
|
|
==============================
|
|
|
|
Installation
|
|
============
|
|
|
|
For different scenarios
|
|
- for purely users:
|
|
- for dev users: `See development <development.html>`_
|
|
|
|
Configuration
|
|
=============
|
|
|
|
To run the application, please create a `.env` file in the root directory of the project and add environment variables according to your requirements.
|
|
|
|
The standard configuration options for the user using the OpenAI API are provided in the `.env.example` file.
|
|
|
|
Here are some other configuration options that you can use:
|
|
|
|
OpenAI API
|
|
------------
|
|
|
|
Here is a standard configuration for the user using the OpenAI API.
|
|
|
|
.. code-block:: Properties
|
|
|
|
OPENAI_API_KEY=<your_api_key>
|
|
EMBEDDING_MODEL=text-embedding-3-small
|
|
CHAT_MODEL=gpt-4-turbo
|
|
|
|
Azure OpenAI
|
|
------------
|
|
|
|
The following environment variables are standard configuration options for the user using the OpenAI API.
|
|
|
|
.. code-block:: Properties
|
|
|
|
USE_AZURE=True
|
|
|
|
OPENAI_API_KEY=<replace_with_your_openai_api_key>
|
|
|
|
EMBEDDING_MODEL=text-embedding-3-small
|
|
EMBEDDING_AZURE_API_BASE= # The base URL for the Azure OpenAI API.
|
|
EMBEDDING_AZURE_API_VERSION = # The version of the Azure OpenAI API.
|
|
|
|
CHAT_MODEL=gpt-4-turbo
|
|
CHAT_AZURE_API_VERSION = # The version of the Azure OpenAI API.
|
|
|
|
Use Azure Token Provider
|
|
------------------------
|
|
|
|
If you are using the Azure token provider, you need to set the `USE_AZURE_TOKEN_PROVIDER` environment variable to `True`. then
|
|
use the environment variables provided in the `Azure Configuration section <installation_and_configuration.html#azure-openai>`_.
|
|
|
|
|
|
☁️ Azure Configuration
|
|
- Install Azure CLI:
|
|
|
|
```sh
|
|
curl -L https://aka.ms/InstallAzureCli | bash
|
|
```
|
|
|
|
- Log in to Azure:
|
|
|
|
```sh
|
|
az login --use-device-code
|
|
```
|
|
|
|
- `exit` and re-login to your environment (this step may not be necessary).
|
|
|
|
|
|
Configuration List
|
|
------------------
|
|
|
|
.. TODO: use `autodoc-pydantic` .
|
|
|
|
- OpenAI API Setting
|
|
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| Configuration Option | Meaning | Default Value |
|
|
+=============================+==================================================+=========================+
|
|
| OPENAI_API_KEY | API key for both chat and embedding models | None |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| EMBEDDING_OPENAI_API_KEY | Use a different API key for embedding model | None |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| CHAT_OPENAI_API_KEY | Set to use a different API key for chat model | None |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| EMBEDDING_MODEL | Name of the embedding model | text-embedding-3-small |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| CHAT_MODEL | Name of the chat model | gpt-4-turbo |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| EMBEDDING_AZURE_API_BASE | Base URL for the Azure OpenAI API | None |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| EMBEDDING_AZURE_API_VERSION | Version of the Azure OpenAI API | None |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| CHAT_AZURE_API_BASE | Base URL for the Azure OpenAI API | None |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| CHAT_AZURE_API_VERSION | Version of the Azure OpenAI API | None |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| USE_AZURE | True if you are using Azure OpenAI | False |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| USE_AZURE_TOKEN_PROVIDER | True if you are using a Azure Token Provider | False |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
|
|
- Globol Setting
|
|
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| Configuration Option | Meaning | Default Value |
|
|
+=============================+==================================================+=========================+
|
|
| max_retry | Maximum number of times to retry | 10 |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
| retry_wait_seconds | Number of seconds to wait before retrying | 1 |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
+ log_trace_path | Path to log trace file | None |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
+ log_llm_chat_content | Flag to indicate if chat content is logged | True |
|
|
+-----------------------------+--------------------------------------------------+-------------------------+
|
|
|
|
|
|
- Cache Setting
|
|
|
|
.. TODO: update Meaning for caches
|
|
|
|
+------------------------------+--------------------------------------------------+-------------------------+
|
|
| Configuration Option | Meaning | Default Value |
|
|
+==============================+==================================================+=========================+
|
|
| dump_chat_cache | Flag to indicate if chat cache is dumped | False |
|
|
+------------------------------+--------------------------------------------------+-------------------------+
|
|
| dump_embedding_cache | Flag to indicate if embedding cache is dumped | False |
|
|
+------------------------------+--------------------------------------------------+-------------------------+
|
|
| use_chat_cache | Flag to indicate if chat cache is used | False |
|
|
+------------------------------+--------------------------------------------------+-------------------------+
|
|
| use_embedding_cache | Flag to indicate if embedding cache is used | False |
|
|
+------------------------------+--------------------------------------------------+-------------------------+
|
|
| prompt_cache_path | Path to prompt cache | ./prompt_cache.db |
|
|
+------------------------------+--------------------------------------------------+-------------------------+
|
|
| session_cache_folder_location| Path to session cache | ./session_cache_folder |
|
|
+------------------------------+--------------------------------------------------+-------------------------+
|
|
| max_past_message_include | Maximum number of past messages to include | 10 |
|
|
+------------------------------+--------------------------------------------------+-------------------------+
|
|
|