@zooly/util-srv is a server-side utility package that provides common server-only functions and services used across server packages in the monorepo.
This package is server-only and should not be used in client-side code. It contains AWS SDK dependencies and other server-specific functionality.
@zooly/util-srvpackages/util-srvThe package provides comprehensive S3 functionality:
The package provides OpenAI embedding generation functionality:
generateEmbedding(text) - Generate embedding vectors for text content
text-embedding-3-small modelpackages/util-srv/src/generateEmbedding.ts for implementationThe package provides AI-powered structured data extraction from natural language:
generateStructuredData(prompt, schema, schemaName?, schemaDescription?, output?) - Extract structured data from text using Google Gemini
gemini-2.5-flash-lite model"object", "enum", "array", or "no-schema"packages/util-srv/src/generateStructuredData.ts for implementationimport { generateStructuredData } from "@zooly/util-srv";
import { z } from "zod";
const schema = z.object({
category: z.enum(["MODELS", "ACTORS", "MUSICIANS"]).optional(),
gender: z.enum(["MALE", "FEMALE", "NON_BINARY"]).optional(),
hairColor: z.enum(["BLONDE", "BROWN", "BLACK", "RED"]).optional(),
});
const result = await generateStructuredData(
"Looking for a tall blonde female model in the US",
schema,
"SearchFilters",
"Extract search characteristics from description"
);
// Result: { category: "MODELS", gender: "FEMALE", hairColor: "BLONDE" }
This function is also exposed via the API endpoint /api/generate-structured-data for client-side usage. The endpoint accepts a plain object schema definition (serialized Zod schema) and returns the extracted structured data.
@aws-sdk/client-s3 for S3 operations@zooly/types for shared types@zooly/util for shared utilitiesnanoid for generating unique IDsai, @ai-sdk/openai, and @ai-sdk/google for AI operations (embeddings and structured data generation)zod for schema validationThis package provides server-side utilities that can be imported by server packages in the monorepo. It's particularly useful for file storage operations and AWS integrations.
The package requires the following environment variables:
AWS_REGION - AWS region for S3 operationsAWS_ACCESS_KEY_ID - AWS access key IDAWS_SECRET_ACCESS_KEY - AWS secret access keyAWS_BUCKET_NAME - S3 bucket nameOPENAI_API_KEY - OpenAI API key for embedding generationGOOGLE_GENERATIVE_AI_API_KEY - Google AI API key for structured data generation (Gemini)