Skip to content

Instantly share code, notes, and snippets.

@sabetAI
Created August 16, 2021 15:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sabetAI/8763aa60a31145fdab837b67715e2821 to your computer and use it in GitHub Desktop.
Save sabetAI/8763aa60a31145fdab837b67715e2821 to your computer and use it in GitHub Desktop.
Example Prompt for Codex /answers
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Answer.create(
search_model="cushman-codex",
model="davinci-codex",
question="Where is the React component FloatingMenu defined?",
examples_context='''public shouldShow: Exclude<FloatingMenuPluginProps['shouldShow'], null> = ({ state }) => {
const { selection } = state
const { $anchor, empty } = selection
const isRootDepth = $anchor.depth === 1
const isEmptyTextBlock = $anchor.parent.isTextblock
&& !$anchor.parent.type.spec.code
&& !$anchor.parent.textContent
if (!empty || !isRootDepth || !isEmptyTextBlock) {
return false
}
return true
}''',
examples=[["What does the shouldShow method do?", "checks if state is empty, depth is root, and text block is empty"]],
file=filename,
max_rerank=10,
max_tokens=500,
stop=["<|endoftext|>", "\n\n==="]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment