0.20.0 • Published 6 months ago

@agentica/pg-vector-selector v0.20.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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:

  1. A running connector-hive server
  2. PostgreSQL database connected to the connector-hive server
  3. 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");
0.20.0

6 months ago

0.19.1

6 months ago

0.19.0

6 months ago

0.18.0

6 months ago

0.17.1

7 months ago

0.17.0

7 months ago

0.16.9

7 months ago

0.16.8

7 months ago

0.16.7

7 months ago

0.16.6

7 months ago

0.16.4

7 months ago

0.16.3

7 months ago

0.16.2

7 months ago

0.16.1

7 months ago

0.16.0

7 months ago

0.15.7

7 months ago

0.15.6

7 months ago

0.15.5

7 months ago

0.15.4

7 months ago

0.15.3

7 months ago

0.15.1

7 months ago

0.15.0

7 months ago

0.14.3

7 months ago

0.14.2

7 months ago

0.14.1

7 months ago

0.14.0

7 months ago

0.13.4

7 months ago

0.13.3

7 months ago

0.13.2

7 months ago

0.13.1

7 months ago

0.13.0

7 months ago

0.12.21

7 months ago

0.12.17

7 months ago

0.12.16

7 months ago

0.12.14

7 months ago

0.12.12

7 months ago

0.12.9

7 months ago

0.12.8

7 months ago

0.12.7

7 months ago

0.12.5

7 months ago

0.12.4

7 months ago

0.12.2

7 months ago

0.12.1

8 months ago

0.12.0

8 months ago

0.11.1

8 months ago

0.11.0

8 months ago

0.10.4

8 months ago