Azure OpenAI Connected System

Overview

This plug-in provides Appian developers with direct access to Azure OpenAI’s services, including Chat Completions (ChatGPT), Completions, and Embeddings. Through this connected system, developers can enjoy all the features of Azure’s OpenAI services while also benefiting from the simplicity and ease of use that comes with Appian’s low-code platform.

Integrating these services into your Appian application enables a wide range of use cases.

  • Chat Completions: The Chat Completions endpoint can be used for building chatbots, virtual assistants, text summarization, or any application that requires interactive conversations. An example using text summarization within an Appian app is available at the youtube link listed as a resource below.
  • Completions: Integrating with the Completions endpoint will enable use cases such as drafting emails, generating code, writing articles, or any other text generation tasks.
  • Embeddings: Lastly, the Embeddings endpoint facilitates various downstream tasks, including semantic search, text clustering, and recommendation systems.

Helpful resources:

  • Setting up the Plug-In for Text Summarization of Record Data (Video Tutorial): https://www.youtube.com/watch?v=lQqFFM2T7-M
  • Plug-In Documentation: available as a PDF through download in the App Market or through the Sample Application interface

Key Features & Functionality

  • Chat Completions: This endpoint allows you to create completions using chat messages, utilizing ChatGPT and GPT-4 models. You can have interactive conversations by providing a series of messages as input to the model, which then generates a response.
  • Completions: With this endpoint, you can provide a text command or prompt as input, and the model will generate one or more predicted completions based on the provided prompt. This can be useful for tasks such as generating text, drafting emails, writing code, and more.
  • Embeddings: The Embeddings endpoint enables you to retrieve a vector representation of a given input. These vector representations, often referred to as embeddings, can be used by machine learning models and other algorithms for various downstream tasks such as semantic search, text clustering, recommendation systems, and more.
Anonymous
Parents
  • I am getting the following exception when testing the "Azure OpenAI Completion Integration" operation. Similar error message happens for "Azure OpenAI Chat Completion Integration". I was using similar prompt the screenshots were showing. Operation "Azure OpenAI Embedding Integration" gave a response that wasn't an exception which I've added below. Need advice on how to resolve the exception.

    {
    "Appian is a company that",
    "The Appian platform helps me"
    }

    2023-09-15 15:42:54,989 [Appian Work Item - 463252 - WorkID 344 - execution02 - process 537547255 - model 37288 : UnattendedJavaActivityRequest] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=536886199, classname=com.appiancorp.process.runtime.activities.CallIntegrationActivity
    com.appiancorp.suiteapi.process.framework.ActivityExecutionException: Expression evaluation error in rule 'ao_chatcompletion': com.appiancorp.connectedsystems.templateframework.functions.pipeline.proxyDecoratorPipeline.TemplateInvocationException: Contact the developer of this template to resolve the following issue. java.lang.NullPointerException: null
    	at com.appiancorp.process.runtime.activities.CallIntegrationActivity.executeInternal(CallIntegrationActivity.java:96)
    	at com.appiancorp.process.runtime.activities.CallIntegrationActivity.execute(CallIntegrationActivity.java:56)
    	at com.appiancorp.suiteapi.process.framework.AbstractActivity.perform(AbstractActivity.java:104)
    	at com.appiancorp.process.runtime.framework.LegacyActivityExecutor$2.call(LegacyActivityExecutor.java:90)
    	at com.appiancorp.process.runtime.framework.LegacyActivityExecutor$2.call(LegacyActivityExecutor.java:87)
    	at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:23)
    	at com.appiancorp.process.runtime.framework.LegacyActivityExecutor.execute(LegacyActivityExecutor.java:87)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:88)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequestResponseCreator.getJavaActivityResultResponse(UnattendedJavaActivityRequestResponseCreator.java:22)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.getJavaActivityResultResponse(UnattendedJavaActivityRequest.java:67)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
    	at com.appiancorp.common.persistence.data.AppianDataUserContextProvider.executeWithConsistentDataReads(AppianDataUserContextProvider.java:143)
    	at com.appiancorp.process.engine.ProcessContinuationRequest.executeOuter(ProcessContinuationRequest.java:68)
    	at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:129)
    	at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    	at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:110)
    	at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:241)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    	at java.lang.Thread.run(Thread.java:750)
    Caused by: com.appiancorp.core.expr.exceptions.ExpressionRuntimeException: com.appiancorp.core.expr.exceptions.ExpressionRuntimeException$AppianExceptionProvider: Expression evaluation error in rule 'ao_chatcompletion': com.appiancorp.connectedsystems.templateframework.functions.pipeline.proxyDecoratorPipeline.TemplateInvocationException: Contact the developer of this template to resolve the following issue. java.lang.NullPointerException: null (APNX-1-4198-000)
    	at com.appiancorp.core.expr.fn.OverrideExceptionFunction.eval0(OverrideExceptionFunction.java:163)
    	at com.appiancorp.core.expr.tree.TreeEvaluable.evalWrapped(TreeEvaluable.java:106)
    	at com.appiancorp.core.expr.Tree.eval(Tree.java:441)
    	at com.appiancorp.core.expr.tree.SpecialFunction.eval0(SpecialFunction.java:110)
    	at com.appiancorp.core.expr.Tree.eval(Tree.java:334)
    	at com.appiancorp.core.expr.rule.Rule.evalBody(Rule.java:1506)
    	at com.appiancorp.core.expr.rule.Rule.doEval(Rule.java:899)
    	at com.appiancorp.core.expr.rule.Rule.eval(Rule.java:786)
    	at com.appiancorp.core.expr.rule.Rule.evalAndCache(Rule.java:680)
    	at com.appiancorp.core.expr.rule.Rule.eval(Rule.java:672)
    	at com.appiancorp.core.expr.rule.Rule.evalWithMetrics(Rule.java:653)
    	at com.appiancorp.core.expr.rule.Rule.eval(Rule.java:639)
    	at com.appiancorp.core.expr.tree.FreeformRule.evalWrapped(FreeformRule.java:162)
    	at com.appiancorp.core.expr.Tree.eval(Tree.java:441)
    	at com.appiancorp.core.expr.tree.FreeformRule.eval0(FreeformRule.java:133)
    	at com.appiancorp.core.expr.Tree.eval(Tree.java:334)
    	at com.appiancorp.core.expr.Parse.evalInner(Parse.java:433)
    	at com.appiancorp.core.expr.Parse.eval(Parse.java:383)
    	at com.appiancorp.core.expr.Parse.eval(Parse.java:357)
    	at com.appiancorp.integration.evaluate.IntegrationExpressionEvaluator.evaluate(IntegrationExpressionEvaluator.java:63)
    	at com.appiancorp.integration.evaluate.IntegrationExpressionEvaluator.evaluate(IntegrationExpressionEvaluator.java:49)
    	at com.appiancorp.process.runtime.activities.CallIntegrationActivity.executeInternal(CallIntegrationActivity.java:81)
    	... 19 more

    When I use "Azure OpenAI Embedding Integration" I get the following response.
    {
      "error": {
        "code": "OperationNotSupported",
        "message": "The embeddings operation does not work with the specified model, gpt-35-turbo. Please choose different model and try again. You can learn more about which models can be used with each operation here: ">go.microsoft.com/.../
      }
    }
Comment
  • I am getting the following exception when testing the "Azure OpenAI Completion Integration" operation. Similar error message happens for "Azure OpenAI Chat Completion Integration". I was using similar prompt the screenshots were showing. Operation "Azure OpenAI Embedding Integration" gave a response that wasn't an exception which I've added below. Need advice on how to resolve the exception.

    {
    "Appian is a company that",
    "The Appian platform helps me"
    }

    2023-09-15 15:42:54,989 [Appian Work Item - 463252 - WorkID 344 - execution02 - process 537547255 - model 37288 : UnattendedJavaActivityRequest] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=536886199, classname=com.appiancorp.process.runtime.activities.CallIntegrationActivity
    com.appiancorp.suiteapi.process.framework.ActivityExecutionException: Expression evaluation error in rule 'ao_chatcompletion': com.appiancorp.connectedsystems.templateframework.functions.pipeline.proxyDecoratorPipeline.TemplateInvocationException: Contact the developer of this template to resolve the following issue. java.lang.NullPointerException: null
    	at com.appiancorp.process.runtime.activities.CallIntegrationActivity.executeInternal(CallIntegrationActivity.java:96)
    	at com.appiancorp.process.runtime.activities.CallIntegrationActivity.execute(CallIntegrationActivity.java:56)
    	at com.appiancorp.suiteapi.process.framework.AbstractActivity.perform(AbstractActivity.java:104)
    	at com.appiancorp.process.runtime.framework.LegacyActivityExecutor$2.call(LegacyActivityExecutor.java:90)
    	at com.appiancorp.process.runtime.framework.LegacyActivityExecutor$2.call(LegacyActivityExecutor.java:87)
    	at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:23)
    	at com.appiancorp.process.runtime.framework.LegacyActivityExecutor.execute(LegacyActivityExecutor.java:87)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:88)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequestResponseCreator.getJavaActivityResultResponse(UnattendedJavaActivityRequestResponseCreator.java:22)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.getJavaActivityResultResponse(UnattendedJavaActivityRequest.java:67)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
    	at com.appiancorp.common.persistence.data.AppianDataUserContextProvider.executeWithConsistentDataReads(AppianDataUserContextProvider.java:143)
    	at com.appiancorp.process.engine.ProcessContinuationRequest.executeOuter(ProcessContinuationRequest.java:68)
    	at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:129)
    	at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    	at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:110)
    	at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:241)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    	at java.lang.Thread.run(Thread.java:750)
    Caused by: com.appiancorp.core.expr.exceptions.ExpressionRuntimeException: com.appiancorp.core.expr.exceptions.ExpressionRuntimeException$AppianExceptionProvider: Expression evaluation error in rule 'ao_chatcompletion': com.appiancorp.connectedsystems.templateframework.functions.pipeline.proxyDecoratorPipeline.TemplateInvocationException: Contact the developer of this template to resolve the following issue. java.lang.NullPointerException: null (APNX-1-4198-000)
    	at com.appiancorp.core.expr.fn.OverrideExceptionFunction.eval0(OverrideExceptionFunction.java:163)
    	at com.appiancorp.core.expr.tree.TreeEvaluable.evalWrapped(TreeEvaluable.java:106)
    	at com.appiancorp.core.expr.Tree.eval(Tree.java:441)
    	at com.appiancorp.core.expr.tree.SpecialFunction.eval0(SpecialFunction.java:110)
    	at com.appiancorp.core.expr.Tree.eval(Tree.java:334)
    	at com.appiancorp.core.expr.rule.Rule.evalBody(Rule.java:1506)
    	at com.appiancorp.core.expr.rule.Rule.doEval(Rule.java:899)
    	at com.appiancorp.core.expr.rule.Rule.eval(Rule.java:786)
    	at com.appiancorp.core.expr.rule.Rule.evalAndCache(Rule.java:680)
    	at com.appiancorp.core.expr.rule.Rule.eval(Rule.java:672)
    	at com.appiancorp.core.expr.rule.Rule.evalWithMetrics(Rule.java:653)
    	at com.appiancorp.core.expr.rule.Rule.eval(Rule.java:639)
    	at com.appiancorp.core.expr.tree.FreeformRule.evalWrapped(FreeformRule.java:162)
    	at com.appiancorp.core.expr.Tree.eval(Tree.java:441)
    	at com.appiancorp.core.expr.tree.FreeformRule.eval0(FreeformRule.java:133)
    	at com.appiancorp.core.expr.Tree.eval(Tree.java:334)
    	at com.appiancorp.core.expr.Parse.evalInner(Parse.java:433)
    	at com.appiancorp.core.expr.Parse.eval(Parse.java:383)
    	at com.appiancorp.core.expr.Parse.eval(Parse.java:357)
    	at com.appiancorp.integration.evaluate.IntegrationExpressionEvaluator.evaluate(IntegrationExpressionEvaluator.java:63)
    	at com.appiancorp.integration.evaluate.IntegrationExpressionEvaluator.evaluate(IntegrationExpressionEvaluator.java:49)
    	at com.appiancorp.process.runtime.activities.CallIntegrationActivity.executeInternal(CallIntegrationActivity.java:81)
    	... 19 more

    When I use "Azure OpenAI Embedding Integration" I get the following response.
    {
      "error": {
        "code": "OperationNotSupported",
        "message": "The embeddings operation does not work with the specified model, gpt-35-turbo. Please choose different model and try again. You can learn more about which models can be used with each operation here: ">go.microsoft.com/.../
      }
    }
Children
  • I believe this error exception is being thrown when the following error response is returned by the API. I used the same URL endpoint. After I corrected by deployment model and API version I stopped getting this error message and in the Connected System integration it also started to work for Chat Completion Operation.

    {
        "error": {
            "code": "OperationNotSupported",
            "message": "The completion operation does not work with the specified model, gpt-35-turbo. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993."
        }
    }