Skip to content

Instantly share code, notes, and snippets.

@rkreddyp
Created October 26, 2023 22:16
Show Gist options
  • Save rkreddyp/0bc3d17f01a60ba45835e601dc4531b1 to your computer and use it in GitHub Desktop.
Save rkreddyp/0bc3d17f01a60ba45835e601dc4531b1 to your computer and use it in GitHub Desktop.
llm_filter_prompt
def ask_llm_to_get_filter (items, query):
all_text = get_all_items (items)
#all_text = get_all_above_score (items, 0.9)
role = 'you are an expert at going through text and finding filter expressions inside text given for specific task. Only use the functions you have been provided with.'
desc = """
# how to find the filter expresison
- the filter expressions have characters with dots inside them.
- the task that the filter expression will help with is right around the that filter expression
- you must pick one filter expression that best suits the task , the event filter must not have OR or AND
for example , in the below text, system.org.captcha.deactivate is the filter expression for
disabling captcha for all users across the company.
'system.org.captcha.deactivate\n'
'Disable org-wide captcha support. Indicates when '
'org-wide captcha support is disabled. This event is '
'fired when org admin disables org-wide captcha support '
'for all pages.\n'
"""
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo-16k",
messages=[
{ "role": "system", "content": role + "\n task:" + query },
{ "role": "user", "content": desc + "\ntext:" + all_text}
],
functions = [okta_filters.openai_schema],
temperature=0.5,
max_tokens=8000
)
print (response)
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment