gopidesupavan commented on PR #64077:
URL: https://github.com/apache/airflow/pull/64077#issuecomment-4130186859

   <img width="1446" height="640" alt="image" 
src="https://github.com/user-attachments/assets/d45b9912-9366-46d2-9129-6f16d32be28e";
 />
   
   
   
   <summary>Example to tryout</summary>
   
   
   Create a small CSV in
      `/opt/airflow/sample_orders.csv`.
   
   ```csv
   order_id,customer,amount,status
   1,Alice,125.50,paid
   2,Bob,0.00,failed
   3,Carol,79.99,paid
   4,Dan,250.00,refunded
   ```
   
   ```
   from datetime import datetime
   
   from airflow.providers.common.ai.operators.llm_file_analysis import 
LLMFileAnalysisOperator
   from airflow.providers.common.compat.sdk import dag
   
   
   @dag(
       dag_id="example_llm_file_analysis_csv",
       schedule=None,
       start_date=datetime(2024, 1, 1),
       catchup=False,
   )
   def example_llm_file_analysis_csv():
       LLMFileAnalysisOperator(
           task_id="analyze_orders_csv",
           llm_conn_id="pydanticai_default",  # replace with any configured LLM 
connection
           file_path="/opt/airflow/sample_orders.csv",
           prompt=(
               "Analyze this CSV file. "
               "List the columns, count the rows, identify any failed or 
refunded orders, "
               "and compute the total amount for rows where status=paid. "
               "Mention if the file content was sampled or truncated."
           ),
           sample_rows=10,
       )
   
   
   example_llm_file_analysis_csv()
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to