Quantcast
Channel: Weaviate Community Forum - Latest posts
Viewing all articles
Browse latest Browse all 3588

Use ollama embeddings hosted on a server using weaviate

$
0
0

Description

I have setup ollama on a GCP server and exposed it as url. It is accesible through ollama client with AUTH token. Here is sample code:

from ollama import Client
try:
      MODEL_NAME = "nomic-embed-text:latest"
      client = Client(
        host='https://ollama-inferece-url',
        headers={'Authorization': AUTH_TOKEN}
      )
      text = "Hello, this is a test sentence."
      response = client.embeddings(
        model=MODEL_NAME,
        prompt=text
      )

      # Extract embeddings from response
      embedding = response['embedding']
      print(embedding)
      print(f"Single embedding shape: {len(embedding)}")

except Exception as e:
        print(f"Error generating: {e}")

I want to integrate this ollama embeddings with weaviate. Can you provide some sample code or reference for this?

Server Setup Information

  • Weaviate Server Version: 1.28.0
  • Deployment Method:docker
  • Multi Node? Number of Running Nodes: 1
  • Client Language and Version: Python 3.8
  • Multitenancy?: No

Viewing all articles
Browse latest Browse all 3588

Trending Articles