diff --git a/TA-openai-api/app.manifest b/TA-openai-api/app.manifest index 4a365bc..18be6ba 100644 --- a/TA-openai-api/app.manifest +++ b/TA-openai-api/app.manifest @@ -5,7 +5,7 @@ "id": { "group": null, "name": "TA-openai-api", - "version": "2.1.1" + "version": "2.2.0" }, "author": [ { diff --git a/TA-openai-api/bin/openai.py b/TA-openai-api/bin/openai.py index 724aa5e..175a1d5 100644 --- a/TA-openai-api/bin/openai.py +++ b/TA-openai-api/bin/openai.py @@ -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"): diff --git a/TA-openai-api/default/app.conf b/TA-openai-api/default/app.conf index 2aa46c0..a5234ed 100644 --- a/TA-openai-api/default/app.conf +++ b/TA-openai-api/default/app.conf @@ -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]