Skip to content

Commit

Permalink
CI: shorter line
Browse files Browse the repository at this point in the history
  • Loading branch information
taozhiwang committed Aug 2, 2024
1 parent fc516f2 commit 0d02463
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions rdagent/oai/llm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,18 @@ def __init__( # noqa: C901, PLR0912, PLR0915
self.managed_identity_client_id = self.cfg.managed_identity_client_id

# Priority: chat_api_key/embedding_api_key > openai_api_key > os.environ.get("OPENAI_API_KEY")
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_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)
Expand Down

0 comments on commit 0d02463

Please sign in to comment.