Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add oci gen ai support #133

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

adrianotanaka
Copy link

Adding support to OCI Gen AI Services https://www.oracle.com/artificial-intelligence/generative-ai/generative-ai-service/

Just two simple functions:
oci_list_models -> Returns available model per region/compartment
oci_embed -> Return a vector from a string

@CLAassistant
Copy link

CLAassistant commented Oct 17, 2024

CLA assistant check
All committers have signed the CLA.

@smoya
Copy link
Contributor

smoya commented Oct 28, 2024

Hi @adrianotanaka, sorry for the delay on this PR.
We have been in focus mode but we will be reviewing this shortly. 🙏

@adrianotanaka
Copy link
Author

Thanks @smoya , please let me know if I can help with anything.

@alejandrodnm
Copy link
Contributor

alejandrodnm commented Nov 24, 2024

Hey @adrianotanaka I'm really sorry for the late response. We were on focus mode for the vectorizer work. We are also figuring and add more structure to the way we want to interact with the community, and how to handle, contributions. Expect some new guides, and guidelines coming soon.

Regarding your PR. You should not put SQL code directly in the ai--0.3.0--0.4.0.sql file. You need to add a new file projects/extension/sql/idempotemp/015-oci.sql, add your functions there. This is explained in:

https://github.com/timescale/pgai/blob/main/DEVELOPMENT.md#develop-sql-in-the-pgai-extension

Give it a read, and please if you have any feedback please share.

Since you're importing the oci package, you need to follow the guidelines Develop Python in the pgai extension
, basically you need to add oci as a dependency in the requirementes.txt file:

https://github.com/timescale/pgai/blob/main/projects/extension/requirements.txt

And add #ADD-PYTHON-LIB-DIR as a header in your functions before the import oci, see an example from openAI's embed function:

https://github.com/timescale/pgai/blob/main/projects/extension/sql/idempotent/001-openai.sql#L70

Once you have that, run just ext build-sql and that will generate some sql files like ai--0.4.2-dev.sql, and the upgrades from all the old versions to the new version ai--0.4.1--0.4.2.sql, .... For some reason, might be a bug, or by design, these files are gitignored, you'd need to manually add them to your changes. This files are gitignored, they are not added to the PR to prevent handling merge conflicts on every merge. On release the final extension files will be generated and publish.

Last thing (I think), you need to add some tests for the code, some docs about it:

https://github.com/timescale/pgai/blob/main/projects/extension/sql/idempotent/001-openai.sql#L70

And you can follow the openAI's tests as a guide:

https://github.com/timescale/pgai/blob/main/projects/extension/tests/test_openai.py

Hope this helps, and sorry again for the late response.

@JamesGuthrie JamesGuthrie requested a review from a team as a code owner December 10, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants