Skip to content

Documentation v1.0.0


Documentation / @openassistant/places / geotagging

Variable: geotagging

const geotagging: OpenAssistantTool<typeof geotaggingParameters, GeotaggingLlmResult, GeotaggingAdditionalData, FoursquareToolContext>

Defined in: packages/tools/places/src/geoTagging.ts:183

Geotagging Candidates Tool

This tool uses Foursquare's Snap to Place technology to detect where your user's device is and what is around them. It returns geotagging candidates based on the provided location coordinates.

TIP

This endpoint intentionally returns lower quality results not found in Place Search. It is not intended to replace Place Search as the primary way to search for top, recommended POIs.

Example user prompts:

  • "Find places near my current location at 40.7589,-73.9851"
  • "What's around me at these coordinates?"
  • "Find nearby businesses at latitude 34.0522, longitude -118.2437"
  • "Get geotagging candidates for this location"
  • "Find places matching 'coffee' near me"

Example

typescript
import { geotagging, GeotaggingTool } from "@openassistant/places";
import { convertToVercelAiTool, ToolCache } from '@openassistant/utils';
import { generateText } from 'ai';

// you can use ToolCache to save the geotagging dataset for later use
const toolResultCache = ToolCache.getInstance();

const geotaggingTool: GeotaggingTool = {
  ...geotagging,
  toolContext: {
    getFsqToken: () => process.env.FSQ_TOKEN!,
  },
  onToolCompleted: (toolCallId, additionalData) => {
    toolResultCache.addDataset(toolCallId, additionalData);
  },
};

generateText({
  model: openai('gpt-4.1', { apiKey: key }),
  prompt: 'Find places near my current location at 40.7589,-73.9851',
  tools: {
    geotagging: convertToVercelAiTool(geotaggingTool),
  },
});

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

Released under the MIT License.