docs: Config Docs Update (#148)

* 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>
This commit is contained in:
cyncyw
2024-08-02 15:49:58 +08:00
committed by GitHub
parent c6bf4e5015
commit 7adade22bf
6 changed files with 184 additions and 92 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ class RDAgentSettings(BaseSettings):
log_trace_path: str | None = None
log_llm_chat_content: bool = True
use_azure: bool = True
use_azure: bool = False
use_azure_token_provider: bool = False
managed_identity_client_id: str | None = None
max_retry: int = 10
@@ -48,7 +48,7 @@ class RDAgentSettings(BaseSettings):
chat_token_limit: int = (
100000 # 100000 is the maximum limit of gpt4, which might increase in the future version of gpt
)
default_system_prompt: str = "You are an AI assistant who helps to answer user's questions about finance."
default_system_prompt: str = "You are an AI assistant who helps to answer user's questions."
# Embedding configs
embedding_openai_api_key: str = ""
+15 -8
View File
@@ -298,14 +298,21 @@ class APIBackend:
self.use_azure_token_provider = self.cfg.use_azure_token_provider
self.managed_identity_client_id = self.cfg.managed_identity_client_id
if self.cfg.openai_api_key:
self.chat_api_key = self.cfg.openai_api_key
self.embedding_api_key = self.cfg.openai_api_key
else:
self.chat_api_key = self.cfg.chat_openai_api_key if chat_api_key is None else chat_api_key
self.embedding_api_key = (
self.cfg.embedding_openai_api_key if embedding_api_key is None else embedding_api_key
)
# Priority: chat_api_key/embedding_api_key > openai_api_key > os.environ.get("OPENAI_API_KEY")
# TODO: Simplify the key design. Consider Pandatic's field alias & priority.
self.chat_api_key = (
chat_api_key
or self.cfg.chat_openai_api_key
or self.cfg.openai_api_key
or os.environ.get("OPENAI_API_KEY")
)
self.embedding_api_key = (
embedding_api_key
or self.cfg.embedding_openai_api_key
or self.cfg.openai_api_key
or os.environ.get("OPENAI_API_KEY")
)
self.chat_model = self.cfg.chat_model if chat_model is None else chat_model
self.encoder = tiktoken.encoding_for_model(self.chat_model)
self.chat_api_base = self.cfg.chat_azure_api_base if chat_api_base is None else chat_api_base