Skip to main content
Weaviate Docs (migrated from docs.weaviate.io) Docs

Search documentation

Type to search this documentation.

On this pageOverview

Generative and reranker models

Configure a reranker model integration for reranking retrieved results.

Python
from weaviate.classes.config import Configure, Property, DataTypeclient.collections.create(    "Article",    vector_config=Configure.Vectors.text2vec_openai(),    reranker_config=Configure.Reranker.cohere(),)
JavaScript/TypeScript
import { vectors, reranker } from 'weaviate-client';
Go
articleClass := &models.Class{
  Class:       "Article",
  Description: "Collection of articles",
  Vectorizer:  "text2vec-openai",
  ModuleConfig: map[string]interface{}{
    "reranker-cohere": map[string]interface{}{
      "model": "rerank-v3.5",
    },
  },
}
Java
client.collections.create("Article",
    col -> col.vectorConfig(VectorConfig.text2vecTransformers())
        .rerankerModules(Reranker.cohere())
        .properties(Property.text("title")));
C#
await client.Collections.Create(
    new CollectionCreateParams
    {
        Name = "Article",
        VectorConfig = Configure.Vector("default", v => v.Text2VecTransformers()),
        RerankerConfig = Configure.Reranker.Cohere(),
        Properties = [Property.Text("title")],
    }
);

Update the reranker model integration for reranking retrieved results.

Python
from weaviate.classes.config import Reconfigurecollection = client.collections.use("Article")collection.config.update(    reranker_config=Reconfigure.Reranker.cohere()  # Update the reranker module)
JavaScript/TypeScript
import { reconfigure } from 'weaviate-client';
Go
updatedArticleClassConfig := &models.Class{
  // Note: The new collection config must be provided in full,
  // including the configuration that is not being updated.
  // We suggest using the original class config as a starting point.
  Class: "Article",
  ModuleConfig: map[string]interface{}{
    "reranker-cohere": map[string]interface{}{
      "model": "rerank-v3.5",
    },
  },
}
Java
var collection = client.collections.use("Article");
collection.config.update(col -> col.rerankerModules(Reranker.cohere()));
C#
var collection = client.Collections.Use("Article");
await collection.Config.Update(c =>
{
    c.RerankerConfig = Configure.Reranker.Cohere();
});

Specify a generative model integration for a collection (for RAG).

Python
from weaviate.classes.config import Configure, Property, DataTypeclient.collections.create(    "Article",    vector_config=Configure.Vectors.text2vec_openai(),    generative_config=Configure.Generative.openai(        model="gpt-4o"  # set your generative model (optional parameter)    ),)
JavaScript/TypeScript
import { vectors, generative } from 'weaviate-client';
Go
articleClass := &models.Class{
  Class:       "Article",
  Description: "Collection of articles",
  Vectorizer:  "text2vec-openai",
  ModuleConfig: map[string]interface{}{
    "generative-openai": map[string]interface{}{
      "model": "gpt-4o",
    },
  },
}
Java
client.collections.create("Article",
    col -> col.vectorConfig(VectorConfig.text2vecTransformers())
        .generativeModule(Generative.cohere())
        .properties(Property.text("title")));
C#
await client.Collections.Create(
    new CollectionCreateParams
    {
        Name = "Article",
        VectorConfig = Configure.Vector("default", v => v.Text2VecTransformers()),
        GenerativeConfig = Configure.Generative.Cohere(),
        Properties = [Property.Text("title")],
    }
);

Update a generative model integration.

Python
from weaviate.classes.config import Reconfigurecollection = client.collections.use("Article")collection.config.update(    generative_config=Reconfigure.Generative.cohere()  # Update the generative module)
JavaScript/TypeScript
import { reconfigure } from 'weaviate-client';
Go
updatedArticleClassConfig := &models.Class{
  Class: "Article",
  ModuleConfig: map[string]interface{}{
    "generative-cohere": map[string]interface{}{},
  },
}
Java
var collection = client.collections.use("Article");
collection.config.update(col -> col.generativeModule(Generative.cohere()));
C#
var collection = client.Collections.Use("Article");
await collection.Config.Update(c =>
{
    c.GenerativeConfig = Configure.Generative.Cohere();
});

Have a question or feedback? Here's how to reach us.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu