Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Latest commit

 

History

History
53 lines (39 loc) · 1.27 KB

File metadata and controls

53 lines (39 loc) · 1.27 KB

Pica Vercel AI SDK Examples

This folder contains examples demonstrating how to use the Pica SDK.

Setup

  1. Create a .env file in the root of the project with your API keys:

    PICA_SECRET_KEY=your_api_key_here
    OPENAI_API_KEY=your_openai_api_key_here
    
  2. Install dependencies:

    npm install dotenv @ai-sdk/openai ai express

Examples

Basic Example with Streaming

The basic-example.ts example demonstrates how to:

  • Initialize the Pica SDK
  • Generate a system prompt
  • Stream responses from an LLM using the Vercel AI SDK with Pica tools

This example shows how to handle streaming responses from the LLM.

Run the example:

npm run example:basic

Express Server Example

The express-server.ts example demonstrates how to:

  • Set up an Express server with Pica integration
  • Create an API endpoint that uses Pica with the Vercel AI SDK
  • Process requests and return AI-generated responses

This example is useful for building web applications or APIs that need to integrate with Pica.

Run the server:

npm run example:express

Test the Express server:

curl -X POST http://localhost:7422/api/ai \
  -H "Content-Type: application/json" \
  -d '{"message":"What connections do I have access to?"}'