umwyf commited on
Commit
7deb7d0
1 Parent(s): ac364cd

Delete test_azure.py

Browse files
Files changed (1) hide show
  1. test_azure.py +0 -43
test_azure.py DELETED
@@ -1,43 +0,0 @@
1
- import os
2
- import openai
3
-
4
- def record_progress(filename):
5
- with open('progress.txt', 'a') as f:
6
- f.write(filename + '\n')
7
-
8
- def is_processed(filename):
9
- with open('progress.txt', 'r') as f:
10
- processed_files = f.read().splitlines()
11
- return filename in processed_files
12
-
13
- openai.api_type = "azure"
14
- openai.api_base = "https://openaiserviceforclausaeu.openai.azure.com/"
15
- openai.api_version = "2023-03-15-preview"
16
- openai.api_key = os.getenv("OPENAI_API_KEY")
17
-
18
- test_dirs = os.listdir("prompt_ToMh")
19
- for test_dir in test_dirs:
20
- test_fns = os.listdir(f"prompt_ToMh/{test_dir}")
21
- for test_fn in test_fns:
22
- full_path = f"prompt_ToMh/{test_dir}/{test_fn}"
23
- if is_processed(full_path):
24
- continue
25
- print(test_fn)
26
- print(f"path: {full_path}")
27
- with open(full_path, 'r') as f:
28
- input = f.readlines()
29
- input = "\n".join([inp.strip() for inp in input])
30
- response = openai.ChatCompletion.create(
31
- engine="gpt4-32k",
32
- messages=[
33
- {"role":"system","content":"You are an AI assistant that helps people find information."},
34
- {"role":"user","content": input}
35
- ],
36
- temperature=0,
37
- max_tokens=800,
38
- top_p=0,
39
- frequency_penalty=0,
40
- presence_penalty=0,
41
- stop=None)
42
- print(response)
43
- record_progress(full_path)