Skip to main content

Wrapper around LinTO Studio API

Project description

LinTO Studio SDK

LinTO Studio SDK is a wrapper around LinTO Studio API. You can generate an auth token from LinTO Studio in the organization settings.

It is available in Python and Javascript (NodeJS and web browser).

Install

Python

pip install linto

NodeJS or compiled front-end project

npm install @linto-ai/linto

Plain JS in web browser

<script type="module" src="https://unpkg.com/@linto-ai/linto/index.js"></script>

How to use

NodeJS or Web browser

// NodeJS
import LinTO from "@linto-ai/linto"
let linTO = new LinTO({
  authToken: "authToken",
})

// Browser
let linTO = new window.LinTO({
  authToken: "authToken",
})

// Choose depending on your environment

// NodeJS
import fs from "fs"
const file = await fs.openAsBlob("path/to/audio.mp3")

// Browser :
// From an <input type='file'/>
const file = document.getElementById("file").files[0]

const handle = await linTO.transcribe(file)

handle.addEventListener("update", (e) => {
  console.log("Audio transcription processing", e.detail)
})

handle.addEventListener("done", (e) => {
  console.log("Audio transcription completed")
  console.log("Full text", e.detail.fullText)
  console.log("Formated output", e.detail.toFormat())
  console.log("Turns list", e.detail.turns)
  console.log("Api response", e.detail.response)
})

handle.addEventListener("error", () => {
  console.log("Error while processing the audio")
})

Full example

Python

import os
from linto import LinTO

linTO = LinTO(auth_token="auth_token")

with open("path/to/audio.mp3", "rb") as f:
    file = f.read()

handle = await linTO.transcribe(file)

def on_update(data):
    print("Audio transcription processing", data)

def on_done(data):
    print("Audio transcription completed")
    print("Full text", data.full_text)
    print("Formated output", data.to_format())
    print("Turns list", data.turns)
    print("Api response", data.response)

def on_error(data):
    print("Error while processing the audio")

handle.on("update", on_update)
handle.on("done", on_done)
handle.on("error", on_error)

See complete python script at python/test.js

Documentation

Options in camelCase are the same in pascal_case for Python

Initialisation

// Javascript
linTO = new LinTO({authToken = "auth_token", ...options})
# Python
linTO = LinTO(auth_token="auth_token", **options)

Options

Parameter required value description default value
authToken yes String Studio auth token
baseUrl no String Studio API base url https://studio.linto.ai/cm-api

Transcribe

// Javascript
const handle = await linTO.transcribe(file, { ...options })

handle.addEventListener("update", callback)
handle.addEventListener("done", callback)
handle.addEventListener("error", callback)
# Python
await linTO.transcribe(file, **options)

handle.on("update", callback)
handle.on("done", callback)
handle.on("error", callback)

Options

Parameter required value description default value
file yes File or Blob Audio file to transcribe
enableDiarization no Bool Enable speaker diarization True
numberOfSpeaker no Int Number of speaker for diarization, 0 means auto 0
language no 2 letters language code or "*" Language the audio should be transcribed. "*" means auto-detection + multiple languages "*"
enablePunctuation no Bool Enable automatic punctuation recognition True
name no String Name of the media in LinTO Studio "imported file ${date}"

toFormat options

Parameter required value description default value
sep no String Separator between metadatas " - "
metaTextSep no String Separator between metadata and text " : "
eol no String End of line character ("CRLF" or "LF" or None). If neither "CRLF" or "LF", no carriage return is added. "CRLF"
ensureFinalEOL no Bool Whether to ensure final end of line false
include no Object Which metadata to include (speaker, lang, timestamp) { speaker: true, lang: true, timestamp: true }
order no Array Order of metadata in output ["speaker", "lang", "timestamp"]

Coming soon 🏗️

Transcribe video conference

const meeting = await linTO.transcribeVideoConference({ type, url, ...options })
meeting.addEventListener("connected", callback)
meeting.addEventListener("meeting_start", callback)
meeting.addEventListener("people_join", callback)
meeting.addEventListener("meeting_end", callback)
meeting.addEventListener("transcription", callback)

handle = await meeting.offlineTranscription({ ...options })
handle.addEventListener("update", callback)
handle.addEventListener("done", callback)
handle.addEventListener("error", callback)

Live transcription

const live = await linTO.transcribeLive({ ...option })
live.connectAudio(source)
live.startTranscription()
live.stopTranscription()
live.addEventListener("transcription", callback)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linto-1.2.1.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linto-1.2.1-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file linto-1.2.1.tar.gz.

File metadata

  • Download URL: linto-1.2.1.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for linto-1.2.1.tar.gz
Algorithm Hash digest
SHA256 efb3f82c7d02735fa4885809acfe0ade1fc32f60c336dfda35a113acacf3d856
MD5 b53bf0aa3640292a19de06d08a6588bf
BLAKE2b-256 bf3e3607514a944ab3efcaa05235940d86f6e35e62dc671cc135374ffa457034

See more details on using hashes here.

File details

Details for the file linto-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: linto-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for linto-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 633481ea6506b4da76ef1be2f5e5f8124e9002ce2d831c06631d38e544cd0b37
MD5 e21ca2eac461d8f1337a91e400c85d2b
BLAKE2b-256 0a1259e18dcd3f6c6c8d584f5c878cc3a317b5c39f5ca676de8ca5c6e4df4dfa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page