Skip to content

Documentation v1.0.0


Documentation / @openassistant/osm / geocoding

Variable: geocoding

const geocoding: OpenAssistantTool<typeof geocodingParameters, GeocodingLlmResult, GeocodingAdditionalData, GeocodingToolContext>

Defined in: geocoding.ts:56

Geocoding Tool

This tool converts addresses into geographic coordinates (latitude and longitude) using OpenStreetMap's Nominatim service.

Example user prompts:

  • "Find the coordinates for 123 Main Street, New York"
  • "What are the coordinates of the Eiffel Tower?"
  • "Get the location of Central Park"

Example

typescript
import { geocoding, GeocodingTool } from "@openassistant/osm";
import { convertToVercelAiTool } from '@openassistant/utils';
import { generateText } from 'ai';

generateText({
  model: openai('gpt-4.1', { apiKey: key }),
  prompt: 'What are the coordinates of the Eiffel Tower?',
  tools: {
    geocoding: convertToVercelAiTool(geocoding),
  },
});

Released under the MIT License.