You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "fjtirado (via GitHub)" <gi...@apache.org> on 2024/03/18 13:15:18 UTC

[PR] [Fix #599] [incubator-kie-kogito-docs]

fjtirado opened a new pull request, #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600

   <!-- Please don't forget your Issue link -->
   Fixes https://github.com/apache/incubator-kie-kogito-docs/issues/599
   
   <!-- Please provide a short description of what this PR does -->
   **Description:**
   Add python documentation
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1530493176


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file

Review Comment:
   ```suggestion
    To enable Python support, you must add the Python add-on dependency to your {prouct_name} module `pom.xml` file
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1531865320


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 
+
+[source,json]
+----
+ "functions": [
+    {
+      "name": "python",
+      "type": "custom",
+      "operation": "script:python"
+    }
+  ]
+----
+
+Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. 
+
+[source,json]
+----
+"functionRef": 
+    "refName": "python",
+    "arguments": {
+      "script": "import numpy as np"
+     }
+ }
+----
+
+Previous snippet imports link:https://numpy.org/[numpy] library. The same python function can be invoked again to generate an array containing three random numbers between 0 and 10. 
+
+[source,json]
+----
+"functionRef": {
+   "refName": "python",
+   "arguments": {
+      "script": "rng = np.random.default_rng().integers(low=0,high=10,size=3)"
+    }
+  }
+----
+
+To access the result of the embedded python invocation, {product_name} provides an special context variable: `$WORKFLOW.python`. Therefore, if you want to set `rng` variable from previous script as `output` property of the workflow model, you write 
+
+[source,json]
+----
+"stateDataFilter" : {
+  "output" : "{result:$WORKFLOW.python.rng}"
+}
+----
+
+== Invoking Python function. 
+
+You can also invoke functions from standard or custom python modules. 
+
+You need to define a serverless workflow function definition that invokes the python function. You should specific, within `operation` property, the name of the python module and function to be invoked when the function is called. You should separate the module name and the function name using `::` and prefix them with `services::python:`
+
+The following example defines a function that invokes standard python function link:https://www.geeksforgeeks.org/python-math-factorial-function/[math.factorial(x)]
+[source,json]
+----
+ "functions" : [ {
+    "name" : "factorial",
+    "operation" : "service:python:math::factorial",
+    "type" : "custom"
+  } 
+----
+
+Once you have defined the function, you might call it passing the expected arguments. In the case of factorial, a integer stored in property `x` of the workflow model. 
+
+[source,json]
+----
+ "functionRef" : {
+          "refName": "factorial",
+          "arguments" : ".x"
+       }
+----
+
+The return value of the function can be handled as any other function result using `actionDataFilter.toStateData` Serverless Workflow construct. The following will set a workflow model property called `result` with the factorial invocation returned value. 

Review Comment:
   ```suggestion
   The return value of the function can be handled as any other function result using the `actionDataFilter.toStateData` Serverless Workflow construct. The following will set a workflow model property called `result` with the factorial invocation returned value. 
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1531864208


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 
+
+[source,json]
+----
+ "functions": [
+    {
+      "name": "python",
+      "type": "custom",
+      "operation": "script:python"
+    }
+  ]
+----
+
+Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. 
+
+[source,json]
+----
+"functionRef": 
+    "refName": "python",
+    "arguments": {
+      "script": "import numpy as np"
+     }
+ }
+----
+
+Previous snippet imports link:https://numpy.org/[numpy] library. The same python function can be invoked again to generate an array containing three random numbers between 0 and 10. 
+
+[source,json]
+----
+"functionRef": {
+   "refName": "python",
+   "arguments": {
+      "script": "rng = np.random.default_rng().integers(low=0,high=10,size=3)"
+    }
+  }
+----
+
+To access the result of the embedded python invocation, {product_name} provides an special context variable: `$WORKFLOW.python`. Therefore, if you want to set `rng` variable from previous script as `output` property of the workflow model, you write 
+
+[source,json]
+----
+"stateDataFilter" : {
+  "output" : "{result:$WORKFLOW.python.rng}"
+}
+----
+
+== Invoking Python function. 
+
+You can also invoke functions from standard or custom python modules. 
+
+You need to define a serverless workflow function definition that invokes the python function. You should specific, within `operation` property, the name of the python module and function to be invoked when the function is called. You should separate the module name and the function name using `::` and prefix them with `services::python:`

Review Comment:
   ```suggestion
   You must define a serverless workflow function definition that invokes the Python function. You should specify, within the `operation` property, the name of the Python module and function to be invoked when the function is called. You should separate the module name and the function name using `::` and prefix them with `services::python:`
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1530493887


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.

Review Comment:
   ```suggestion
   {product_name} supports the execution of Python script in the same memory address as the running workflow.
   ```



##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 

Review Comment:
   ```suggestion
   To invoke a Python script the first step is to define a custom Python function at the beginning of the flow. 
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] [incubator-kie-kogito-docs]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#issuecomment-2003881262

   🎊 PR Preview 49a9bc487032c649a7feb7400ac35ef237f5dc65 has been successfully built and deployed. See the documentation preview: https://sonataflow-docs-preview-pr-600.surge.sh
   <!-- Sticky Pull Request Comment -->
   <!-- Sticky Pull Request Comment -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1531862397


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 
+
+[source,json]
+----
+ "functions": [
+    {
+      "name": "python",
+      "type": "custom",
+      "operation": "script:python"
+    }
+  ]
+----
+
+Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. 

Review Comment:
   ```suggestion
   Once done, you can use that function several times to execute arbitrary Python code. The Python code is provided as an argument of the function call through the `script` property. 
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1531865908


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 
+
+[source,json]
+----
+ "functions": [
+    {
+      "name": "python",
+      "type": "custom",
+      "operation": "script:python"
+    }
+  ]
+----
+
+Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. 
+
+[source,json]
+----
+"functionRef": 
+    "refName": "python",
+    "arguments": {
+      "script": "import numpy as np"
+     }
+ }
+----
+
+Previous snippet imports link:https://numpy.org/[numpy] library. The same python function can be invoked again to generate an array containing three random numbers between 0 and 10. 
+
+[source,json]
+----
+"functionRef": {
+   "refName": "python",
+   "arguments": {
+      "script": "rng = np.random.default_rng().integers(low=0,high=10,size=3)"
+    }
+  }
+----
+
+To access the result of the embedded python invocation, {product_name} provides an special context variable: `$WORKFLOW.python`. Therefore, if you want to set `rng` variable from previous script as `output` property of the workflow model, you write 
+
+[source,json]
+----
+"stateDataFilter" : {
+  "output" : "{result:$WORKFLOW.python.rng}"
+}
+----
+
+== Invoking Python function. 
+
+You can also invoke functions from standard or custom python modules. 
+
+You need to define a serverless workflow function definition that invokes the python function. You should specific, within `operation` property, the name of the python module and function to be invoked when the function is called. You should separate the module name and the function name using `::` and prefix them with `services::python:`
+
+The following example defines a function that invokes standard python function link:https://www.geeksforgeeks.org/python-math-factorial-function/[math.factorial(x)]
+[source,json]
+----
+ "functions" : [ {
+    "name" : "factorial",
+    "operation" : "service:python:math::factorial",
+    "type" : "custom"
+  } 
+----
+
+Once you have defined the function, you might call it passing the expected arguments. In the case of factorial, a integer stored in property `x` of the workflow model. 
+
+[source,json]
+----
+ "functionRef" : {
+          "refName": "factorial",
+          "arguments" : ".x"
+       }
+----
+
+The return value of the function can be handled as any other function result using `actionDataFilter.toStateData` Serverless Workflow construct. The following will set a workflow model property called `result` with the factorial invocation returned value. 
+
+[source,json]
+----
+  "actionDataFilter" : {
+        "toStateData" : ".result"
+      }
+----
+
+== Further reading 
+
+The link:{kogito_sw_examples_url}/serverless-workflow-openvino-quarkus[Openvino] illustrates the powerful AI capabilities of integrating workflows with Python. It is a must seen for all interested on the topic. 

Review Comment:
   ```suggestion
   The link:{kogito_sw_examples_url}/serverless-workflow-openvino-quarkus[Openvino] illustrates the powerful AI capabilities of integrating workflows with Python. It is a must-see for all interested in the topic. 
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1530453986


##########
serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc:
##########
@@ -300,6 +300,10 @@ The Camel route is responsible to produce the return value in a way that the wor
 
 include::../../pages/_common-content/camel-valid-responses.adoc[]
 
+[[con-func-python]
+== Python custom function
+{product_name} provides an implementation of a custom function to execute embedded Python scripts and functions. See xref:use-cases/advanced-developer-use-cases/integrations/custom-functions-knative.adoc[Invoking Python from {product_name}]

Review Comment:
   ```suggestion
   {product_name} implements a custom function to execute embedded Python scripts and functions. See xref:use-cases/advanced-developer-use-cases/integrations/custom-functions-knative.adoc[Invoking Python from {product_name}]
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1531864768


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 
+
+[source,json]
+----
+ "functions": [
+    {
+      "name": "python",
+      "type": "custom",
+      "operation": "script:python"
+    }
+  ]
+----
+
+Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. 
+
+[source,json]
+----
+"functionRef": 
+    "refName": "python",
+    "arguments": {
+      "script": "import numpy as np"
+     }
+ }
+----
+
+Previous snippet imports link:https://numpy.org/[numpy] library. The same python function can be invoked again to generate an array containing three random numbers between 0 and 10. 
+
+[source,json]
+----
+"functionRef": {
+   "refName": "python",
+   "arguments": {
+      "script": "rng = np.random.default_rng().integers(low=0,high=10,size=3)"
+    }
+  }
+----
+
+To access the result of the embedded python invocation, {product_name} provides an special context variable: `$WORKFLOW.python`. Therefore, if you want to set `rng` variable from previous script as `output` property of the workflow model, you write 
+
+[source,json]
+----
+"stateDataFilter" : {
+  "output" : "{result:$WORKFLOW.python.rng}"
+}
+----
+
+== Invoking Python function. 
+
+You can also invoke functions from standard or custom python modules. 
+
+You need to define a serverless workflow function definition that invokes the python function. You should specific, within `operation` property, the name of the python module and function to be invoked when the function is called. You should separate the module name and the function name using `::` and prefix them with `services::python:`
+
+The following example defines a function that invokes standard python function link:https://www.geeksforgeeks.org/python-math-factorial-function/[math.factorial(x)]

Review Comment:
   ```suggestion
   The following example defines a function that invokes a standard Python function link:https://www.geeksforgeeks.org/python-math-factorial-function/[math.factorial(x)]
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1531862955


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 
+
+[source,json]
+----
+ "functions": [
+    {
+      "name": "python",
+      "type": "custom",
+      "operation": "script:python"
+    }
+  ]
+----
+
+Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. 
+
+[source,json]
+----
+"functionRef": 
+    "refName": "python",
+    "arguments": {
+      "script": "import numpy as np"
+     }
+ }
+----
+
+Previous snippet imports link:https://numpy.org/[numpy] library. The same python function can be invoked again to generate an array containing three random numbers between 0 and 10. 

Review Comment:
   ```suggestion
   Previous snippet imports link:https://numpy.org/[numpy] library. The same Python function can be invoked again to generate an array containing three random numbers between `0` and `10`. 
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "domhanak (via GitHub)" <gi...@apache.org>.
domhanak merged PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1531863318


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,115 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 
+
+[source,json]
+----
+ "functions": [
+    {
+      "name": "python",
+      "type": "custom",
+      "operation": "script:python"
+    }
+  ]
+----
+
+Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. 
+
+[source,json]
+----
+"functionRef": 
+    "refName": "python",
+    "arguments": {
+      "script": "import numpy as np"
+     }
+ }
+----
+
+Previous snippet imports link:https://numpy.org/[numpy] library. The same python function can be invoked again to generate an array containing three random numbers between 0 and 10. 
+
+[source,json]
+----
+"functionRef": {
+   "refName": "python",
+   "arguments": {
+      "script": "rng = np.random.default_rng().integers(low=0,high=10,size=3)"
+    }
+  }
+----
+
+To access the result of the embedded python invocation, {product_name} provides an special context variable: `$WORKFLOW.python`. Therefore, if you want to set `rng` variable from previous script as `output` property of the workflow model, you write 

Review Comment:
   ```suggestion
   To access the result of the embedded python invocation, {product_name} provides a special context variable: `$WORKFLOW.python`. Therefore, if you want to set the `rng` variable from the previous script as the `output` property of the workflow model, you write 
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "gmunozfe (via GitHub)" <gi...@apache.org>.
gmunozfe commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1530035527


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,116 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and function into you workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support you need to the python add-on dependency to your {prouct_name} module `pom.xml` file

Review Comment:
   ```suggestion
    To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
   ```



##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,116 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and function into you workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.

Review Comment:
   ```suggestion
   This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
   ```



##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,116 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and function into you workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 
+
+[source,json]
+----
+ "functions": [
+    {
+      "name": "python",
+      "type": "custom",
+      "operation": "script:python"
+    }
+  ]
+----
+
+Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. 
+
+[source,json]
+----
+"functionRef": 
+   "name" : "Imports",

Review Comment:
   Shouldn't it be lowercase following python function naming convention?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#discussion_r1530223177


##########
serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc:
##########
@@ -0,0 +1,116 @@
+= Invoking Python from {product_name}
+:compat-mode!:
+// Metadata:
+:description: Describe Python execution capabilities
+:keywords: kogito, workflow, quarkus, serverless, python, AI
+
+This document describes how to integrate python scripts and function into you workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test.
+
+== Enable Python support
+
+ To enable Python support you need to the python add-on dependency to your {prouct_name} module `pom.xml` file
+
+[source,xml]
+----
+<dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-addons-quarkus-python</artifactId>
+</dependency>
+----
+
+== Invoking embedded Python script.
+
+{product_name} supports of execution python script in the same memory address than the running workflow.
+
+To invoke a python script the first step is to define a custom python function at the beginning of the flow. 
+
+[source,json]
+----
+ "functions": [
+    {
+      "name": "python",
+      "type": "custom",
+      "operation": "script:python"
+    }
+  ]
+----
+
+Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. 
+
+[source,json]
+----
+"functionRef": 
+   "name" : "Imports",

Review Comment:
   Actually this name should not be there at all ;)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #599] Add Python documentation [incubator-kie-kogito-docs]

Posted by "ricardozanini (via GitHub)" <gi...@apache.org>.
ricardozanini commented on PR #600:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/600#issuecomment-2007185773

   @kaldesai can you please take a look?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org