-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
27 lines (20 loc) · 663 Bytes
/
Copy pathutils.py
File metadata and controls
27 lines (20 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
https://oai.azure.com/portal/be5567c3dd4d49eb93f58914cccf3f02/deployment
clausa gpt4
"""
import time
import requests
import string
def parse_sectioned_prompt(s):
result = {}
current_header = None
for line in s.split('\n'):
line = line.strip()
if line.startswith('# '):
# first word without punctuation
current_header = line[2:].strip().lower().split()[0]
current_header = current_header.translate(str.maketrans('', '', string.punctuation))
result[current_header] = ''
elif current_header is not None:
result[current_header] += line + '\n'
return result