Voker logo

TypeScript

Installation

npm install @voker/voker

Make sure to set the environment variable VOKER_API_KEY.

Quick Start

If you're using one of our supported SDKs, you can simply swap out the class you instantiate:

import { OpenAI } from 'openai'; 
import { OpenAI } from '@voker/voker/ai/provider-openai'

const client = new OpenAI();

await client.chat.completions.create({
    model: 'gpt-4o',
    messages: [
        {
            role: 'user',
            content: 'Hello, word!'
        }
    ],
});

See provider specific setup instructions:

TypeScript SDK Reference

Voker Client

The Voker Client provides a way to create an update Agents, Agent Versions, People and Events programmatically.

Requests are made in the background as to not add latency to your application. This is used by the SDKs but can also be used directly if you want more control over when requests are sent.

API Client

The API Client provides a way to make requests to the Voker API directly. This is used under the hood by the Voker Client, but can also be used directly if you want more control over how requests are made.

Fetching Agents, Agent Versions, and People is a common use cases for using the API Client directly.

Types

  • Type CreateAgentVersionPayload

    Create an agent version.

    See Creating an Agent Version for more information.

    Fields

    • agentVersionName: string

      Unique identifier for the agent version within its agent.

    • description: string | null | undefined

  • Type CreateAgentPayload

    Create an agent.

    See Creating an Agent for more information.

    Fields

    • agentName: string

      Unique identifier for the agent.

    • description: string | null | undefined

  • Type ClientCreateEventPayload

    Create an event.

    See Creating an Event for more information.

    Fields

    • vokerAgent: string | undefined

      The name of the agent associated with the event.

      If this agent does not exist, it will be created. If an agent is not supplied, a default agent will be used.

    • vokerAgentVersion: string | undefined

      The name of the agent version associated with the event.

      If this agent version does not exist, it will be created. If an agent version is not supplied, a default version will be used.

    • vokerPerson: string | undefined

      The unique identifier of the person associated with the event.

      If the person does not exist, it will be created.

    • vokerSession: string | undefined

      The unique identifier of the session associated with the event.

      If the session does not exist, it will be created.

    • eventName: string

    • properties: Record<string, any>

  • Type CreateEventPayload

    Fields

    • vokerAgent: string | undefined

      The name of the agent associated with the event.

      If this agent does not exist, it will be created. If an agent is not supplied, a default agent will be used.

    • vokerAgentVersion: string | undefined

      The name of the agent version associated with the event.

      If this agent version does not exist, it will be created. If an agent version is not supplied, a default version will be used.

    • vokerPerson: string | undefined

      The unique identifier of the person associated with the event.

      If the person does not exist, it will be created.

    • vokerSession: string | undefined

      The unique identifier of the session associated with the event.

      If the session does not exist, it will be created.

    • eventName: string

    • properties: Record<string, any>

    • fingerprintId: string

      The fingerprint of the client that generated the event.

  • Type CreateEventVokerParams

    Fields

    • vokerAgent: string | undefined

      The name of the agent associated with the event.

      If this agent does not exist, it will be created. If an agent is not supplied, a default agent will be used.

    • vokerAgentVersion: string | undefined

      The name of the agent version associated with the event.

      If this agent version does not exist, it will be created. If an agent version is not supplied, a default version will be used.

    • vokerPerson: string | undefined

      The unique identifier of the person associated with the event.

      If the person does not exist, it will be created.

    • vokerSession: string | undefined

      The unique identifier of the session associated with the event.

      If the session does not exist, it will be created.

  • Type CreateFingerprintPayload

    Create a fingerprint.

    See Creating a Fingerprint for more information.

    Fields

    • language: string

    • languageVersion: string

    • system: string

    • openaiSdkVersion: string | undefined

    • anthropicSdkVersion: string | undefined

    • geminiSdkVersion: string | undefined

    • vokerSdkVersion: string | undefined

    • allPackages: Record<string, string> | undefined

    • gitRepositoryUrl: string | undefined

    • gitBranch: string | undefined

    • gitCommitHash: string | undefined

    • gitCommitDate: string | undefined

  • Type CreatePersonPayload

    Create a person.

    See Creating a Person for more information.

    Fields

    • personId: string

    • properties: Record<string, any> | undefined

  • Type UpdatePersonPayload

    Update a person.

    Fields

    • properties: Record<string, any>

  • Type AgentVersion

    Represents an agent version.

    See Agent Versions for more information.

    Fields

    • agentVersionName: string

      Unique identifier for the agent version within its agent.

    • description: string | null

    • agentVersionNumber: number

      Unique number assigned to the agent version within its agent.

    • createdAt: Date

    • deprecatedAt: Date | null

  • Type Agent

    Represents an agent.

    See Agents for more information.

    Fields

    • agentName: string

      Unique identifier for the agent.

    • description: string | null

    • agentNumber: number

      Unique number assigned to the agent.

    • createdAt: Date

    • deprecatedAt: Date | null

  • Type Fingerprint

    Represents a fingerprint.

    See Fingerprints for more information.

    Fields

    • fingerprintId: string

  • Type Person

    Represents a person.

    See People for more information.

    Fields

    • personId: string

    • properties: Record<string, any> | null

    • createdAt: Date