neo4j-graphrag-python icon indicating copy to clipboard operation
neo4j-graphrag-python copied to clipboard

Can't specifiy the dimensions on AzureOpenAIEmbeddings

Open xpilasneo4j opened this issue 5 months ago • 0 comments

When trying to put the documented parameter dimensions in the constructor, I get an error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[25], line 1
----> 1 embeddings2048=AzureOpenAIEmbeddings(model=config.get('Neo4j','azure_open_ai_emb_model'),
      2                                  api_version=config.get('Neo4j','azure_open_ai_emb_version'),
      3                                     dimensions=2048)

File [~\AppData\Roaming\Python\Python313\site-packages\neo4j_graphrag\embeddings\openai.py:44](http://localhost:8888/lab/tree/~/AppData/Roaming/Python/Python313/site-packages/neo4j_graphrag/embeddings/openai.py#line=43), in BaseOpenAIEmbeddings.__init__(self, model, **kwargs)
     42 self.openai = openai
     43 self.model = model
---> 44 self.client = self._initialize_client(**kwargs)

File [~\AppData\Roaming\Python\Python313\site-packages\neo4j_graphrag\embeddings\openai.py:92](http://localhost:8888/lab/tree/~/AppData/Roaming/Python/Python313/site-packages/neo4j_graphrag/embeddings/openai.py#line=91), in AzureOpenAIEmbeddings._initialize_client(self, **kwargs)
     91 def _initialize_client(self, **kwargs: Any) -> Any:
---> 92     return self.openai.AzureOpenAI(**kwargs)

TypeError: AzureOpenAI.__init__() got an unexpected keyword argument 'dimensions'

xpilasneo4j avatar Aug 04 '25 05:08 xpilasneo4j