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

@getmetal/metal-sdk

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getmetal/metal-sdk

Metal SDK

  • 7.7.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

🤘 Metal Node SDK

Developer Documentation

Install

  npm install @getmetal/metal-sdk
  # or
  yarn add @getmetal/metal-sdk

Retrieval Usage

Setup

import { Metal } from '@getmetal/metal-sdk'
const metal = new Metal('pk_123', 'ci_123', 'idx_123')

Indexing

import { Metal } from '@getmetal/metal-sdk'

const metal = new Metal('api-key', 'client-id', 'index-id')

// Index Text
await metal.index({
  id: '666', // Id is optional <> if not provided, Metal will generate one
  text: 'Ozzy Osbourne',
  metadata: { band: 'Black Sabbath' },
})

// Index Image from URL
await metal.index({ imageUrl: 'https://image.png' })
// Index Image from Base64
await metal.index({ imageBase64: '<base-64-str>' })

Searching

import { Metal } from '@getmetal/metal-sdk'

const metal = new Metal('api-key', 'client-id', 'index-id')

// Search Text
await metal.search({
  text: 'Who is the lead singer of Black Sabbath?',
  limit: 1,
})

await metal.search({ imageUrl: 'search-by-image.png' })

// Filtered Search
await metal.search({
  text: 'Heavy Metal',
  filters: [{ field: 'band', value: 'Black Sabbath' }],
})

Memory Usage

Setup

import { Motorhead } from '@getmetal/metal-sdk'
const motor = new Motorhead({ apiKey: 'pk_123', clientId: 'ci_123' })

Add Memory

const memoryPayload = {
  messages: [
    { role: 'Human', content: 'Who is the best vocalist of all time?' },
    { role: 'AI', content: 'Ozzy!' },
  ],
  context: 'User ask what can he eat in Colombia. The AI responds arepas are really nice',
}

await motorhead.addMemory('session-id', memoryPayload)

Get Memory

await motorhead.getMemory('session-id')

View the full documentation on https://docs.getmetal.io/sdks/node

FAQs

Package last updated on 09 Nov 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