🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@agentica/pg-vector-selector

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agentica/pg-vector-selector

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/wrtnlabs/pg-vector-selector/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/pg-vector-selector.svg)](https://www.npmjs.com/package/pg-vector-select

0.20.0
latest
Source
npm
Version published
Maintainers
2
Created
Source

pg-vector-selector

GitHub license npm version

A library that significantly accelerates AI function selection through vector embeddings.

Overview

@agentica/pg-vector-selector drastically improves function selection speed compared to traditional LLM-based methods. By leveraging vector embeddings and semantic similarity, it can identify the most appropriate functions for a given context multiple times faster than conventional approaches.

import { Agentica } from "@agentica/core";
import { AgenticaPgVectorSelector } from "@agentica/pg-vector-selector";
import typia from "typia";

// Initialize with connector-hive server
const selectorExecute = AgenticaPgVectorSelector.boot<"chatgpt">(
  "https://your-connector-hive-server.com"
);

const agent = new Agentica({
  model: "chatgpt",
  vendor: {
    model: "gpt-4o-mini",
    api: new OpenAI({
      apiKey: process.env.CHATGPT_API_KEY,
    }),
  },
  controllers: [
    await fetch(
      "https://shopping-be.wrtn.ai/editor/swagger.json",
    ).then(r => r.json()),
    typia.llm.application<ShoppingCounselor>(),
    typia.llm.application<ShoppingPolicy>(),
    typia.llm.application<ShoppingSearchRag>(),
  ],
  config: {
    executor: {
      select: selectorExecute,
    }
  }
});
await agent.conversate("I wanna buy MacBook Pro");

How to Use

Setup

npm install @agentica/core @agentica/pg-vector-selector typia
npx typia setup

To use pg-vector-selector, you need:

  • A running connector-hive server
  • PostgreSQL database connected to the connector-hive server
  • pgvector extension installed in PostgreSQL

Initialization

First, initialize the library with your connector-hive server:

import { AgenticaPgVectorSelector } from "pg-vector-selector";

const selectorExecute = AgenticaPgVectorSelector.boot<YourSchemaModel>(
  "https://your-connector-hive-server.com"
);

Just apply Selector and Start conversation

Select the most appropriate functions for a given context:

const agent = new Agentica({
  model: "chatgpt",
  vendor: {
    model: "gpt-4o-mini",
    api: new OpenAI({
      apiKey: process.env.CHATGPT_API_KEY,
    }),
  },
  controllers: [
    await fetch(
      "https://shopping-be.wrtn.ai/editor/swagger.json",
    ).then(r => r.json()),
    typia.llm.application<ShoppingCounselor>(),
    typia.llm.application<ShoppingPolicy>(),
    typia.llm.application<ShoppingSearchRag>(),
  ],
  config: {
    executor: {
      select: selectorExecute,
    }
  }
});
await agent.conversate("I wanna buy MacBook Pro");

Keywords

openai

FAQs

Package last updated on 21 Apr 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