Skip to content

Documentation v1.0.0


Documentation / @openassistant/osm / queryUSZipcodes

Variable: queryUSZipcodes

const queryUSZipcodes: OpenAssistantTool<QueryZipcodeFunctionArgs, QueryZipcodeLlmResult, QueryZipcodeAdditionalData>

Defined in: us/queryZipcode.ts:68

queryUSZipcodes Tool

This tool can be used to query US zipcodes within a given map bounds using the zipcode centroids geojson data from the Github repository: https://github.com/GeoDaCenter/data-and-lab

TIP

This tool can be mixed with other tools for more complex tasks. For example, if you have a point datasets, you can use this tool to answer questions like "What are the total revenus in the zipcodes in current map view?"

Example user prompts:

  • "Find all zipcodes in current map view"
  • "What zipcodes are in the Los Angeles county?"
  • "Get zipcodes within this map view"

Example

typescript
import { queryUSZipcodes } from "@openassistant/osm";
import { convertToVercelAiTool } from '@openassistant/utils';

streamText({
  model: openai('gpt-4o'),
  prompt: 'what are the zipcodes in Los Angeles county?',
  tools: {
    queryZipcode: convertToVercelAiTool(queryUSZipcodes),
  },
});

For a more complete example, see the OSM Tools Example using Next.js + Vercel AI SDK.

Released under the MIT License.