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 processors for generating embeddings, adding context to docs, submitting prompts #2008

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

hariso
Copy link
Contributor

@hariso hariso commented Dec 11, 2024

Description

Depends on: https://github.com/conduitio-labs/conduit-connector-weaviate/tree/haris/different-vectors.

Quick checks

  • I have followed the Code Guidelines.
  • There is no other pull request for the same update/change.
  • I have written unit tests.
  • I have made sure that the PR is of reasonable size and can be easily reviewed.

type embeddingProcConfig struct {
APIKey string `json:"apiKey" validate:"required"`
Endpoint string `json:"endpoint" default:"https://api.openai.com/v1"`
Model string `json:"model" validate:"required,inclusion=gpt-4|gpt-4-turbo|gpt-3.5-turbo|text-davinci-003|text-davinci-002|text-curie-001|text-babbage-001|text-ada-001"`
Copy link
Contributor

Choose a reason for hiding this comment

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

so these are not embeddings models?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I was too quick to copy-paste all the models.:)

Msg("got embeddings")

for i, record := range records {
record.Metadata[EmbeddingMetadataBase64] = embeddings.Data[i].EmbeddingBase64
Copy link
Contributor

Choose a reason for hiding this comment

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

These can be horribly large, my suggestion here is to:

  1. add the embedding to .Payload.After
  2. include the model name used for the embedding.

Particularly 2, since there are others openai compat systems which may allow for different models to be used.

Copy link
Contributor

Choose a reason for hiding this comment

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

Additionally, these can be very large (depending on the model) and I find that you can reduce the size of them with compression. All floats too. Base64 will not be very compressible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, especially about no. 2. As for 1, that would also mean that raw data records get transformed into structured data records. That might be unexpected for some destinations.

@hariso hariso changed the title OpenAI embeddings processor Add processors for generating embeddings, adding context to docs, submitting prompts Dec 13, 2024
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.

2 participants