@@ -14,68 +14,68 @@ This guide shows you how to get started with Genkit in a Python app.
1414
1515## Requirements
1616
17- * Python 3.12 or later. See [ Download and
17+ * Python 3.10 or later. See [ Download and
1818 install] ( https://www.python.org/downloads/ ) in the official Python docs.
1919
2020* Node.js 20 or later (for the Genkit CLI and UI). See the below for a brief
2121 guide on installing Node.
2222
2323## Create and explore a sample project
2424
25- 1 . Create a new project directory:
25+ 1 . Create a new project directory:
2626
27- ``` posix-terminal
28- mkdir genkit-intro && cd genkit-intro
29- ```
27+ ``` posix-terminal
28+ mkdir genkit-intro && cd genkit-intro
29+ ```
3030
31- 2 . (recommended) Create a Python virtual environment:
31+ 2. (recommended) Create a Python virtual environment:
3232
33- ``` bash
34- python3 -m venv .
35- ```
33+ ```bash
34+ python3 -m venv .
35+ ```
3636
37- (activate if necessary, depending on the environment)
37+ (activate if necessary, depending on the environment)
3838
39- ``` bash
40- source bin/activate # for bash
41- ```
39+ ```bash
40+ source bin/activate # for bash
41+ ```
4242
43- 3 . Install dependencies
43+ 3. Install dependencies
4444
45- ``` bash
46- pip3 install genkit
47- pip3 install genkit-plugin-google-genai
48- ```
45+ ```bash
46+ pip3 install genkit
47+ pip3 install genkit-plugin-google-genai
48+ ```
4949
50- Or create a ` requirements.txt ` file
50+ Or create a `requirements.txt` file
5151
52- ```
53- genkit
54- genkit-plugin-google-genai
55- ```
52+ ```
53+ genkit
54+ genkit-plugin-google-genai
55+ ```
5656
57- and run:
57+ and run:
5858
59- ``` bash
60- pip3 install -r requirements.txt
61- ```
59+ ```bash
60+ pip3 install -r requirements.txt
61+ ```
6262
63- 4 . Configure your model API key
63+ 4. Configure your model API key
6464
65- The simplest way to get started is with Google AI Gemini API. Make sure it's
66- [ available in your region] ( https://ai.google.dev/available_regions ) .
65+ The simplest way to get started is with Google AI Gemini API. Make sure it's
66+ [available in your region](https://ai.google.dev/available_regions).
6767
68- [ Generate an API key] ( https://aistudio.google.com/app/apikey ) for the
69- Gemini API using Google AI Studio. Then, set the ` GEMINI_API_KEY `
70- environment variable to your key:
68+ [Generate an API key](https://aistudio.google.com/app/apikey) for the
69+ Gemini API using Google AI Studio. Then, set the `GEMINI_API_KEY`
70+ environment variable to your key:
7171
72- ``` posix-terminal
73- export GEMINI_API_KEY=<your API key>
74- ```
72+ ```posix-terminal
73+ export GEMINI_API_KEY=<your API key>
74+ ```
7575
76- 5 . Create ` main.py ` file:
76+ 5. Create `main.py` file:
7777
78- ``` python
78+ ```python
7979 import json
8080 from pydantic import BaseModel, Field
8181 from genkit.ai import Genkit
@@ -103,70 +103,70 @@ This guide shows you how to get started with Genkit in a Python app.
103103 print(json.dumps(await generate_character('Goblorb'), indent=2))
104104
105105 ai.run_main(main())
106- ```
106+ ```
107107
108- 6 . Run your app. Genkit apps are just regular python application. Run them
109- however you normally run your app.
108+ 6. Run your app. Genkit apps are just regular python application. Run them
109+ however you normally run your app.
110110
111- ``` bash
112- python3 main.py
113- ```
111+ ```bash
112+ python3 main.py
113+ ```
114114
115- 7 . Inspect your app with the Genkit Dev UI
115+ 7. Inspect your app with the Genkit Dev UI
116116
117- See instructions for installing the Genkit CLI (which includes the Dev UI)
118- below.
117+ See instructions for installing the Genkit CLI (which includes the Dev UI)
118+ below.
119119
120- To inspect your app with Genkit Dev UI run with ` genkit start -- <app> `
121- command. E.g.:
120+ To inspect your app with Genkit Dev UI run with `genkit start -- <app>`
121+ command. E.g.:
122122
123- ``` bash
124- genkit start -- python3 main.py
125- ```
123+ ```bash
124+ genkit start -- python3 main.py
125+ ```
126126
127- The command will print the Dev UI URL. E.g.:
127+ The command will print the Dev UI URL. E.g.:
128128
129- ```
130- Genkit Developer UI: http://localhost:4000
131- ```
129+ ```
130+ Genkit Developer UI: http://localhost:4000
131+ ```
132132
133133## Install Genkit CLI
134134
135- 1 . If you don't already have Node 20 or newer on your system, install it now.
135+ 1. If you don't already have Node 20 or newer on your system, install it now.
136136
137- Recommendation: The [ ` nvm ` ] ( https://github.com/nvm-sh/nvm ) and
138- [ ` nvm-windows ` ] ( https://github.com/coreybutler/nvm-windows ) tools are a
139- convenient way to install specific versions of Node if it's not already
140- installed on your system. These tools install Node on a per-user basis, so
141- you don't need to make system-wide changes.
137+ Recommendation: The [`nvm`](https://github.com/nvm-sh/nvm) and
138+ [`nvm-windows`](https://github.com/coreybutler/nvm-windows) tools are a
139+ convenient way to install specific versions of Node if it's not already
140+ installed on your system. These tools install Node on a per-user basis, so
141+ you don't need to make system-wide changes.
142142
143- To install ` nvm ` :
143+ To install `nvm`:
144144
145- * { Linux, macOS, etc.}
145+ === " Linux, macOS, etc."
146146
147- Run the following command:
147+ Run the following command:
148148
149- ``` posix-terminal
150- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
151- ```
149+ ```posix-terminal
150+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
151+ ```
152152
153- * { Windows}
153+ === " Windows"
154154
155- Download and run the installer as described in the [nvm-windows
156- docs](https://github.com/coreybutler/nvm-windows?tab=readme-ov-file#install-nvm-windows).
155+ Download and run the installer as described in the [nvm-windows
156+ docs](https://github.com/coreybutler/nvm-windows?tab=readme-ov-file#install-nvm-windows).
157157
158- Then, to install Node and `npm`, open a new shell and run the following
159- command:
158+ Then, to install Node and `npm`, open a new shell and run the following
159+ command:
160160
161- ```posix-terminal
162- nvm install 20
163- ```
161+ ```posix-terminal
162+ nvm install 20
163+ ```
164164
165- 2 . Install the Genkit CLI by running the following command:
165+ 2. Install the Genkit CLI by running the following command:
166166
167- ``` posix-terminal
168- npm i -g genkit-cli
169- ```
167+ ```posix-terminal
168+ npm i -g genkit-cli
169+ ```
170170
171- This command installs the Genkit CLI into your Node installation directory so
172- that it can be used outside of a Node project.
171+ This command installs the Genkit CLI into your Node installation directory so
172+ that it can be used outside of a Node project.
0 commit comments