Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoWorms authored Nov 16, 2023
1 parent 0b661e0 commit 4d15c87
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os
import openai

openai.api_key = os.getenv('OPENAI_API_KEY')

knowledge_base = ''
with open('knowledge-base.txt', 'r', encoding="utf-8") as file:
knowledge_base = file.read()

response = openai.chat.completions.create(
model="gpt-4-1106-preview",
temperature=0,
messages=[
{
"role": "system",
# example for ygenius
"content": "You are a bot helping people understand Yearn Finance (aka Yearn). I have prefixed documents that help you understand what is Yearn, answer the user question using the source files and tell the source of your answer. The answer must exist within the source files, otherwise don't answer. You can use ```language to write code that shows in a pretty way. If the task is of creative nature it's ok to go wild and beyons just the sources, but MUST state that the answer is creative if this happens. Do not invent anything about ape that is not in source files unless you said you were going creative. False certanty about what ape can do is the worse thing you can do, avoid it at all costs."
},
{
"role": "user",
"content": knowledge_base
},
{
"role": "user",
# add your question here
"content": "What can you do to help me explore Yearn?"
}
],
)

bot_response = response.choices[0].message.content

print(bot_response)

0 comments on commit 4d15c87

Please sign in to comment.