In this tutorial, we show how PRESIVAL AGENTS Can raise your analysis of manual script data to a fully autonomous and AI pipeline. In some natural language prompts, you will learn to orchestrate each stage of the workflow, to load CSV or Excel files, to filter the lines, to summarize trends, to regroup by personalized fields, to rotate tables and to export results to the CSV and to excel, without writing traditional pendas code. In this implementation, under the hood, PRAReai uses Google Gemini to interpret your instructions and invoke the appropriate tools. At the same time, features such as self-reflection and verbal journalization offer you complete visibility in each stage of intermediate reasoning.
!pip install "praisonaiagents(llm)"
We install the main library of PRAISONAI agents, as well as its LLM integration extras, which bring all the necessary dependencies (such as Litellm and Gemini connectors) to generate autonomous workflows with large languages.
import os
os.environ("GEMINI_API_KEY") = "Use Your API Key"
llm_id = "gemini/gemini-1.5-flash-8b"
We configure your environment for access to the gemini by defining your API key, then specions which gemini model (the variant “1.5-Flash-8B”) that the prery agent must use as Backend LLM.
from google.colab import files
uploaded = files.upload()
csv_path = next(iter(uploaded))
print("Loaded:", csv_path)
We take advantage of the colab File-Upload widget to allow you to choose a local CSV, capture your file name in CSV_Path and print a confirmation, which facilitates the implementation of your data in the notebook.
from praisonaiagents import Agent
from praisonaiagents.tools import (
read_csv, filter_data, get_summary, group_by, pivot_table, write_csv
)
agent = Agent(
instructions="You are a Data Analyst Agent using Google Gemini.",
llm=llm_id,
tools=(
read_csv, filter_data, get_summary, group_by, pivot_table, write_csv
),
self_reflect=True,
verbose=True
)
We instantly instantly cabled on Google Gemini, equipping them with data analysis tools (E / S CSV, filtering, summary, grouping, pivot and export). Authorizing self-reflection allows the agent to criticize his reasoning, while the diffuse verbose mode of the invocation newspapers of detailed tools for transparency.
result = agent.start(f"""
1. read_csv to load data from "{csv_path}"
2. get_summary to outline overall trends
3. filter_data to keep rows where Close > 800
4. group_by Year to average closing price
5. pivot_table to format the output table
""")
print(result)
We send a clear and step -by -step prompt to your Prereai agent, asking him to load the CSV, summarize the overall trends, filter prices by more than $ 800, calculate the annual averages and pivot the table. The agent then prints the combined response (including any summary generated or output of data).
In conclusion, we have built a pipeline of end -to -end data powered by agents of praison and Gemini, which come from the download of raw data to insightful visualizations and downloadable reports in some cells. We have seen how the set of declarative tools of Prereai replaces dozens of lines of driver code with concise and readable steps by humans, and how the integrated mechanisms, such as the cache of the results and the invocation of the double -mode API, guarantee both efficiency and reliability.
Sources
Also, don't forget to follow us Twitter And join our Telegram And Linkedin Group. Don't forget to join our 90K + ML Subdreddit.
Asif Razzaq is the CEO of Marktechpost Media Inc .. as a visionary entrepreneur and engineer, AIF undertakes to exploit the potential of artificial intelligence for social good. His most recent company is the launch of an artificial intelligence media platform, Marktechpost, which stands out from its in-depth coverage of automatic learning and in-depth learning news which are both technically solid and easily understandable by a large audience. The platform has more than 2 million monthly views, illustrating its popularity with the public.
