Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Embeddings support in the SDK#1475

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
levkk merged 3 commits intomasterfromlevkk-pgml-embed-sdk
May 22, 2024
Merged

Embeddings support in the SDK#1475

levkk merged 3 commits intomasterfromlevkk-pgml-embed-sdk
May 22, 2024

Conversation

levkk
Copy link
Contributor

SDK

  1. Addedpgml.embed() support intoBuiltins, with single and batch mode.

@levkklevkk requested a review fromSilasMarvinMay 22, 2024 16:17
.map(|v| {
v.as_str()
.with_context(|| "only text embeddings are supported")
.unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

You can collect into aResult<Vec<_>> so you can? theResult instead of panicking if the value is not astr.

Copy link
Contributor

Choose a reason for hiding this comment

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

Something like

let texts = texts.0.as_array().with_context(||"embed_batch takes an array of texts")?.iter().map(|v|{                v.as_str().with_context(||"only text embeddings are supported").map(|s| s.to_string())}).collect::<anyhow::Result<Vec<String>>>()?;

I think will work.

SilasMarvin reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I don't think we want that. The API accepts an array of strings, so if someone passes in an array of objects that can be cast to a string, they will get embeddings of integers, or whatever else they passed in, which will make them think that everything is fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

We are still callingas_str here so if it was an object, it wouldn't be treated as a string. I was merely suggesting usingResult::Err instead ofunwrap. But all is good.

katopz reacted with thumbs up emoji
@SilasMarvin
Copy link
Contributor

SilasMarvin commentedMay 22, 2024
edited
Loading

A test for both in Rust, Python, and JavaScript would be nice

levkk reacted with thumbs up emoji

@levkk
Copy link
ContributorAuthor

A test for both in Rust, Python, and JavaScript would be nice

Do these tests run in CI or only locally? They require a PostgresML installation to be running somewhere right?

@levkk
Copy link
ContributorAuthor

I can't seem to find instructions for setting up the JS environment for testing this. I did the Python one from memory, but it would be nice to have a short README for developers. I'm going to skip the JS tests for now and come back to them when I have a moment.

@levkklevkk merged commit03ca54e intomasterMay 22, 2024
@levkklevkk deleted the levkk-pgml-embed-sdk branchMay 22, 2024 17:16
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kczimmkczimmkczimm left review comments

@SilasMarvinSilasMarvinAwaiting requested review from SilasMarvin

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@levkk@SilasMarvin@kczimm

[8]ページ先頭

©2009-2025 Movatter.jp