Skip to content

[Inference] Fix sentence-similarity inputs #1316

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

Merged
merged 2 commits into from
Mar 27, 2025
Merged

Conversation

hanouticelina
Copy link
Contributor

This was broken before because one of the input parameters was incorrectly being sent as part of the parameters object instead of the inputs, this PR fixes that.

import { InferenceClient } from "@huggingface/inference";

const client = new InferenceClient("hf_xxxxxxxxxxxxxxxxxxxxxxxx");

const output = await client.sentenceSimilarity({
	model: "sentence-transformers/all-MiniLM-L6-v2",
	inputs: {
	"source_sentence": "That is a happy person",
	"sentences": [
		"That is a happy dog",
		"That is a very happy person",
		"Today is a sunny day"
	]
},
	provider: "hf-inference",
});

console.log(output);

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

nice catch lol

@hanouticelina hanouticelina merged commit ba6e1a8 into main Mar 27, 2025
5 checks passed
@hanouticelina hanouticelina deleted the fix-sentence-similarity branch March 27, 2025 12:23
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