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

Refactor EmbeddingsResponse to Support Multiple Embeddings #85

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ThaKladd
Copy link

@ThaKladd ThaKladd commented Dec 4, 2024

Updates the embeddings endpoint usage to handle responses containing multiple embeddings from the OpenAI API, as this is how it works as of OpenAi Embeddings docs. Previously, the implementation only supported a single embedding, and it adds network overhead when dealing with multiple chunks.

What changed:

  • fromInput method on Prism::embeddings() accepts array as input
  • $response->embeddings is always an array of arrays, meaning if a text is sent in, to retrieve it would be in $response->embeddings[0]

Considerations:

  • I considered the possibility of adding a first() method, so that it works similar as to Laravels eloquent, but decided to follow the standard set forth by existing code

Copy link

netlify bot commented Dec 4, 2024

Deploy Preview for stunning-cannoli-238aa5 ready!

Name Link
🔨 Latest commit 0ea94e4
🔍 Latest deploy log https://app.netlify.com/sites/stunning-cannoli-238aa5/deploys/67507eb09d4c370008afa10b
😎 Deploy Preview https://deploy-preview-85--stunning-cannoli-238aa5.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@pushpak1300
Copy link
Contributor

pushpak1300 commented Dec 4, 2024

I'm not sure if @sixlive wants to support this feature yet.
#72 (review)

6c94422

@ThaKladd
Copy link
Author

ThaKladd commented Dec 4, 2024

Ah. Now I saw the comment made on the Mistral Embeddig PR. 😅 Should have looked closer.

@sixlive
Copy link
Contributor

sixlive commented Dec 4, 2024

I don't know, if this is the second time being brought up, maybe I should reconsider 🤔

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.

3 participants