t-anhht / react-agents-demo-vertex

This repo is aiming to showcase the potential of ReAct for our customers. Think beyond Search and Conversation!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Agents Demo with Vertex AI (Google Cloud)

Note: This repo is not inteded for production use. It is meant to be used to demo the ReAct pattern with customers and find use cases with them.

ReAct is an intiutive pattern to perform actions using natural language. This demo allows us to showcase a use case of a Recruiter Agent and a HR Agent interacting between each other to send and offer to a candidate.

The demo uses the following tools to fulfill it's mission:

  • A database to find information about the candidate.
  • Google Search to find information.
  • LinkedIn to find the candidate's information.
  • Gmail to generate de draft.
  • Other tools to find suitable dates for interviews.

Alt Text

The demo is based in the awesome work by Eden Marco in this repo.

We use the awesome tool Langchain in this demo. If you don't know about it, you can find a nice video here

Installation

  1. Generate a .env file with the following information:

    • SERPAPI_API_KEY=<API Key for Google Search>
    • PROXYCURL_API_KEY=<API Key for LinkedIn Search>
    • SQL_DATABASE_URI=sqlite:///db/mytest.db
    • X_RAPIDAPI_KEY=<API Key for Glassdoor Salary information>
    • USER_FULLNAME=<The candidate's name>
    • JOB_POSITION=<The Job position we are offering>
    • COMPANY_NAME=<A real company name>

    Some (or most) of the tools require registration. Here you can find information about the tools:

    • Find more information about Serpapi here
    • Find more information about ProxyCurl here
    • Find more information about RapidAPI here
  2. Generate a credentials.json file in the root folder. To do this, follow these steps.

  3. Install dependencies in Pipfile and create pyenv using the following command: pipenv install

  4. Enable the Vertex AI APIs. Click this link.

  5. Run the faker script to create the rows in the database:

     python utils/faker_db.py
    

Recommendations:

API calls requires money. I would encourage you to generate json files with the responses you usually get from these APIs and locate them inside the utils folder. One way to do it is to call the API manually and save the result in both job_salary.json and linkedin_profile.json files. The demo is design to read these if there is an error.

Execution

The demo will mimic this behaviour:

  1. Our recruiter agent will gather information about the candidate and the company using Tools.
  2. That information will be shared with the HR department who is resposible to allocate budget for the salary.
  3. With this information, the recruiter is going to draft an email to the candidate to explaion the position and the salary offer.

To run from the graphical interface run the following command:

streamlit run web/app.py

To run it from the shell, use the following command:

python shell_execution.py

Check your email (once you enabled the app to interact with the agent) drafts to see the draft.

Note: You need to use a gmail account to perform this operation.

Recommendations:

To explain the ReAct pattern, you can use the example_agent.py file to see the results using wikipedia.

More information about lanchain and react here

About

This repo is aiming to showcase the potential of ReAct for our customers. Think beyond Search and Conversation!


Languages

Language:Python 86.9%Language:CSS 13.1%