INNER CODE UNIT · Python

prep_for_put

aws-samples/rag-using-langchain-amazon-bedrock-and-opensearch · utils/dataset.py:49

def prep_for_put(file_path):
    logger.info(f"Loading file {file_path}")
    all_records = []
    with open(file_path, 'r') as f:
        for line in f:
            row = json.loads(line)
            text = f"question: {row[0]}, answer: {row[1]}"
            all_records.append(text)
        return all_records


def delete_file(file_path):
    logger.info(f"Deleting file {file_path}")
    try:
        os.remove(file_path)
    except Exception as e:
        logger.error(e)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…