Repository: Giskard-AI/giskard-oss
Issue: AttributeError: module 'giskard.llm' has no attribute 'embeddings'
Root cause: Documentation Deficiency

### Issue Type

Bug

### Source

source

### Giskard Library Version

2.15.5

### OS Platform and Distribution

Macos 14

### Python version

3.11

### Installed python packages

_No response_

### Current Behaviour?

```shell
giskard.llm.embeddings.openai.set_embedding_model('text-embedding-ada-002')
    ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'giskard.llm' has no attribute 'embeddings'
```


### Standalone code OR list down the steps to reproduce the issue

```shell
import openai
import pandas as pd
import tiktoken
from scipy import spatial

from giskard import scan, Dataset, Model

giskard.llm.set_llm_model('gpt-4o-mini')
giskard.llm.embeddings.openai.set_embedding_model('text-embedding-ada-002')
```


### Relevant log output

_No response_

okey, apparently there is a PR that was merged 45min ago

https://github.com/Giskard-AI/giskard/pull/2074

edit : still doesn't work



Hey @AmineDjeghri !
Thanks for reporting this.

Could you try running this code:

```
from giskard.llm.embeddings.openai import set_embedding_model
set_embedding_model('text-embedding-ada-002')
```

for an unknown reason, it seems that `giskard.llm.embeddings.openai.set_embedding_model` is not working directly. I'll investigate further to see the cause of this. In the meanwhile, the previous code snippet should work.

Hey
thanks it works


Do you know if the doc is deprecated ?
https://docs.giskard.ai/en/latest/reference/notebooks/LLM_QA_Winter_Olympics.html

i found this code and it seems that it doesn't work :


```
    query_embedding_response = openai.Embedding.create(model=EMBEDDING_MODEL, input=query)
    query_embedding = query_embedding_response["data"][0]["embedding"]
```
    
```
Traceback (most recent call last):
  File "/Users/aminedjeghri/PycharmProjects/ai-cloud-project-template/temp.py", line 102, in <module>
    ask('Which athletes won the gold medal in curling at the 2022 Winter Olympics?')
  File "/Users/aminedjeghri/PycharmProjects/ai-cloud-project-template/temp.py", line 83, in ask
    message = query_message(query, db, model=model, token_budget=token_budget)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/aminedjeghri/PycharmProjects/ai-cloud-project-template/temp.py", line 63, in query_message
    strings, _ = strings_ranked_by_relation(query, db)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/aminedjeghri/PycharmProjects/ai-cloud-project-template/temp.py", line 40, in strings_ranked_by_relation
    query_embedding_response = openai.Embedding.create(model=EMBEDDING_MODEL, input=query)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/aminedjeghri/PycharmProjects/ai-cloud-project-template/.venv/lib/python3.11/site-packages/openai/lib/_old_api.py", line 39, in __call__
    raise APIRemovedInV1(symbol=self._symbol)
openai.lib._old_api.APIRemovedInV1: 

You tried to access openai.Embedding, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.

You can run `openai migrate` to automatically upgrade your codebase to use the 1.0.0 interface. 

Alternatively, you can pin your installation to the old version, e.g. `pip install openai==0.28`
```

Hey @henchaves - Can this issue be closed thanks to the latest release?

@AmineDjeghri yes, might be... I'll be reviewing soon all notebooks we have to make sure they are using the most up-to-dates libs such as OpenAI and RAGAS. Thanks!

@alexcombessie Yes, thanks! 


Closing this issue because release v2.16.0 changes they way of setting an embedding model.