Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

marqo

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marqo

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Marqo

Ruby Driver for Marqo. Supported Marqo version 1.2.0 - https://docs.marqo.ai/1.2.0/

Usage

client = Marqo::Client.new(endpoint, index_name)

create index

options = {
    number_of_shards: 3,
    number_of_replicas: 0
}
client.create_index(index_name, options)

valid options - ref

{
  "index_defaults": {
      "treat_urls_and_pointers_as_images": false,
      "model": "hf/all_datasets_v4_MiniLM-L6",
      "normalize_embeddings": true,
      "text_preprocessing": {
          "split_length": 2,
          "split_overlap": 0,
          "split_method": "sentence"
      },
      "image_preprocessing": {
          "patch_method": null
      },
      "ann_parameters" : {
          "space_type": "cosinesimil",
          "parameters": {
              "ef_construction": 128,
              "m": 16
          }
      }
  },
  "number_of_shards": 3,
  "number_of_replicas": 0
}

list_index

client.list

delete_index

client.delete_index

add_documents

documents = [
    {
      title: 'The Travels of Marco Polo',
      desc: 'A 13th-century travelogue describing the travels of Polo',
      genre: 'History'
    },
    {
      title: 'Extravehicular Mobility Unit (EMU)',
      desc: 'The EMU is a spacesuit that provides environmental protection',
      genre: 'Science',
      _id: 'hatkeo_08'
    }
]

options = { tensor_fields: %w[title desc] }
client.add_documents(documents, options)

find_doc

client.find_doc('hatkeo_08', { expose_facets: false })

find_docs (does not support options yet - TODO)

client.find_doc(['hatkeo_08', 'another_ids'])

delete_docs

client.delete_docs(['hatkeo_08', 'another_ids'])
query = 'what is the best outfit to wear on the moon?'
default_options = {
    limit: 20,
    offset: 0,
    showHighlights: true,
    searchMethod: Marqo::Search::SEARCH_METHOD_TENSOR,
    attributesToRetrieve: ['*'],
    image_download_headers: {}
}
client.search(query, default_options)
  • search_options - ref

possible options

Contributing

  • TODO: add support for
  • mapping. There document seems not clear - ref
  • bulk - ref

make sure follow rubocop and add test for it

rake check
rake test

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 29 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc