Skip to content

Commit ec24de6

Browse files
Merge pull request #48 from cameronmccord2/ollama_and_module_config_example
Ollama and module config example
2 parents 03c0fc0 + 143e935 commit ec24de6

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

README.md

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ client.schema.create(
6666
"name": "category"
6767
}
6868
],
69-
# Possible values: 'text2vec-cohere', 'text2vec-openai', 'text2vec-huggingface', 'text2vec-transformers', 'text2vec-contextionary', 'img2vec-neural', 'multi2vec-clip', 'ref2vec-centroid'
69+
# Possible values: 'text2vec-cohere', 'text2vec-ollama', 'text2vec-openai', 'text2vec-huggingface', 'text2vec-transformers', 'text2vec-contextionary', 'img2vec-neural', 'multi2vec-clip', 'ref2vec-centroid'
7070
vectorizer: "text2vec-openai"
7171
)
7272

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

79-
# Remove a class (and all data in the instances) from the schema.
80-
client.schema.delete(class_name: 'Question')
81-
8279
# Update settings of an existing schema class.
8380
# Does not support modifying existing properties.
8481
client.schema.update(
@@ -97,6 +94,51 @@ client.schema.add_property(
9794

9895
# Inspect the shards of a class
9996
client.schema.shards(class_name: 'Question')
97+
98+
# Remove a class (and all data in the instances) from the schema.
99+
client.schema.delete(class_name: 'Question')
100+
101+
# Creating a new data object class in the schema while configuring the vectorizer on the schema and on individual properties (Ollama example)
102+
client.schema.create(
103+
class_name: 'Question',
104+
description: 'Information from a Jeopardy! question',
105+
properties: [
106+
{
107+
"dataType": ["text"],
108+
"description": "The question",
109+
"name": "question"
110+
# By default all properties are included in the vector
111+
}, {
112+
"dataType": ["text"],
113+
"description": "The answer",
114+
"name": "answer",
115+
"moduleConfig": {
116+
"text2vec-ollama": {
117+
"skip": false,
118+
"vectorizePropertyName": true,
119+
},
120+
},
121+
}, {
122+
"dataType": ["text"],
123+
"description": "The category",
124+
"name": "category",
125+
"indexFilterable": true,
126+
"indexSearchable": false,
127+
"moduleConfig": {
128+
"text2vec-ollama": {
129+
"skip": true, # Don't include in the vector
130+
},
131+
},
132+
}
133+
],
134+
vectorizer: "text2vec-ollama",
135+
module_config: {
136+
"text2vec-ollama": {
137+
apiEndpoint: "http://localhost:11434",
138+
model: "mxbai-embed-large",
139+
},
140+
},
141+
)
100142
```
101143

102144
### Using the Objects endpoint

lib/weaviate/client.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Client
1010
API_VERSION = "v1"
1111

1212
API_KEY_HEADERS = {
13+
ollama: "X-Ollama-Not-Used",
1314
openai: "X-OpenAI-Api-Key",
1415
azure_openai: "X-Azure-Api-Key",
1516
cohere: "X-Cohere-Api-Key",

0 commit comments

Comments
 (0)