This is an automated email from the ASF dual-hosted git repository.
jin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-ai.git
The following commit(s) were added to refs/heads/main by this push:
new 2441d2b fix(llm): use empty str for llm config (#155)
2441d2b is described below
commit 2441d2bdbe1b4c7ed515f168aaba761488dcb7d3
Author: chenzihong <[email protected]>
AuthorDate: Wed Jan 8 17:35:54 2025 +0800
fix(llm): use empty str for llm config (#155)
TODO: we should better reuse the LLM API/configs
---
hugegraph-llm/src/hugegraph_llm/models/embeddings/openai.py | 1 +
hugegraph-llm/src/hugegraph_llm/models/llms/openai.py | 1 +
2 files changed, 2 insertions(+)
diff --git a/hugegraph-llm/src/hugegraph_llm/models/embeddings/openai.py
b/hugegraph-llm/src/hugegraph_llm/models/embeddings/openai.py
index 1665817..aacef1e 100644
--- a/hugegraph-llm/src/hugegraph_llm/models/embeddings/openai.py
+++ b/hugegraph-llm/src/hugegraph_llm/models/embeddings/openai.py
@@ -28,6 +28,7 @@ class OpenAIEmbedding:
api_key: Optional[str] = None,
api_base: Optional[str] = None
):
+ api_key = api_key or ''
self.client = OpenAI(api_key=api_key, base_url=api_base)
self.aclient = AsyncOpenAI(api_key=api_key, base_url=api_base)
self.embedding_model_name = model_name
diff --git a/hugegraph-llm/src/hugegraph_llm/models/llms/openai.py
b/hugegraph-llm/src/hugegraph_llm/models/llms/openai.py
index a073882..a020067 100644
--- a/hugegraph-llm/src/hugegraph_llm/models/llms/openai.py
+++ b/hugegraph-llm/src/hugegraph_llm/models/llms/openai.py
@@ -42,6 +42,7 @@ class OpenAIClient(BaseLLM):
max_tokens: int = 4096,
temperature: float = 0.0,
) -> None:
+ api_key = api_key or ''
self.client = OpenAI(api_key=api_key, base_url=api_base)
self.aclient = AsyncOpenAI(api_key=api_key, base_url=api_base)
self.model = model_name