Skip to content

Commit

Permalink
♻️ fix some formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tkv29 committed Jan 10, 2024
1 parent 87e5e3c commit 30aaca7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
3 changes: 2 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# pylint: skip-file
# pylint: enable=wrong-import-position
import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tracex.tracex.settings")
# pylint: enable=wrong-import-position

from tracex.extraction.prototype import input_inquiry as ii
from tracex.extraction.prototype import input_handling as ih
Expand Down
2 changes: 2 additions & 0 deletions tracex/extraction/prototype/function_calls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pylint: disable=line-too-long
"""Module providing a functions for using OpenAI function calling."""
TOOLS = [
{
"type": "function",
Expand Down
23 changes: 11 additions & 12 deletions tracex/extraction/prototype/input_handling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""Module providing functions for converting text to CSV."""
import csv

import pandas as pd

from . import utils as u
Expand Down Expand Up @@ -73,9 +71,9 @@ def add_start_dates(text, df):
"""Adds start dates to the bulletpoints."""
name = "start_date"
new_df = pd.DataFrame([], columns=[name])
list = df.values.tolist()
values_list = df.values.tolist()
i = 0
for item in list:
for item in values_list:
messages = [
{"role": "system", "content": p.START_DATE_CONTEXT},
{
Expand Down Expand Up @@ -115,9 +113,9 @@ def add_end_dates(text, df):
"""Adds end dates to the bulletpoints."""
name = "end_date"
new_df = pd.DataFrame([], columns=[name])
list = df.values.tolist()
values_list = df.values.tolist()
i = 0
for item in list:
for item in values_list:
messages = [
{"role": "system", "content": p.END_DATE_CONTEXT},
{
Expand Down Expand Up @@ -159,9 +157,9 @@ def add_durations(text, df):
"""Adds durations to the bulletpoints."""
name = "duration"
new_df = pd.DataFrame([], columns=[name])
list = df.values.tolist()
values_list = df.values.tolist()
i = 0
for item in list:
for item in values_list:
messages = [
{"role": "system", "content": p.DURATION_CONTEXT},
{
Expand Down Expand Up @@ -205,9 +203,9 @@ def add_event_types(df):
"""Adds event types to the bulletpoints."""
name = "event_type"
new_df = pd.DataFrame([], columns=[name])
list = df.values.tolist()
values_list = df.values.tolist()
i = 0
for item in list:
for item in values_list:
messages = [
{"role": "system", "content": p.EVENT_TYPE_CONTEXT},
{
Expand Down Expand Up @@ -243,10 +241,10 @@ def add_locations(df):
"""Adds locations to the bulletpoints."""
name = "attribute_location"
new_df = pd.DataFrame([], columns=[name])
list = df.values.tolist()
values_list = df.values.tolist()
event_type_key = df.columns.get_loc("event_type")
i = 0
for item in list:
for item in values_list:
print(item[0], end="\r")
messages = [
{"role": "system", "content": p.LOCATION_CONTEXT},
Expand Down Expand Up @@ -283,6 +281,7 @@ def add_locations(df):


def convert_dataframe_to_csv(df):
"""Converts the dataframe to CSV and save it on disk."""
output_path = u.output_path / "single_trace.csv"
df.insert(loc=0, column="case_id", value="0")
df.to_csv(
Expand Down
4 changes: 2 additions & 2 deletions tracex/extraction/prototype/utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# pylint: disable=W0102
"""Module providing constants for the project."""
import os
import time
import json
from pathlib import Path
from django.conf import settings
from . import function_calls as fc

from openai import OpenAI
from . import function_calls as fc

client = OpenAI()

Expand Down

0 comments on commit 30aaca7

Please sign in to comment.