You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an example project demonstrating how to use Hatchet with FastAPI.
4
+
5
+
## Prerequisites
6
+
7
+
Before running this project, make sure you have the following:
8
+
9
+
1. Python 3.7 or higher installed on your machine.
10
+
2. Poetry package manager installed. You can install it by running `pip install poetry`, or by following instructions in the [Poetry Docs](https://python-poetry.org/docs/#installation)
11
+
3. Clone this repository to your local machine.
12
+
4. (Optional) If you would like to run the example frontend, Node which can be installed from the [node website](https://nodejs.org/en/download)
13
+
14
+
## Setup
15
+
16
+
1. Create a `.env` file in the project root directory and set the required environment variables.
17
+
18
+
This project requires the `HATCHET_CLIENT_TOKEN` variable created in the [Getting Started Readme](/README.md).
19
+
20
+
You will also need, a `OPENAI_API_KEY` which can be created on the [OpenAI Website](https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key).
21
+
22
+
2. Open a terminal and navigate to the project root directory (`/fast-api-react`).
23
+
24
+
3. Run the following command to install the project dependencies:
25
+
26
+
```shell
27
+
poetry install
28
+
```
29
+
30
+
## Running the API
31
+
32
+
To start the FastAPI server, run the following command in the terminal:
33
+
34
+
```shell
35
+
poetry run api
36
+
```
37
+
38
+
## Running the Hatchet Worker
39
+
40
+
In a separate terminal, start the the Hatchet worker by running the following command:
41
+
42
+
```shell
43
+
poetry run hatchet
44
+
```
45
+
46
+
## (Optional) Running the Example Frontend Application
47
+
48
+
We've included a basic chat engine frontend to play with the example workflow. To run this script:
49
+
50
+
1. Open a new terminal window and cd into the `fast-api-react/frontend` directory.
51
+
2. run `npx install`
52
+
3. run `npx start`
53
+
4. By default you can access the application in your browser at `http://localhost:3000` or by following the instructions in the terminal window.
0 commit comments