Added data class and initial functions

This commit is contained in:
2025-11-04 21:20:22 -05:00
parent 554e1d93f8
commit 2448c59f41
2 changed files with 128 additions and 0 deletions

79
src/CSV_Agent.py Normal file
View File

@@ -0,0 +1,79 @@
import os
from typing import List
import csv
import random
import string
from datetime import datetime, timedelta
from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage, AIMessage, BaseMessage
from langchain_core.tools import tool
from langgraph.prebuilt import create_react_agent
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv("OPENAI_APK_KEY")
API_MODEL = os.getenv("OPENAI_MODEL")
###################
###### Tools ######
###################
@tool
def write_csv(filepath: str, data: List[any]) -> str:
"""Write a Python dictionary as CSV to a file."""
header = ['number',
'location',
'state',
'ci',
'priority',
'short_description',
'description',
'assignment_group',
'assigned_to',
'sys_created_on',
]
try:
with open(filepath, 'w', newline='') as csvfile:
writer = csv.DictWriter(csvfile, delimiter=',')
writer.writeheader()
for row in data:
writer.writerow(row)
return f"Successfully wrote a CSV file to '{filepath}'."
except Exception as e:
return f"Error writing CSV file: {str(e)}"
@tool
def generate_test_list(
location: List[str],
state: List[str],
ci: List[str],
priority: List[str],
assigned_to: List[str],
) -> List[dict]:
"""
Generate sample ticket data. Count will be 100 total items.
Args:
location: List of store locations (Will use multiple times)
state: List of possible ticket states (Will use multiple times)
ci: List of the possible configuration items (will use multiple times)
priority: List of possible ticket priorities (Will use multiple times)
assigned_to: List of possible Support Engineers to lead tickets to resolution (Will cycle through)
Returns:
List with 'tickets' dictionary or 'error' message
"""
pass
# number
# location
# state
# ci
# priority
# short_description
# description
# assignment_group
# assigned_to
# sys_created_on
# resolved_at

49
src/CSV_Data.py Normal file
View File

@@ -0,0 +1,49 @@
class CSV_Data:
se_names = ['Nick Kalar', 'Michelle Crawford', 'Jacob Yero', 'Jeff Singleton', 'Kevin Von Stork']
configuration_items = [
'KPS Hardware',
'Bump Bar',
'Sticky Printer',
'Receipt Printer',
'Configuration Issue',
'Order Accuracy Issue',
'New Issue',
'POS Hardware Android',
'Printer Android',
'Card Reader Android',
'Cash Drawer Android',
'Menu Issue Android',
'Connectivity Android',
'New Issues Android',
'POS Hardware iOS',
'Printer iOS',
'Card Reader iOS',
'Cash Drawer iOS',
'Menu Issue iOS',
'Connectivity iOS',
'New Issues iOS',
]
store_locations = [
'Market St',
'Broadway',
'Santa Monica Blvd',
'Abbey Road',
'Bourbon St',
'Wall St',
'Lombard St',
'Canal St',
'Pennsylvania Ave',
'Fifth Ave',
'Los Vegas Strip',
'Miccosukee Rd',
'Magnolia Blvd',
'Baker St',
'Park Ave',
'Madison Ave',
'Washington Ave',
'LAX',
'DFW',
'MIA',
'DEN',
]
ticket_state = ['P1 - Critical', 'P2 - High', 'P3 - Medium', 'P4 - Low']