freedmand / semantra

Multi-tool for semantic search
MIT License
2.52k stars 140 forks source link

Request to Update OpenAI Implementation to Support New API Schema #71

Open nikolas-rauscher opened 8 months ago

nikolas-rauscher commented 8 months ago

I have encountered an issue related to the OpenAI model. The problem arises because the current implementation relies on the outdated OpenAI API schema, which is not supported in versions of the openai library greater than 1.0.0.

The recent versions of the OpenAI API have deprecated the openai.Embedding interface, which the code currently relies on. This results in the following error when attempting to use the feature:

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`

A detailed migration guide is available here: https://github.com/openai/openai-python/discussions/742

Are there plans to update this?

yych42 commented 8 months ago

I was planning to implement text-embedding-3 support this weekend, so I’ll take a look at this too.

yych42 commented 5 months ago

@nikolas-rauscher I have a new commit to close this issue with additional support for the new embedding model, but I can't seem to figure out why the web UI didn't start correctly. Can you see if you have the same issue on your device? Any input is appreciated.

kintopp commented 5 months ago

I had the same problem after cloning the repo and then applying the patch. I was able to work around it by installing a clean copy of Semantra v. 0.1.10 with pipx and then manually replacing models.py with the updated version in its venv sub-directory. This is on OSX v14.5 with openai 1.30.5, installed using Python 3.11.9. I'm not a developer, so please let me know if I can provide more/better details. And thanks so much for creating Semantra!

yych42 commented 5 months ago

I had the same problem after cloning the repo and then applying the patch. I was able to work around it by installing a clean copy of Semantra v. 0.1.10 with pipx and then manually replacing models.py with the updated version in its venv sub-directory. This is on OSX v14.5 with openai 1.30.5, installed using Python 3.11.9. I'm not a developer, so please let me know if I can provide more/better details. And thanks so much for creating Semantra!

I will give this a try and report back. I'm not the author of this app tho! Credits to @freedmand