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

Ollama and module config example #48

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 46 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ client.schema.create(
"name": "category"
}
],
# Possible values: 'text2vec-cohere', 'text2vec-openai', 'text2vec-huggingface', 'text2vec-transformers', 'text2vec-contextionary', 'img2vec-neural', 'multi2vec-clip', 'ref2vec-centroid'
# Possible values: 'text2vec-cohere', 'text2vec-ollama', 'text2vec-openai', 'text2vec-huggingface', 'text2vec-transformers', 'text2vec-contextionary', 'img2vec-neural', 'multi2vec-clip', 'ref2vec-centroid'
vectorizer: "text2vec-openai"
)

Expand All @@ -76,9 +76,6 @@ client.schema.get(class_name: 'Question')
# Get the schema
client.schema.list()

# Remove a class (and all data in the instances) from the schema.
client.schema.delete(class_name: 'Question')

# Update settings of an existing schema class.
# Does not support modifying existing properties.
client.schema.update(
Expand All @@ -97,6 +94,51 @@ client.schema.add_property(

# Inspect the shards of a class
client.schema.shards(class_name: 'Question')

# Remove a class (and all data in the instances) from the schema.
client.schema.delete(class_name: 'Question')

# Creating a new data object class in the schema while configuring the vectorizer on the schema and on individual properties (Ollama example)
client.schema.create(
class_name: 'Question',
description: 'Information from a Jeopardy! question',
properties: [
{
"dataType": ["text"],
"description": "The question",
"name": "question"
# By default all properties are included in the vector
}, {
"dataType": ["text"],
"description": "The answer",
"name": "answer",
"moduleConfig": {
"text2vec-ollama": {
"skip": false,
"vectorizePropertyName": true,
},
},
}, {
"dataType": ["text"],
"description": "The category",
"name": "category",
"indexFilterable": true,
"indexSearchable": false,
"moduleConfig": {
"text2vec-ollama": {
"skip": true, # Don't include in the vector
},
},
}
],
vectorizer: "text2vec-ollama",
module_config: {
"text2vec-ollama": {
apiEndpoint: "http://localhost:11434",
model: "mxbai-embed-large",
},
},
)
```

### Using the Objects endpoint
Expand Down
1 change: 1 addition & 0 deletions lib/weaviate/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Client
API_VERSION = "v1"

API_KEY_HEADERS = {
ollama: "X-Ollama-Not-Used",
openai: "X-OpenAI-Api-Key",
azure_openai: "X-Azure-Api-Key",
cohere: "X-Cohere-Api-Key",
Expand Down