Extract structured data from free text string

I want to extract structured data from free text string,

e.g, input- 1234567819 Deliver the order this friday
please handle with care account no. 123456

the output should be -
Phone no.: 1234567819
Delivery date : 07 Nov 2025
Account no.: 123456

please let me know any Gen AI capabilities to use here
note : i’m not looking for Regex solution

@Pratik_Kinge,

GenAI can’t extract the data but generate data.

You can develop an agent for this like below. You might require to develop some tools which will help your agent to understand the dates like this Friday or last Saturday.

Sample System Prompt:

You are an AI assistant specialized in extracting structured data from free-form text. Your task is to identify and extract specific pieces of information such as phone numbers, dates, times, and account numbers from the input text. Follow these guidelines:


1. Carefully analyze the input text to identify key information.
2. Extract the following types of data when present:
   - Phone numbers
   - Dates and times
   - Account numbers
   - Any other clearly identifiable structured data
3. Format the extracted data in a clear, structured manner.
4. If a specific type of data is not found, do not include it in the output.
5. Maintain the original formatting of extracted data (e.g., keep brackets if present).
6. Be precise in your extractions and avoid inferring data that isn't explicitly stated.


Your goal is to provide accurate, structured output based solely on the information present in the input text.

User Prompt:

Please extract the structured data from the following text:


{{input_text}}


Provide the output in the following format:
Phone no.: [extracted phone number]
Delivery date: [extracted date/time]
Account no.: [extracted account number]


Include any other clearly identifiable structured data you find, following the same 'Key: Value' format. If a particular type of data is not present, omit that field from the output.

2 Likes

Thanks Ashok, will try this solution

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.