Skip to content

Commit

Permalink
Merge pull request #19 from bentleymi/V.2.2.0
Browse files Browse the repository at this point in the history
V2.2.0 - Adding 'prompt_field' option to openai command
  • Loading branch information
bentleymi authored May 23, 2023
2 parents f1d33ff + 2564b90 commit b2eca21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TA-openai-api/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": {
"group": null,
"name": "TA-openai-api",
"version": "2.1.1"
"version": "2.2.0"
},
"author": [
{
Expand Down
7 changes: 6 additions & 1 deletion TA-openai-api/bin/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ def execute():
results,dummyresults,settings = splunk.Intersplunk.getOrganizedResults()
sessionKey = settings.get("sessionKey")
openai.api_key, openai.organization = getOpenAIConfig(sessionKey)

for result in results:
if 'prompt_field' in options:
'''
Stream the field through as the prompt instead, replaced [\n|\r]+ with \n
'''
prompt=re.sub(r'[\n\r]+', '\n\n', result[options['field']])
if 'task' in options:
if options['task'].lower() in ("chat","chatcompletion"):
if model not in ("gpt-3.5-turbo","gpt-3.5-turbo-0301"):
Expand Down
2 changes: 1 addition & 1 deletion TA-openai-api/default/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ install_source_checksum = 49d36b4c5fee1647cc92f2f2203ed33fcb38cd11

[launcher]
author = Splunkable LLC
version = 2.1.1
version = 2.2.0
description = Send queries to OpenAI ChatGPT API and enrich your Splunk searches with the results while safeguarding Security and Privacy.

[ui]
Expand Down

0 comments on commit b2eca21

Please sign in to comment.