|
| 1 | +============================== |
| 2 | +Installation and Configuration |
| 3 | +============================== |
| 4 | + |
| 5 | +Installation |
| 6 | +============ |
| 7 | + |
| 8 | +For different scenarios |
| 9 | +- for purely users: |
| 10 | +- for dev users: `See development <development.html>`_ |
| 11 | + |
| 12 | +Configuration |
| 13 | +============= |
| 14 | + |
| 15 | +To run the application, please create a `.env` file in the root directory of the project and add environment variables according to your requirements. |
| 16 | + |
| 17 | +The standard configuration options for the user using the OpenAI API are provided in the `.env.example` file. |
| 18 | + |
| 19 | +Here are some other configuration options that you can use: |
| 20 | + |
| 21 | +OpenAI API |
| 22 | +------------ |
| 23 | + |
| 24 | +Here is a standard configuration for the user using the OpenAI API. |
| 25 | + |
| 26 | + .. code-block:: Properties |
| 27 | +
|
| 28 | + OPENAI_API_KEY=<your_api_key> |
| 29 | + EMBEDDING_MODEL=text-embedding-3-small |
| 30 | + CHAT_MODEL=gpt-4-turbo |
| 31 | +
|
| 32 | +Azure OpenAI |
| 33 | +------------ |
| 34 | + |
| 35 | +The following environment variables are standard configuration options for the user using the OpenAI API. |
| 36 | + |
| 37 | + .. code-block:: Properties |
| 38 | + |
| 39 | + USE_AZURE=True |
| 40 | +
|
| 41 | + OPENAI_API_KEY=<replace_with_your_openai_api_key> |
| 42 | + |
| 43 | + EMBEDDING_MODEL=text-embedding-3-small |
| 44 | + EMBEDDING_AZURE_API_BASE= # The base URL for the Azure OpenAI API. |
| 45 | + EMBEDDING_AZURE_API_VERSION = # The version of the Azure OpenAI API. |
| 46 | +
|
| 47 | + CHAT_MODEL=gpt-4-turbo |
| 48 | + CHAT_AZURE_API_VERSION = # The version of the Azure OpenAI API. |
| 49 | +
|
| 50 | +Use Azure Token Provider |
| 51 | +------------------------ |
| 52 | + |
| 53 | +If you are using the Azure token provider, you need to set the `USE_AZURE_TOKEN_PROVIDER` environment variable to `True`. then |
| 54 | +use the environment variables provided in the `Azure Configuration section <installation_and_configuration.html#azure-openai>`_. |
| 55 | + |
| 56 | + |
| 57 | +☁️ Azure Configuration |
| 58 | +- Install Azure CLI: |
| 59 | + |
| 60 | + ```sh |
| 61 | + curl -L https://aka.ms/InstallAzureCli | bash |
| 62 | + ``` |
| 63 | + |
| 64 | +- Log in to Azure: |
| 65 | + |
| 66 | + ```sh |
| 67 | + az login --use-device-code |
| 68 | + ``` |
| 69 | + |
| 70 | +- `exit` and re-login to your environment (this step may not be necessary). |
| 71 | + |
| 72 | + |
| 73 | +Configuration List |
| 74 | +------------------ |
| 75 | + |
| 76 | +.. TODO: use `autodoc-pydantic` . |
| 77 | +
|
| 78 | +- OpenAI API Setting |
| 79 | + |
| 80 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 81 | +| Configuration Option | Meaning | Default Value | |
| 82 | ++=============================+==================================================+=========================+ |
| 83 | +| OPENAI_API_KEY | API key for both chat and embedding models | None | |
| 84 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 85 | +| EMBEDDING_OPENAI_API_KEY | Use a different API key for embedding model | None | |
| 86 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 87 | +| CHAT_OPENAI_API_KEY | Set to use a different API key for chat model | None | |
| 88 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 89 | +| EMBEDDING_MODEL | Name of the embedding model | text-embedding-3-small | |
| 90 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 91 | +| CHAT_MODEL | Name of the chat model | gpt-4-turbo | |
| 92 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 93 | +| EMBEDDING_AZURE_API_BASE | Base URL for the Azure OpenAI API | None | |
| 94 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 95 | +| EMBEDDING_AZURE_API_VERSION | Version of the Azure OpenAI API | None | |
| 96 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 97 | +| CHAT_AZURE_API_BASE | Base URL for the Azure OpenAI API | None | |
| 98 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 99 | +| CHAT_AZURE_API_VERSION | Version of the Azure OpenAI API | None | |
| 100 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 101 | +| USE_AZURE | True if you are using Azure OpenAI | False | |
| 102 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 103 | +| USE_AZURE_TOKEN_PROVIDER | True if you are using a Azure Token Provider | False | |
| 104 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 105 | + |
| 106 | +- Globol Setting |
| 107 | + |
| 108 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 109 | +| Configuration Option | Meaning | Default Value | |
| 110 | ++=============================+==================================================+=========================+ |
| 111 | +| max_retry | Maximum number of times to retry | 10 | |
| 112 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 113 | +| retry_wait_seconds | Number of seconds to wait before retrying | 1 | |
| 114 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 115 | ++ log_trace_path | Path to log trace file | None | |
| 116 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 117 | ++ log_llm_chat_content | Flag to indicate if chat content is logged | True | |
| 118 | ++-----------------------------+--------------------------------------------------+-------------------------+ |
| 119 | + |
| 120 | + |
| 121 | +- Cache Setting |
| 122 | + |
| 123 | +.. TODO: update Meaning for caches |
| 124 | +
|
| 125 | ++------------------------------+--------------------------------------------------+-------------------------+ |
| 126 | +| Configuration Option | Meaning | Default Value | |
| 127 | ++==============================+==================================================+=========================+ |
| 128 | +| dump_chat_cache | Flag to indicate if chat cache is dumped | False | |
| 129 | ++------------------------------+--------------------------------------------------+-------------------------+ |
| 130 | +| dump_embedding_cache | Flag to indicate if embedding cache is dumped | False | |
| 131 | ++------------------------------+--------------------------------------------------+-------------------------+ |
| 132 | +| use_chat_cache | Flag to indicate if chat cache is used | False | |
| 133 | ++------------------------------+--------------------------------------------------+-------------------------+ |
| 134 | +| use_embedding_cache | Flag to indicate if embedding cache is used | False | |
| 135 | ++------------------------------+--------------------------------------------------+-------------------------+ |
| 136 | +| prompt_cache_path | Path to prompt cache | ./prompt_cache.db | |
| 137 | ++------------------------------+--------------------------------------------------+-------------------------+ |
| 138 | +| session_cache_folder_location| Path to session cache | ./session_cache_folder | |
| 139 | ++------------------------------+--------------------------------------------------+-------------------------+ |
| 140 | +| max_past_message_include | Maximum number of past messages to include | 10 | |
| 141 | ++------------------------------+--------------------------------------------------+-------------------------+ |
| 142 | + |
0 commit comments