Skip to content

Commit

Permalink
Adding os.path.join to path combinations
Browse files Browse the repository at this point in the history
  • Loading branch information
dgbaenar committed Sep 3, 2024
1 parent bb0f861 commit e7d78ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@


# Load config
INPUT_PATH = os.path.dirname(__file__) + "/data/input_estimate_costs.json"
INPUT_PATH = os.path.join(os.path.dirname(__file__), "data", "input_estimate_costs.json")

with open(INPUT_PATH, "r") as config_file:
config = json.load(config_file)

Expand All @@ -28,7 +29,7 @@
REFERENCE_ANSWER_COLUMN = config.get("REFERENCE_ANSWER_COLUMN")

# Output costs
OUTPUT_COSTS = os.path.dirname(__file__) + "/data/output_estimate_costs.txt"
OUTPUT_COSTS = os.path.join(os.path.dirname(__file__), "data", "output_estimate_costs.txt")
COST_PER_MILLION_INPUT_TOKENS= config.get("COST_PER_MILLION_INPUT_TOKENS")
COST_PER_MILLION_OUTPUT_TOKENS= config.get("COST_PER_MILLION_OUTPUT_TOKENS")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


# Load config
with open(os.path.join(os.path.dirname(__file__), "/data/input_generate_responses.json"), "r") as config_file:
with open(os.path.join(os.path.dirname(__file__), "data", "input_generate_responses.json"), "r") as config_file:
config = json.load(config_file)

DATA_DIR = os.path.abspath(os.path.join(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
load_dotenv()

# Load config
INPUT_PATH = os.path.dirname(__file__) + "/data/input_get_metrics.json"
INPUT_PATH = os.path.join(os.path.dirname(
__file__), "data", "input_get_metrics.json")
with open(INPUT_PATH, "r") as config_file:
config = json.load(config_file)

Expand All @@ -36,8 +37,8 @@
DATA_DIR, "openai_outputs", config["CORRECTNESS_RESULTS_CSV"])
FAITHFULNESS_RESULTS_CSV = os.path.join(
DATA_DIR, "openai_outputs", config["FAITHFULNESS_RESULTS_CSV"])
RESULT_METRICS_TXT = os.path.dirname(
__file__) + "/data/output_generation_metrics.txt"
RESULT_METRICS_TXT = os.path.join(os.path.dirname(
__file__), "data", "output_generation_metrics.txt")

# Columns of interest
QUERY_COLUMN = config["QUERY_COLUMN"]
Expand Down Expand Up @@ -65,7 +66,7 @@ def main():

generated_answers[REFERENCE_ANSWER_COLUMN] = reference_answers[REFERENCE_ANSWER_COLUMN]
generated_answers[RESOURCE_ID_COLUMN] = reference_answers[RESOURCE_ID_COLUMN]

# Instantiate evaluators
correctness_evaluator = CorrectnessEvaluator(OPENAI_API_KEY,
LLM_MODEL,
Expand Down Expand Up @@ -119,7 +120,8 @@ def main():

if UPLOAD_ARTIFACTS:
for artifact_name, file_path in artifact_files.items():
task.upload_artifact(name=artifact_name, artifact_object=file_path)
task.upload_artifact(name=artifact_name,
artifact_object=file_path)

task.close()

Expand Down

0 comments on commit e7d78ec

Please sign in to comment.