Skip to main content Skip to complementary content

Identifying countries from input addresses using OpenAI

This Job uses fixed input data containing addresses provided by sales team in different formats without country names, sends them to OpenAI to identify the countries, and displays the results in the console.

Before you begin

Before running this Job, ensure you have:

  • An active OpenAI API account with a valid API token.
  • Sufficient API credits to process translation requests.

Linking the components

Procedure

  1. Create a new Standard Job and add the following components by typing their names in the design workspace or dragging them from the Palette: tFixedFlowInput, tOpenAIClient, tLogRow.
  2. Connect tFixedFlowInput to tOpenAIClient using a Row > Main connection.
  3. Connect tOpenAIClient to tLogRow using a Row > FLOW connection.
    Job design showing tFixedFlowInput connected to tOpenAIClient, which connects to tLogRow.

Configuring the components

Procedure

  1. Double-click the tFixedFlowInput component to open its Component view.
  2. In the Basic settings tab, click Edit schema and define the column:
    • content (String)
  3. Click OK to close the schema editor.
  4. In the Mode area, select Use Inline Table.
  5. In the Content field, add a line for each address:
    "23 Shevchenka St., Kyiv, 01001"
    "17 Rue de la République, Lyon, 69002"
    "東京都新宿区西新宿3丁目7−1"
    "Avenida Paulista, São Paulo"
    tFixedFlowInput configuration showing inline content with addresses in different formats without country names.
  6. Click OK to close the component view.
  7. Double-click the tOpenAIClient component to open its Component view.
  8. In the Basic settings tab, configure the following parameters:
    • Click Sync columns to retrieve the schema from tFixedFlowInput.
    • In the Token field, click the [...] button and enter your OpenAI API token in the password dialog box, then click OK.
    • In the Model field, click the [...] button and select gpt-3.5-turbo from the list.
    • In the Prompt field, enter the following instruction:
      Given the following addresses, guess the country names.
    tOpenAIClient Basic settings showing Model set to gpt-3.5-turbo and the country identification prompt.
  9. Click OK to close the schema editor and OK to close the component view.
  10. Double-click the tLogRow component to open its Component view.
  11. In the Basic settings tab, keep the default Mode as Table (print values in cells of a table).
  12. Click OK to close the component view.

Executing the Job

Procedure

  1. Press Ctrl+S to save the Job.
  2. Press F6 to execute the Job.

Results

The Job reads the addresses from the fixed input data, sends each address to the OpenAI API to identify the country, and displays the identified country names corresponding to the addresses in the console. The OpenAI model analyzed the address format, postal codes, city names, and street patterns to determine the country. Each address is processed individually.

Run console showing the execution results with the addresses and identified country names displayed in table format.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!