Skip to content

Commit

Permalink
Update provider to support marqo 2.13 (#30)
Browse files Browse the repository at this point in the history
This update adds support for the following fields

- treat_urls_and_pointers_as_media
- video_preprocessing
- audio_preprocessing
- model_properties

Within model_properties:
- name
- dimensions
- type
- tokens
- model_location
- url
- trust_remote_code
- filter_string_max_length

Within model_location:
- s3: Has the keys bucket, and key
- hf: Has the keys repo_id, and filename
- auth_required
  • Loading branch information
RaynorChavez authored Nov 13, 2024
1 parent 0c9514d commit 4e31c20
Show file tree
Hide file tree
Showing 15 changed files with 1,344 additions and 141 deletions.
68 changes: 68 additions & 0 deletions docs/data-sources/read_indices.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ description: |-
Optional:

- `all_fields` (Attributes List) (see [below for nested schema](#nestedatt--items--all_fields))
- `audio_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--items--audio_preprocessing))
- `model_properties` (Attributes) (see [below for nested schema](#nestedatt--items--model_properties))
- `tensor_fields` (List of String)
- `video_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--items--video_preprocessing))

Read-Only:

Expand All @@ -55,6 +58,7 @@ Read-Only:
- `store_size` (String) The size of the index storage
- `text_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--items--text_preprocessing))
- `treat_urls_and_pointers_as_images` (Boolean) Indicates if URLs and pointers should be treated as images
- `treat_urls_and_pointers_as_media` (Boolean) Indicates if URLs and pointers should be treated as media
- `type` (String) The type of the index
- `vector_numeric_type` (String) The numeric type of the vector

Expand All @@ -69,6 +73,70 @@ Optional:
- `type` (String)


<a id="nestedatt--items--audio_preprocessing"></a>
### Nested Schema for `items.audio_preprocessing`

Optional:

- `split_length` (String)
- `split_overlap` (String)


<a id="nestedatt--items--model_properties"></a>
### Nested Schema for `items.model_properties`

Read-Only:

- `dimensions` (String)
- `is_marqtuned_model` (Boolean)
- `model_location` (Attributes) (see [below for nested schema](#nestedatt--items--model_properties--model_location))
- `name` (String)
- `tokens` (String)
- `trust_remote_code` (Boolean)
- `type` (String)
- `url` (String)

<a id="nestedatt--items--model_properties--model_location"></a>
### Nested Schema for `items.model_properties.model_location`

Optional:

- `hf` (Attributes) (see [below for nested schema](#nestedatt--items--model_properties--model_location--hf))
- `s3` (Attributes) (see [below for nested schema](#nestedatt--items--model_properties--model_location--s3))

Read-Only:

- `auth_required` (Boolean)

<a id="nestedatt--items--model_properties--model_location--hf"></a>
### Nested Schema for `items.model_properties.model_location.auth_required`

Read-Only:

- `filename` (String)
- `repo_id` (String)


<a id="nestedatt--items--model_properties--model_location--s3"></a>
### Nested Schema for `items.model_properties.model_location.auth_required`

Read-Only:

- `bucket` (String)
- `key` (String)




<a id="nestedatt--items--video_preprocessing"></a>
### Nested Schema for `items.video_preprocessing`

Optional:

- `split_length` (String)
- `split_overlap` (String)


<a id="nestedatt--items--ann_parameters"></a>
### Nested Schema for `items.ann_parameters`

Expand Down
65 changes: 65 additions & 0 deletions docs/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ Optional:

- `all_fields` (Attributes List) (see [below for nested schema](#nestedatt--settings--all_fields))
- `ann_parameters` (Attributes) (see [below for nested schema](#nestedatt--settings--ann_parameters))
- `audio_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--settings--audio_preprocessing))
- `filter_string_max_length` (Number)
- `image_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--settings--image_preprocessing))
- `model_properties` (Attributes) (see [below for nested schema](#nestedatt--settings--model_properties))
- `normalize_embeddings` (Boolean)
- `tensor_fields` (List of String)
- `text_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--settings--text_preprocessing))
- `treat_urls_and_pointers_as_images` (Boolean)
- `treat_urls_and_pointers_as_media` (Boolean)
- `vector_numeric_type` (String)
- `video_preprocessing` (Attributes) (see [below for nested schema](#nestedatt--settings--video_preprocessing))

<a id="nestedatt--settings--all_fields"></a>
### Nested Schema for `settings.all_fields`
Expand Down Expand Up @@ -74,6 +78,15 @@ Optional:



<a id="nestedatt--settings--audio_preprocessing"></a>
### Nested Schema for `settings.audio_preprocessing`

Optional:

- `split_length` (Number)
- `split_overlap` (Number)


<a id="nestedatt--settings--image_preprocessing"></a>
### Nested Schema for `settings.image_preprocessing`

Expand All @@ -82,6 +95,49 @@ Optional:
- `patch_method` (String)


<a id="nestedatt--settings--model_properties"></a>
### Nested Schema for `settings.model_properties`

Optional:

- `dimensions` (Number)
- `is_marqtuned_model` (Boolean)
- `model_location` (Attributes) (see [below for nested schema](#nestedatt--settings--model_properties--model_location))
- `name` (String)
- `tokens` (Number)
- `trust_remote_code` (Boolean)
- `type` (String)
- `url` (String)

<a id="nestedatt--settings--model_properties--model_location"></a>
### Nested Schema for `settings.model_properties.model_location`

Optional:

- `auth_required` (Boolean)
- `hf` (Attributes) (see [below for nested schema](#nestedatt--settings--model_properties--model_location--hf))
- `s3` (Attributes) (see [below for nested schema](#nestedatt--settings--model_properties--model_location--s3))

<a id="nestedatt--settings--model_properties--model_location--hf"></a>
### Nested Schema for `settings.model_properties.model_location.s3`

Optional:

- `filename` (String)
- `repo_id` (String)


<a id="nestedatt--settings--model_properties--model_location--s3"></a>
### Nested Schema for `settings.model_properties.model_location.s3`

Optional:

- `bucket` (String)
- `key` (String)




<a id="nestedatt--settings--text_preprocessing"></a>
### Nested Schema for `settings.text_preprocessing`

Expand All @@ -90,3 +146,12 @@ Optional:
- `split_length` (Number)
- `split_method` (String)
- `split_overlap` (Number)


<a id="nestedatt--settings--video_preprocessing"></a>
### Nested Schema for `settings.video_preprocessing`

Optional:

- `split_length` (Number)
- `split_overlap` (Number)
59 changes: 59 additions & 0 deletions examples/create_index_custom_model/create_index_custom_model.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
terraform {
required_providers {
marqo = {
source = "registry.terraform.io/marqo/marqo"
}
}
}

provider "marqo" {
host = "https://api.marqo.ai/api/v2"
api_key = var.marqo_api_key
}

resource "marqo_index" "example" {
index_name = "example_index_custom_model"
settings = {
type = "unstructured"
vector_numeric_type = "float"
treat_urls_and_pointers_as_images = true
model = "your-own-sentence-transformers-mode"
model_properties = {
url = "https://marqo-ecs-50-audio-test-dataset.s3.us-east-1.amazonaws.com/test-hf.zip"
dimensions = 384
type = "hf"
trust_remote_code = false
}
normalize_embeddings = false
inference_type = "marqo.CPU.small"
all_fields = []
number_of_inferences = 1
number_of_replicas = 0
number_of_shards = 1
storage_class = "marqo.basic"

text_preprocessing = {
split_length = 2
split_method = "sentence"
split_overlap = 0
}
image_preprocessing = {}
ann_parameters = {
space_type = "prenormalized-angular"
parameters = {
ef_construction = 512
m = 16
}
}
filter_string_max_length = 20
}
}

output "created_index" {
value = marqo_index.example
}

variable "marqo_api_key" {
type = string
description = "Marqo API key"
}
77 changes: 77 additions & 0 deletions examples/create_index_languagebind/create_index_languagebind.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
terraform {
required_providers {
marqo = {
source = "marqo/marqo"
#version = "1.0.1"
}
}
}

provider "marqo" {
host = "https://api.marqo.ai/api/v2"
api_key = var.marqo_api_key
}

resource "marqo_index" "example" {
index_name = "example_index_languagebind"
settings = {
type = "structured"
vector_numeric_type = "float"
all_fields = [
{ "name" : "textField", "type" : "text", "features" : ["lexical_search"] },
{ "name" : "videoField", "type" : "video_pointer" },
{ "name" : "audioField", "type" : "audio_pointer" },
{ "name" : "imageField", "type" : "image_pointer" },
{
"name" : "multimodal_field",
"type" : "multimodal_combination",
"dependent_fields" : {
"imageField" : 0.8,
"textField" : 0.1,
"videoField" : 0.1,
"audioField" : 0.1
},
},
],
number_of_inferences = 1
storage_class = "marqo.basic"
number_of_replicas = 0
number_of_shards = 1
tensor_fields = ["multimodal_field", "textField", "videoField", "audioField", "imageField"],
model = "LanguageBind/Video_V1.5_FT_Audio_FT_Image"
normalize_embeddings = true
inference_type = "marqo.GPU"
text_preprocessing = {
split_length = 2
split_method = "sentence"
split_overlap = 0
}
image_preprocessing = {
patch_method = null
}
video_preprocessing = {
split_length = 5
split_overlap = 1
}
audio_preprocessing = {
split_length = 5
split_overlap = 1
}
ann_parameters = {
space_type = "prenormalized-angular"
parameters = {
ef_construction = 512
m = 16
}
}
}
}

output "created_index" {
value = marqo_index.example
}

variable "marqo_api_key" {
type = string
description = "Marqo API key"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
terraform {
required_providers {
marqo = {
source = "registry.terraform.io/marqo/marqo"
source = "marqo/marqo"
version = "1.0.1"
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.9.0
github.com/stretchr/testify v1.9.0
)

require (
Expand All @@ -23,6 +24,7 @@ require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
Expand Down Expand Up @@ -57,6 +59,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
Expand All @@ -80,4 +83,5 @@ require (
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
Expand Down
Loading

0 comments on commit 4e31c20

Please sign in to comment.