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

Embeddings return 404 error #85

Open
RuofengX opened this issue Nov 8, 2024 · 3 comments
Open

Embeddings return 404 error #85

RuofengX opened this issue Nov 8, 2024 · 3 comments

Comments

@RuofengX
Copy link

RuofengX commented Nov 8, 2024

let url = format!("{}api/embed", self.url_str());

Seems like ollama has change the url endpoint to /api/embeddings.

ollama version: 0.1.44

@boydjohnson
Copy link
Contributor

boydjohnson commented Dec 11, 2024

https://github.com/ollama/ollama/blob/main/docs/api.md#generate-embeddings The current main on Ollama shows api/embed as the endpoint.

A blog post from April 2024 says api/embeddings but the current docs say api/embed.

I just did a local test and you appear to be right. I just did a local test and for llama2:latest they both returned 200s but behaved differently.

@boydjohnson
Copy link
Contributor

From the Ollama go api client:

// Embed generates embeddings from a model.
func (c *Client) Embed(ctx context.Context, req *EmbedRequest) (*EmbedResponse, error) {
        var resp EmbedResponse
        if err := c.do(ctx, http.MethodPost, "/api/embed", req, &resp); err != nil {
                return nil, err
        }
        return &resp, nil
}

// Embeddings generates an embedding from a model.
func (c *Client) Embeddings(ctx context.Context, req *EmbeddingRequest) (*EmbeddingResponse, error) {
        var resp EmbeddingResponse
        if err := c.do(ctx, http.MethodPost, "/api/embeddings", req, &resp); err != nil {
                return nil, err
        }
        return &resp, nil
}

They are both valid api endpoints.

@boydjohnson
Copy link
Contributor

ollama/ollama#7490 (comment)
says
/api/embeddings is deprecated, use /api/embed. The reason the returned embedding is empty is because /api/embeddings uses prompt not input for the text to process.

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

No branches or pull requests

2 participants