Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanwahab committed Oct 13, 2024
1 parent 9122513 commit 77e4d7e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions infra/scripts/course_gen_step_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def empty_file(output_dir):
def parse_gpt(results):
comp = results
if len(comp.choices) == 0:
return print('No completion available')
return None

message_content = comp.choices[0].message.content
return message_content
Expand Down Expand Up @@ -127,6 +127,7 @@ def process_chunk(query, filename, content, index):
# is jupyter a thing? try collarobaroty - add currsor - to obs+jpy - (LLM_prediciton_planning, cgi, hardware)
# add in dict types from fastapi -
def process_all_files_in_directory(query, directory_path):
print('processing all files in directory', directory_path)
files = [os.path.join(directory_path, filename) for filename in os.listdir(directory_path) if filename.endswith('.md')]
file_contents = [open(file_path, 'r').read() for file_path in files]
file_dict = {file_path: content for file_path, content in zip(files, file_contents)}
Expand Down Expand Up @@ -182,8 +183,8 @@ def process_all_files_in_directory(query, directory_path):

# Example usage
json_file_path = 'data/robotics-odyssey/modules.json'
input_dir = 'data/robotics-odyssey/'
output_dir = 'course_content/docs'
input_dir = 'course_content/src'
output_dir = 'course_content/src'



Expand Down Expand Up @@ -216,4 +217,4 @@ def process_all_files_in_directory(query, directory_path):
# output_dir = args.output_dir
# judgment / design / choice /
# Initialize the OpenAI client with the API key
# Retrieve the OpenAI API key from the environment variable
# Retrieve the OpenAI API key from the environment variable

0 comments on commit 77e4d7e

Please sign in to comment.