Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 2e57fe2

Browse files
committed
edits from feedback
1 parent 908289e commit 2e57fe2

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

dictionary.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,6 @@ GPT
276276
ChatGPT
277277
OpenAI
278278
OpenAI's
279-
serverlessly
280-
deps
281279
uv
282280
[0-9]+px
283281
^.+[-:_]\w+$

docs/guides/python/serverless-ai-api.mdx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Before we begin, make sure you have the following:
4949
preferred cloud.
5050
</Note>
5151

52-
## Project Setup - Your First Nitric App
52+
## Project Setup
5353

5454
Nitric projects have a simple structure: your code (services, functions, etc.) lives in a directory (by default called `services/`), and a `nitric.yaml` config file describes high-level settings (like which files are services and what runtime to use). We'll use the Nitric CLI to scaffold a new project:
5555

@@ -63,14 +63,14 @@ This will create a new folder `my-summarizer` with a Python starter template. (Y
6363

6464
If none of the templates suit your needs, you can always create your own.
6565

66-
2. **Install dependencies:** Navigate into the project and install the requirements. The template uses Pipenv, so you can do:
66+
2. **Install dependencies:** Navigate into the project and install the requirements. The template uses uv, so you can do:
6767

6868
```bash
6969
cd my-summarizer
7070
uv sync
7171
```
7272

73-
This will install Nitric's Python SDK (and any other deps). If you used a different template, change this step to install dependencies accordingly.
73+
This will install Nitric's Python SDK (and any other dependencies). If you used a different template, change this step to install dependencies accordingly.
7474

7575
3. **Explore the scaffold:** The generated project should have a structure like:
7676

@@ -126,6 +126,9 @@ This will fetch the API key from your environment. (If you prefer, Nitric also h
126126

127127
```python
128128
# Create OpenAI client
129+
# This could be a local model during development if you have Ollama or similar installed.
130+
# For example, if you have Ollama running locally, you could use:
131+
# client = OpenAI(model="ollama", , base_url="http://localhost:11434/v1")
129132
client = OpenAI(api_key=api_key)
130133
```
131134

@@ -148,6 +151,8 @@ async def summarize_text(ctx: HttpContext) -> None:
148151
# Call OpenAI API to get summary (this is a blocking call, for demo simplicity)
149152
try:
150153
response = client.chat.completions.create(
154+
# This model could be replaced with another of your choice.
155+
# Using tools like Ollama, it could even be a local model.
151156
model="gpt-3.5-turbo",
152157
messages=[{"role": "user", "content": f"Summarize the following text:\n\n{text_to_summarize}"}],
153158
max_tokens=50
@@ -315,7 +320,7 @@ curl -X POST https://<<your-api-url>>/summarize \
315320
316321
_(Make sure to put your actual endpoint URL in place of `<<your-api-url>>`._
317322
318-
You should get a JSON response with a summary, similar to what you saw locally. Congratulations - your AI-powered summarization service is now live on the internet, running serverlessly! 🎉
323+
You should get a JSON response with a summary, similar to what you saw locally. Congratulations - your AI-powered summarization service is now live on the internet, running completely on serverless infrastructure! 🎉
319324
320325
A few things to appreciate here:
321326

0 commit comments

Comments
 (0)