7.7.1 • Published 2 years ago

@getmetal/metal-sdk v7.7.1

Weekly downloads
-
License
Apache 2.0
Repository
github
Last release
2 years ago

🤘 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

6.0.0

2 years ago

7.3.1

2 years ago

7.3.0

2 years ago

7.2.0

2 years ago

7.1.1

2 years ago

7.1.0

2 years ago

7.0.1

2 years ago

7.7.1

2 years ago

7.7.0

2 years ago

7.6.0

2 years ago

7.4.1

2 years ago

5.0.5

2 years ago

5.0.4

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.10

2 years ago

5.0.11

2 years ago

4.0.6

2 years ago

5.0.8

2 years ago

5.0.7

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

4.0.5

2 years ago

4.0.4

2 years ago

4.0.0

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.12

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago