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 example #27

Merged
merged 2 commits into from
Feb 28, 2023
Merged

update embeddings example #27

merged 2 commits into from
Feb 28, 2023

Conversation

ADefWebserver
Copy link
Collaborator

No description provided.

An embeddings example that will actually work
@@ -237,7 +237,8 @@ Creates an embedding vector representing the input text.

```csharp
var api = new OpenAIClient();
var result = await api.EmbeddingsEndpoint.CreateEmbeddingAsync("The food was delicious and the waiter...");
var model = await api.ModelsEndpoint.GetModelDetailsAsync("text-embedding-ada-002");
var result = await api.EmbeddingsEndpoint.CreateEmbeddingAsync("The food was delicious and the waiter...", model);
Copy link
Member

Choose a reason for hiding this comment

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

@ADefWebserver did you have trouble with the default model it's trying to use?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What did not work was:

var result = await api.EmbeddingsEndpoint.CreateEmbeddingAsync("The food was delicious and the waiter...", Model.Ada)

It took me awhile to figure out how I could follow the directions from here: https://openai.com/blog/new-and-improved-embedding-model and use this library. So it's not an 'error' just a 'clarification'.

Also, I spent a week coming up with an end-to-end embeddings example: https://github.com/SyncfusionSuccinctlyE-Books/OpenAI-Succinctly/blob/main/Pages/EmbeddingExample.razor

Copy link
Member

Choose a reason for hiding this comment

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

Very cool!

Thanks for the feedback. I think a good proper solution might be to add some additional checks in the method to ensure the model is right for embedding, and also adding more default static models to the Model class.

Thanks for the updated documentation, I'll knock out the other stuff later. Cheers!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you added the checks for the model embedding, what will happen if OpenAI changes things? Also, embeddings are cool, but, for me, were hard to understand. My sample is MIT license so use whatever you need for your samples if you feel they can help others :)

Copy link
Member

Choose a reason for hiding this comment

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

I may add in future. Have not added anything yet. OpenAI will just tell you which one to use.

@StephenHodgson StephenHodgson merged commit 86e051f into RageAgainstThePixel:main Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants