We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc2d49d commit 508a033Copy full SHA for 508a033
openevolve/embedding.py
@@ -40,7 +40,10 @@ def __init__(
40
41
def _get_client_model(self, model_name: str) -> tuple[openai.OpenAI, str]:
42
if model_name in OPENAI_EMBEDDING_MODELS:
43
- client = openai.OpenAI()
+ # Use OPENAI_EMBEDDING_API_KEY if set, otherwise fall back to OPENAI_API_KEY
44
+ # This allows users to use OpenRouter for LLMs while using OpenAI for embeddings
45
+ embedding_api_key = os.getenv("OPENAI_EMBEDDING_API_KEY") or os.getenv("OPENAI_API_KEY")
46
+ client = openai.OpenAI(api_key=embedding_api_key)
47
model_to_use = model_name
48
elif model_name in AZURE_EMBEDDING_MODELS:
49
# get rid of the azure- prefix
0 commit comments