Upload 8 files
Browse filesUsed for the first stage of the research.
- research_1/code_example.jsonl +2 -0
- research_1/code_generator_instructions.jsonl +1 -0
- research_1/code_generator_model_training_data.jsonl +1 -0
- research_1/code_generator_prompts.jsonl +2 -0
- research_1/py_language_definition.jsonl +2 -0
- research_1/qa.jsonl +2 -0
- research_1/test.py +38 -0
- research_1/train.jsonl +6 -0
research_1/code_example.jsonl
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
{"id": "single-line-comment", "prompt": "Write a comment in the Python programming language.", "completion": "# i am a comment" }
|
2 |
+
{"id": "hellow-world-program", "prompt": "Write a hello world program in the Python programming language.", "completion": "#!/usr/bin/env python \n print('hello world)'" }
|
research_1/code_generator_instructions.jsonl
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{ "prompt": "in Python, the print() is used to display output to the screen. for example: print(\"Hello World\"", "completion": "print(\"I will be displayed to the screen\"" }
|
research_1/code_generator_model_training_data.jsonl
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{ "prompt": "in Python, the print() is used to display output to the screen. for example: print(\"Hello World\"", "completion": "print(\"I will be displayed to the screen\"" }
|
research_1/code_generator_prompts.jsonl
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
{ "id": "single-line-comment", "prompt": "Write a comment in the Python programming language.", "completion": "# This is a comment" }
|
2 |
+
{ "TBD": "tbd", "TBD": "tbd", "TBD": "tbd" }
|
research_1/py_language_definition.jsonl
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
{"prompt": "How are keywords written in the Python programming language?", "completion": "In the Python programming language, keywords are typically written in lowercase. For example, `print \"print should be written in lowercase letters\"`.", "classification": "Syntax"}
|
2 |
+
{"prompt": "How are local variables to a procedure declared in Python?", "completion": "In Python, variables local to the procedure are declared using the name of the keyword followed by the variable = and then some value. By default, variables are empty strings. For instance, `mode=''`.", "classification": "Variables & Data Types"}
|
research_1/qa.jsonl
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
{ "prompt": "What kind of programming language is Python?", "completion": "Python is an interpreted, object-oriented, high-level programming language." }
|
2 |
+
{ "prompt": "How do you compile Python programs?", "completion": "Python is an interpreted language, and you can run the scripts directly, either using: python hello.py or make your script executable by adding #!/usr/bin/env python to the top of the script, making the file executable with chmod +x hello.py and then running: ./hello.py. You may also try compileall: python -m compileall ./" }
|
research_1/test.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_community.vectorstores import FAISS
|
2 |
+
from langchain_openai import OpenAIEmbeddings
|
3 |
+
from langchain_text_splitters import CharacterTextSplitter
|
4 |
+
from langchain_community.document_loaders import TextLoader
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
loader = TextLoader("../../state_of_the_union.txt")
|
9 |
+
documents = loader.load()
|
10 |
+
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
|
11 |
+
texts = text_splitter.split_documents(documents)
|
12 |
+
embeddings = OpenAIEmbeddings()
|
13 |
+
db = FAISS.from_documents(texts, embeddings)
|
14 |
+
|
15 |
+
retriever = db.as_retriever()
|
16 |
+
docs = retriever.invoke("what did he say about ketanji brown jackson")
|
17 |
+
|
18 |
+
|
19 |
+
# Maximum marginal relevance retrieval
|
20 |
+
#By default, the vector store retriever uses similarity search. If the underlying vector store supports maximum marginal relevance search, you can specify that as the search type.
|
21 |
+
retriever = db.as_retriever(search_type="mmr")
|
22 |
+
docs = retriever.invoke("what did he say about ketanji brown jackson")
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
#Similarity score threshold retrieval
|
27 |
+
retriever = db.as_retriever(
|
28 |
+
search_type="similarity_score_threshold", search_kwargs={"score_threshold": 0.5}
|
29 |
+
)
|
30 |
+
docs = retriever.invoke("what did he say about ketanji brown jackson")
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
#Specifying top k
|
35 |
+
#You can also specify search kwargs like k to use when doing retrieval.
|
36 |
+
retriever = db.as_retriever(search_kwargs={"k": 1})
|
37 |
+
docs = retriever.invoke("what did he say about ketanji brown jackson")
|
38 |
+
len(docs)
|
research_1/train.jsonl
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{"text": "<s>[INST] What kind of programming language is Python? [/INST] Python is an interpreted, object-oriented, high-level programming language. </s>"}
|
2 |
+
{"text": "<s>[INST] How do you compile Python programs? [/INST] Python is an interpreted language, and you can run the scripts directly, either using: python hello.py or make your script executable by adding #!/usr/bin/env python to the top of the script, making the file executable with chmod +x hello.py and then running: ./hello.py. You may also try compileall: python -m compileall ./ </s>"}
|
3 |
+
{"text": "<s>[INST] How are keywords written in the Python programming language? [/INST] In the Python programming language, keywords are typically written in lowercase. For example, `print \"print should be written in lowercase letters\"`. </s>"}
|
4 |
+
{"text": "<s>[INST] How are local variables to a procedure declared in Python? [/INST] In Python, variables local to the procedure are declared using the name of the keyword followed by the variable = and then some value. By default, variables are empty strings. For instance, `mode=''`. </s>"}
|
5 |
+
{"text": "<s>[INST] Write a comment in the Python programming language. [/INST] # i am a comment </s>"}
|
6 |
+
{"text": "<s>[INST] Write a hello world program in the Python programming language. [/INST] #!/usr/bin/env python \n print('hello world)' </s>"}
|