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

Example Code for Virtual Threads, Pipelinining, and AI Vector Search #372

Merged

Conversation

Michael-A-McMahon
Copy link
Member

This branch adds a demo program which makes use of the following:

  • Virtual Threads
  • Structured Concurrency
  • Pipelined Database Calls
  • Generative AI from Oracle Cloud
  • AI Vector Search with Oracle Database

The demo program will load a database table with text from a book full of facts about wild animals (the book is public domain). It will then query the text from the table, request embeddings for the text from OCI's Generative AI service, and store the embeddings back in the table as VECTOR data. Finally, it will perform a similarity search for some search terms using the VECTOR_DISTANCE function.

All steps of the program are executed using pipelined database calls on virtual threads. The virtual threads are managed using structured concurrency APIs which are being previewed in JDK 22.

Instructions for running the demo have been added to the README.

Signed-off-by: Michael McMahon <michael.a.mcmahon@oracle.com>
Signed-off-by: Michael McMahon <michael.a.mcmahon@oracle.com>
Signed-off-by: Michael McMahon <michael.a.mcmahon@oracle.com>
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 8, 2024
@Michael-A-McMahon
Copy link
Member Author

Fixes #371

@gvenzl gvenzl requested review from Kuassim and jeandelavarene July 8, 2024 21:11
Copy link
Contributor

@Kuassim Kuassim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume no tab but 2 spaces indentation (per level).


/**
* Updates the example table with embeddings for it's text data. This method
* uses the structured concurrency API (preview feature in JDK 22). Calls to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's preview feature of JDK21, isn't?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need JDK22 for the "Gatherers".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected in latest push. Elaborated that structured concurrency has been in preview since 21, and continues to be in the upcoming 23 release.
Also, Gatherers are previewed in 22 and 23. I wanted to keep the focus on structured concurrency though. We could implement this demo without gatherers if we wanted to.

Signed-off-by: Michael McMahon <michael.a.mcmahon@oracle.com>
@jeandelavarene jeandelavarene merged commit 36e60b0 into oracle-samples:main Jul 10, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants