Skip to content

Commit 6c661dc

Browse files
PipKatRobPasMue
andauthored
doc: Minor edits to meet PyAnsys style (#5)
* Minor edits to meet PyAnsys style * Update README.md --------- Co-authored-by: Roberto Pastor Muela <[email protected]>
1 parent 133a1fd commit 6c661dc

File tree

1 file changed

+75
-71
lines changed

1 file changed

+75
-71
lines changed

README.md

Lines changed: 75 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
# Allie FlowKit Python
22

3-
Welcome to the **Allie FlowKit Python** repository! This repository hosts Python functions similar to the [Allie FlowKit](https://github.com/ansys/allie-flowkit) and serves as a service to expose APIs for each individual external function added to it. These functions can be used to build Allie workflows, enabling a flexible and modular approach to creating and executing workflows with Allie.
3+
Welcome to Allie FlowKit Python. This repository hosts Python functions similar to [Allie FlowKit](https://github.com/ansys/allie-flowkit) and provides a service for exposing APIs for each external function added to it. You can use these functions to build Allie workflows, enabling a flexible and modular approach to creating and executing workflows with Allie.
44

5-
## Table of Contents
5+
## Table of contents
66
- [Introduction](#introduction)
7-
- [Purpose](#purpose)
8-
- [How It Works](#how-it-works)
9-
- [Getting Started](#getting-started)
7+
- [Objectives](#objectives)
8+
- [How it works](#how-it-works)
9+
- [Getting started](#getting-started)
1010
- [Prerequisites](#prerequisites)
1111
- [Installation](#installation)
1212
- [Usage](#usage)
13-
- [Adding Custom Functions](#adding-custom-functions)
14-
- [Example Functions](#example-functions)
13+
- [Adding custom functions](#adding-custom-functions)
14+
- [Example functions](#example-functions)
1515
- [Contributing](#contributing)
1616

1717
## Introduction
1818

19-
**Allie FlowKit Python** is designed to host the code for a Python service that exposes REST APIs for each external function added to it. These functions can be seamlessly integrated into Allie workflows and executed by the Allie Agent, making it easier for teams to customize and extend their workflow capabilities.
19+
Allie FlowKit Python is designed to host the code for a Python service that exposes a REST API for each external function added to it. These functions can be seamlessly integrated into Allie workflows and executed by the Allie agent, making it easier for teams to customize and extend their workflow capabilities.
2020

21-
## Purpose
21+
## Objectives
2222

23-
The main purpose of this repository is to:
24-
1. Host Python functions similar to those in the [Allie FlowKit](https://github.com/ansys/allie-flowkit).
25-
2. Provide a service that exposes these functions as REST APIs.
26-
3. Enable the creation of custom Allie workflows using these functions.
27-
4. Allow other teams to add their needed functions to support their specific Allie workflows.
23+
Using Allie Flowkit Python lets you achieve these key objectives:
2824

29-
## How It Works
25+
- Host Python functions similar to those in [Allie FlowKit](https://github.com/ansys/allie-flowkit).
26+
- Provide a service that exposes these functions as REST APIs.
27+
- Enable the creation of custom Allie workflows using these functions.
28+
- Allow other teams to add their needed functions to support their specific Allie workflows.
3029

31-
1. **Function Integration:** External functions are added to this repository and exposed as REST APIs.
32-
2. **Workflow Execution:** Allie workflows can include functions from Allie FlowKit Python.
33-
3. **API Calls:** When an Allie workflow includes a function from Allie FlowKit Python, the Allie Agent calls the function via REST API with the required inputs.
34-
4. **Function Execution:** The function is executed in Allie FlowKit Python, and the output is returned as the body of the REST response.
30+
## How it works
3531

36-
## Getting Started
32+
Allie Flowkit Python supports these actions:
33+
34+
1. **Function integration:** Add external functions to this repository and expose them as REST APIs.
35+
2. **Workflow execution:** Include functions from Allie FlowKit Python in Allie workflows.
36+
3. **API calls:** When an Allie workflow includes a function from Allie FlowKit Python, the Allie agent calls the function via a REST API with the required inputs.
37+
4. **Function execution:** The function is executed in Allie FlowKit Python, and the output is returned as the body of the REST response.
38+
39+
## Getting started
3740

3841
### Prerequisites
3942

40-
- Python 3.7 or higher
43+
- Python 3.7 or later
4144
- pip (Python package installer)
42-
- A running instance of the Allie Toolkit
45+
- A running instance of the Allie Flowkit
4346

4447
### Installation
4548

@@ -57,72 +60,73 @@ The main purpose of this repository is to:
5760
### Usage
5861

5962
1. Start the service:
60-
```sh
61-
uvicorn app.app:app --host 0.0.0.0 --port 8000 --workers 1
62-
```
63-
You can specify the host, port, and number of workers as needed.
64-
65-
2. The service will expose the functions as REST APIs on the specified port (default: 8000).
63+
```sh
64+
uvicorn app.app:app --host 0.0.0.0 --port 8000 --workers 1
65+
```
66+
You can specify the host, port, and number of workers as needed. The service exposes the functions as REST APIs on the specified port. The default is 8000.
6667

67-
3. Integrate these APIs into your Allie workflows as needed.
68+
2. Integrate these APIs into your Allie workflows as needed.
6869

69-
## Adding Custom Functions
70+
## Adding custom functions
7071

71-
1. **Create a New Function:**
72+
1. **Create a function.**
7273
- Add your function code as an endpoint to a new Python file in the `app/endpoints` directory.
73-
Use the `app/endpoints/splitter.py` file and its endpoints as an example.
74-
Be explicit about the input and output of the function, as this will be used by the Allie Agent to call the function.
74+
- Use the `app/endpoints/splitter.py` file and its endpoints as an example.
75+
- Be explicit about the input and output of the function as they are used by the Allie agent
76+
to call the function.
7577

76-
2. **Add the models for the function:**
78+
2. **Add the models for the function.**
7779
- Add the models for the input and output of the function in the `app/models` directory.
78-
Use the `app/models/splitter.py` file its models as an example.
80+
- Use the `app/models/splitter.py` file its models as an example.
7981

80-
2. **Add the endpoints to the service:**
81-
- Import your module in the `app/app.py` file and add the router to the service.
82-
```python
83-
app.include_router(splitter.router, prefix="/custom_module", tags=["custom_module"])
84-
```
85-
86-
3. **Example:**
87-
```python
88-
from fastapi import FastAPI, APIRouter
89-
from app.models.custom_model import CustomRequest, CustomResponse
90-
91-
app = FastAPI()
92-
router = APIRouter()
93-
94-
@router.post('/custom_function', response_model=CustomResponse)
95-
async def custom_function(request: CustomRequest) -> CustomResponse:
96-
"""Endpoint for custom function.
97-
98-
Parameters
99-
----------
100-
request : CustomRequest
101-
An object containing the input data required for the function.
82+
2. **Add the endpoints to the service.**
83+
84+
- Import your module in the `app/app.py` file.
85+
- Add the router to the service:
86+
```python
87+
app.include_router(splitter.router, prefix="/custom_module", tags=["custom_module"])
88+
```
89+
90+
**Example**
91+
```python
92+
from fastapi import FastAPI, APIRouter
93+
from app.models.custom_model import CustomRequest, CustomResponse
94+
95+
app = FastAPI()
96+
router = APIRouter()
97+
98+
@router.post('/custom_function', response_model=CustomResponse)
99+
async def custom_function(request: CustomRequest) -> CustomResponse:
100+
"""Endpoint for custom function.
101+
102+
Parameters
103+
----------
104+
request : CustomRequest
105+
Object containing the input data required for the function.
102106
103-
Returns
104-
-------
105-
CustomResponse
106-
An object containing the output data of the function.
107-
"""
108-
# Your custom processing logic here
109-
result = ...
110-
return result
111-
```
112-
113-
## Example Functions
107+
Returns
108+
-------
109+
CustomResponse
110+
Object containing the output data of the function.
111+
"""
112+
# Your custom processing logic here
113+
result = ...
114+
return result
115+
```
116+
117+
## Example functions
114118

115119
The repository includes some standard functions prefilled by the Allie team. You can use these as references or starting points for adding your own custom functions.
116120

117121
## Contributing
118122

119-
We welcome contributions from all teams. To contribute:
123+
We welcome contributions from all teams. To contribute, perform these steps:
120124

121125
1. Clone the repository.
122-
2. Create a new branch for your feature or bug fix.
126+
2. Create a branch for your feature or bug fix.
123127
3. Commit your changes and push your branch to the repository.
124128
4. Open a pull request to merge your changes into the main repository.
125129

126130
---
127131

128-
Thank you for using Allie FlowKit Python! We hope this repository helps you create powerful and flexible Allie workflows. Happy coding!
132+
Thank you for using Allie FlowKit Python. We hope this repository helps you create powerful and flexible Allie workflows. Happy coding!

0 commit comments

Comments
 (0)