Overview
The@feedback/ai package provides a comprehensive AI toolkit for the GTM Feedback platform, including specialized agents for Slack integration, request matching, search, analytics, and identity resolution. Built on top of the Vercel AI SDK with support for OpenAI and Anthropic models.
Installation
Package Information
@feedback/ai
0.0.1
@ai-sdk/openai: ^3.0.0@ai-sdk/devtools: 0.0.1@upstash/vector: ^1.0.0ai: 6.0.5zod: ^4.2.1
Exports
The package provides multiple export paths for different functionalities:Main Export
ai package).
Models
Wrapped Claude Sonnet 4 model with DevTools middleware (development only)
Wrapped Claude Haiku 4.5 model with DevTools middleware (development only)
Wrapped GPT-4o Mini model with DevTools middleware (development only)
Agents
agent instance provides access to all specialized agents:
Agent Types
Extract customer pain from Slack messages, compose notifications, and chat with usersMethods:
generate(input): Extract pain or compose messageschat(input): Stream chat responses
Match customer pain to existing requests or generate new request detailsMethods:
generate(input): Match, create, or find related requests
Search and rank requests based on semantic similarityMethods:
generate(input): Search requests and return ranked matches
Generate insights and analytics for areas or requestsMethods:
generate(input): Generate analytics sections with visuals
Resolve user identity from email addressesMethods:
generate(input): Match email to user ID
Specialized Agents
Embeddings
Creates an embedding vector for a single requestParameters:
title(string): Request titledescription(string): Request descriptionapiKey(string): OpenAI API key
Promise<number[] | null>Creates embedding vectors for multiple requests in batchParameters:
items(Array): Array of{ title, description }objectsapiKey(string): OpenAI API key
Promise<number[][] | null>Stores an embedding in Upstash VectorParameters:
requestId(string): Unique request identifierembedding(number[]): 384-dimensional embedding vectorurl(string): Upstash Vector REST URLtoken(string): Upstash Vector REST tokenmetadata(object, optional): Additional metadata
Promise<boolean>Stores multiple embeddings in batchParameters:
items(Array): Array of{ requestId, embedding, metadata? }objectsurl(string): Upstash Vector REST URLtoken(string): Upstash Vector REST token
Promise<Set<string>> - Set of successfully stored request IDsSearches for similar requests using vector similarityParameters:
embedding(number[]): Query embedding vectorurl(string): Upstash Vector REST URLtoken(string): Upstash Vector REST tokenlimit(number, optional): Maximum results (default: 10)excludeIds(string[], optional): Request IDs to exclude
Promise<Array<{ id, score, metadata? }>>Updates an existing embedding (alias for storeRequestEmbedding)Parameters: Same as
storeRequestEmbeddingReturns: Promise<boolean>Deletes an embedding from Upstash VectorParameters:
requestId(string): Request identifier to deleteurl(string): Upstash Vector REST URLtoken(string): Upstash Vector REST token
Promise<boolean>Key Types
Agent Types
Usage Examples
Environment Variables
OpenAI API key for embeddings and GPT models
Upstash Vector REST API URL for embedding storage
Upstash Vector REST API token for authentication
Set to ‘development’ to enable AI DevTools middleware