mirror of
https://github.com/hackertron/LucidLoanMachine.git
synced 2026-01-09 20:47:57 -05:00
verify dkim using zkemail prove api, wip
This commit is contained in:
21
main.py
21
main.py
@@ -1,7 +1,8 @@
|
||||
import autogen
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from typing import Annotated
|
||||
import requests
|
||||
load_dotenv() # take environment variables from .env.
|
||||
config_list = [
|
||||
{
|
||||
@@ -18,6 +19,13 @@ llm_config = {
|
||||
|
||||
}
|
||||
|
||||
def verify_email_with_prove_api(domain :Annotated[str, "The domain name to verify"]) -> Annotated[dict, "The response from the Prove Email API"] | None:
|
||||
api_url = f"https://archive.prove.email/api/key?domain={domain}"
|
||||
response = requests.get(api_url)
|
||||
return response.json() if response.status_code == 200 else None
|
||||
|
||||
|
||||
|
||||
front_desk_assistant = autogen.AssistantAgent(
|
||||
name="front_desk_assistant",
|
||||
llm_config=llm_config,
|
||||
@@ -39,6 +47,8 @@ email_assistant = autogen.AssistantAgent(
|
||||
You will then analyze the email and check if it's valid and details matches with bank.json."""
|
||||
)
|
||||
|
||||
|
||||
|
||||
salary_slip_assistant = autogen.AssistantAgent(
|
||||
name="salary_slip_assistant",
|
||||
llm_config=llm_config,
|
||||
@@ -67,7 +77,16 @@ user_proxy = autogen.UserProxyAgent(
|
||||
otherwise, reply CONTINUE, or the reason why the task is not solved yet."""
|
||||
)
|
||||
|
||||
user_proxy.register_for_llm(name="verify_email", description="verify email's dkim using prove api verify_email_with_prove_api")(verify_email_with_prove_api)
|
||||
user_proxy.register_for_execution(name="verify_email")(verify_email_with_prove_api)
|
||||
|
||||
def main():
|
||||
# Register the verify_email_with_prove_api function for the email_assistant
|
||||
email_assistant.register_function(
|
||||
function_map={
|
||||
"verify_email_with_prove_api": verify_email_with_prove_api
|
||||
}
|
||||
)
|
||||
chat_results = user_proxy.initiate_chats([
|
||||
{
|
||||
"recipient": front_desk_assistant,
|
||||
|
||||
Reference in New Issue
Block a user