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

Update Embeddings.ipynb to show output_dimenstionality parameter. #82

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

Conversation

shilpakancharla
Copy link
Collaborator

No description provided.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

quickstarts/Embeddings.ipynb Outdated Show resolved Hide resolved
quickstarts/Embeddings.ipynb Show resolved Hide resolved
quickstarts/Embeddings.ipynb Show resolved Hide resolved
quickstarts/Embeddings.ipynb Show resolved Hide resolved
quickstarts/Embeddings.ipynb Show resolved Hide resolved
@@ -35,18 +35,34 @@
},
Copy link
Member

@markmcd markmcd Apr 19, 2024

Choose a reason for hiding this comment

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

Line #12.        output_dimensionality=10)

It sounds like this change is to add this parameter but it's hidden in this code snippet comparing task types without explanation.

Maybe add a section after this block with a short note? e.g.:

## Truncating embeddings

The text-embedding-004 model also supports lower embedding dimensions. Specify output_dimensionality to truncate the output.


`
result1 = genai.embed_content(
    model="models/text-embedding-004",
    content="Hello world)


result2 = genai.embed_content(
    model="models/text-embedding-004",
    content="Hello world",
    output_dimensionality=10)


(len(result1), len(result2))
`

Can we talk about the relationship between the index and specificity? It'd be great to add a statement like "When using text-embedding-004, each dimension adds diminishing value so truncating may be effective in constrained environments ." - but I haven't verified if this is true.


Reply via ReviewNB

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@markmcd I haven't verified it either but I think it would be a great add! @MarkDaoust what do you think?

@@ -35,18 +35,34 @@
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Use output_dimensionality=4 here

Include a comment explaining it.


Reply via ReviewNB

Copy link
Contributor

Choose a reason for hiding this comment

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

(That way you wouldn't need the '... trimmed')

quickstarts/Embeddings.ipynb Show resolved Hide resolved
quickstarts/Embeddings.ipynb Show resolved Hide resolved
Copy link
Member

Thanks for the updates! I made a couple quick changes and committed an updated version of this notebook for an event today. (Sorry if that makes this PR out of sync, working quickly from a coffee shop), we can iterate and refine from there.

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.

None yet

4 participants