From 4dc5c7348fe662daef0c015388df2604a7b69a9d Mon Sep 17 00:00:00 2001 From: Deshraj Yadav Date: Tue, 5 Mar 2024 14:07:44 -0800 Subject: [PATCH] [Bug fix]: Fix issue of OPENAI_API_BASE env variable being mandatory (#1305) --- README.md | 16 ++++++---------- embedchain/embedder/openai.py | 2 +- pyproject.toml | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 23b3e3992f..c103e06bc2 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,6 @@ Embedchain Logo

-

- ROSS Index - Fastest Growing Open-Source Startups in Q3 2023 | Runa Capital -

-

PyPI @@ -64,15 +60,15 @@ import os from embedchain import App # Create a bot instance -os.environ["OPENAI_API_KEY"] = "YOUR API KEY" -elon_bot = App() +os.environ["OPENAI_API_KEY"] = "" +app = App() # Embed online resources -elon_bot.add("https://en.wikipedia.org/wiki/Elon_Musk") -elon_bot.add("https://www.forbes.com/profile/elon-musk") +app.add("https://en.wikipedia.org/wiki/Elon_Musk") +app.add("https://www.forbes.com/profile/elon-musk") -# Query the bot -elon_bot.query("How many companies does Elon Musk run and name those?") +# Query the app +app.query("How many companies does Elon Musk run and name those?") # Answer: Elon Musk currently runs several companies. As of my knowledge, he is the CEO and lead designer of SpaceX, the CEO and product architect of Tesla, Inc., the CEO and founder of Neuralink, and the CEO and founder of The Boring Company. However, please note that this information may change over time, so it's always good to verify the latest updates. ``` diff --git a/embedchain/embedder/openai.py b/embedchain/embedder/openai.py index ad2f068cff..88a875c743 100644 --- a/embedchain/embedder/openai.py +++ b/embedchain/embedder/openai.py @@ -17,7 +17,7 @@ def __init__(self, config: Optional[BaseEmbedderConfig] = None): self.config.model = "text-embedding-ada-002" api_key = self.config.api_key or os.environ["OPENAI_API_KEY"] - api_base = self.config.api_base or os.environ["OPENAI_API_BASE"] + api_base = self.config.api_base or os.environ.get("OPENAI_API_BASE") if self.config.deployment_name: embeddings = AzureOpenAIEmbeddings(deployment=self.config.deployment_name) diff --git a/pyproject.toml b/pyproject.toml index 4f7cb3c71e..3f8681b21c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "embedchain" -version = "0.1.93" +version = "0.1.94" description = "Simplest open source retrieval(RAG) framework" authors = [ "Taranjeet Singh ",