🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

genkitx-voiceflow

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

genkitx-voiceflow

Firebase Genkit AI framework plugin for Voiceflow APIs.

latest
Source
npmnpm
Version
1.2.1
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Firebase Genkit + Voiceflow

Firebase Genkit <> Voiceflow Plugin

Voiceflow Community Plugin for Google Firebase Genkit

GitHub version NPM Downloads GitHub License Static Badge
GitHub Issues or Pull Requests GitHub Issues or Pull Requests GitHub commit activity

genkitx-voiceflow is a community plugin for using Voiceflow Knowledge base in Firebase Genkit. Built by Xavier Portilla Edo.

Installation

Install the plugin in your project with your favorite package manager:

  • npm install genkitx-voiceflow
  • pnpm add genkitx-voiceflow

Configuration

To use the plugin, you need to configure it with your Voiceflow API key. You can do this by calling the genkit function:

import { genkit, z } from 'genkit';
import {github, openAIGpt4o} from "genkitx-voiceflow";

const ai = genkit({
  plugins: [
    openAI({ apiKey: process.env.OPENAI_API_KEY }),
    voiceflow([
      {
        name: 'kb',
        clientParams: {
          apiKey: process.env.VOICEFLOW_API_KEY!,
        }
      },
    ])
  ],
});

Usage

The plugin provides two main functionalities: index and retrieve. You can use them directly or within a Genkit flow.

Indexer

Indexer is used to index documents in the Voiceflow Knowledge Base. Voiceflow Knowledge Base only works with documents that contain a media field with a url property. The URL could be a link to a website or to a local file with file://.

Basic examples

The simplest way to call the indexer is by using the helper function index:

const voiceflowIndexer = voiceflowIndexerRef({
  name: 'kb'
});

const documents = [{ content: [{ media: { url: 'https://www.voiceflow.com' } }] }];
await ai.index({ indexer: voiceflowIndexer, documents });

Within a flow

// ...configure Genkit (as shown above)...

export const indexerFlow = ai.defineFlow(
  {
    name: 'indexerFlow',
    inputSchema: z.string(),
    outputSchema: z.string(),
  },
  async () => {

   const voiceflowIndexer = voiceflowIndexerRef({
     name: 'kb'
   });

   const documents = [{ content: [{ media: { url: 'https://www.voiceflow.com' } }] }];
   await ai.index({ indexer: voiceflowIndexer, documents });

   return 'done';
   
  }
);

Retriever

A retriever is used to retrieve documents from the Voiceflow Knowledge Base. You can pass a query and options to the retriever. The options object can contain the following properties:

  • querySettings: An object with the following properties:
    • model: The model to use for the query. The default is gpt-4o.
    • temperature: The temperature to use for the query. The default is 0.7.
    • system: The system prompt to use for the query. The default is ''.
  • k: The number of documents to retrieve. The default is 5.
  • filters: filters to apply to the query. The default is [].

Basic examples

The simplest way to call the retriever is by using the helper function retrieve:

const voiceflowRetriever = voiceflowRetrieverRef({
  name: 'retriever'
});

const docs = await ai.retrieve({ retriever: voiceflowRetriever, query: subject, 
options:{
  querySettings: { model: 'gpt-4o', temperature: 0.7 },
  k: 5
}});

Within a flow

// ...configure Genkit (as shown above)...

export const retrieverFlow = ai.defineFlow(
  {
    name: 'retrieverFlow',
    inputSchema: z.string(),
    outputSchema: z.string(),
  },
  async (subject) => {

   const voiceflowRetriever = voiceflowRetrieverRef({
     name: 'retriever'
   });

   const docs = await ai.retrieve({ retriever: voiceflowRetriever, query: subject, 
    options:{
     querySettings: { model: 'gpt-4o', temperature: 0.7 },
     k: 5
   }});
   
   const llmResponse = await ai.generate({
      prompt: `What is Voiceflow?`,
      docs: docs,
    });
    return llmResponse.text;
  }
);

For more detailed examples and the explanation of other functionalities, refer to the official Genkit documentation.

Examples

You can find more examples in the examples folder.

Feature supported from Voiceflow Knowledge Base

This plugins supports all the features supported by the Vocieflow Knowledge Base API. You can find the full list of features in the Voiceflow Knowledge Base API Reference.

API Reference

You can find the full API reference in the API Reference Documentation

Contributing

Want to contribute to the project? That's awesome! Head over to our Contribution Guidelines.

Need support?

[!NOTE]
This repository depends on Google's Firebase Genkit. For issues and questions related to Genkit, please refer to instructions available in Genkit's repository.

Reach out by opening a discussion on GitHub Discussions.

Credits

This plugin is proudly maintained by Xavier Portilla Edo Xavier Portilla Edo.

License

This project is licensed under the Apache 2.0 License.

License: Apache 2.0

Keywords

genkit

FAQs

Package last updated on 28 Nov 2025

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