Skip to content

Commit 1cf8a30

Browse files
authored
Merge branch 'main' into seratch-gtp_actions_aws
2 parents e7490fc + 2d9253a commit 1cf8a30

File tree

157 files changed

+24783
-1261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+24783
-1261
lines changed

.github/registry_schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"date": {
3232
"type": "string",
3333
"format": "date"
34+
},
35+
"archived": {
36+
"type": "boolean"
3437
}
3538
},
3639
"required": ["title", "path", "tags", "authors"],

.github/scripts/check_notebooks.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import subprocess
2+
import sys
3+
from pathlib import Path
4+
5+
import nbformat
6+
7+
8+
def get_changed_notebooks(base_ref: str = "origin/main") -> list[Path]:
9+
"""
10+
Returns a list of changed notebook paths in the current git branch
11+
compared to the specified base reference.
12+
"""
13+
result = subprocess.run(
14+
["git", "diff", "--name-only", base_ref, "--", "*.ipynb"],
15+
capture_output=True,
16+
text=True,
17+
check=True,
18+
)
19+
return [Path(line.strip()) for line in result.stdout.splitlines() if line.strip()]
20+
21+
22+
def is_valid_notebook(path: Path) -> bool:
23+
"""
24+
Checks if the notebook at the given path is valid by attempting to read it
25+
with nbformat.
26+
"""
27+
try:
28+
with open(path, "r", encoding="utf-8") as f:
29+
nbformat.read(f, as_version=4)
30+
return True
31+
except Exception as e:
32+
print(f"{path}: INVALID - {e}")
33+
return False
34+
35+
36+
def main() -> None:
37+
"""
38+
Main function to validate the format of changed notebooks.
39+
"""
40+
changed_notebooks = get_changed_notebooks()
41+
if not changed_notebooks:
42+
print("No changed .ipynb files to validate.")
43+
sys.exit(0)
44+
45+
print(f"Validating {len(changed_notebooks)} notebook(s)...")
46+
errors = 0
47+
for path in changed_notebooks:
48+
if not path.exists():
49+
continue # skip deleted files
50+
if not is_valid_notebook(path):
51+
errors += 1
52+
53+
if errors:
54+
print(f"{errors} invalid notebook(s) found.")
55+
sys.exit(1)
56+
else:
57+
print("All changed notebooks are valid.")
58+
59+
60+
if __name__ == "__main__":
61+
main()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Validate Changed Notebooks
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
validate-notebooks:
7+
name: Validate Notebooks
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0 # needed for git diff to work
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.12'
20+
21+
- name: Install dependencies
22+
run: pip install nbformat
23+
24+
- name: Validate changed .ipynb files
25+
run: python .github/scripts/check_notebooks.py

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ dmypy.json
137137
*.DS_Store
138138
tmp_*
139139
examples/fine-tuned_qa/local_cache/*
140+
examples/multimodal/.local_cache/*
140141

141142
# PyCharm files
142143
.idea/
144+
.cursorignore
145+
146+
# VS Code files
147+
.vscode/
148+
.cursorignore

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
> ✨ Navigate at [cookbook.openai.com](https://cookbook.openai.com)
1111
12-
Example code and guides for accomplishing common tasks with the [OpenAI API](https://platform.openai.com/docs/introduction). To run these examples, you'll need an OpenAI account and associated API key ([create a free account here](https://beta.openai.com/signup)). Set an environment variable called `OPENAI_API_KEY` with your API key. Alternatively, in most IDEs such as Visual Studio Code, you can create an `.env` file at the root of your repo containing `OPENAI_API_KEY=<your API key>`, which will be picked up by the notebooks.
12+
Example code and guides for accomplishing common tasks with the [OpenAI API](https://platform.openai.com/docs/introduction). To run these examples, you'll need an OpenAI account and associated API key ([create a free account here](https://platform.openai.com/signup)). Set an environment variable called `OPENAI_API_KEY` with your API key. Alternatively, in most IDEs such as Visual Studio Code, you can create an `.env` file at the root of your repo containing `OPENAI_API_KEY=<your API key>`, which will be picked up by the notebooks.
1313

1414
Most code examples are written in Python, though the concepts can be applied in any language.
1515

1616
For other useful tools, guides and courses, check out these [related resources from around the web](https://cookbook.openai.com/related_resources).
1717

1818
## License
1919

20-
MIT
20+
MIT License

articles/related_resources.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ People are writing great tools and papers for improving outputs from GPT. Here a
77
- [Arthur Shield](https://www.arthur.ai/get-started): A paid product for detecting toxicity, hallucination, prompt injection, etc.
88
- [Baserun](https://baserun.ai/): A paid product for testing, debugging, and monitoring LLM-based apps
99
- [Chainlit](https://docs.chainlit.io/overview): A Python library for making chatbot interfaces.
10+
- [ElatoAI](https://github.com/akdeb/ElatoAI): A platform for running OpenAI Realtime API Speech on ESP32 on Arduino using Deno Edge Runtime and Supabase.
1011
- [Embedchain](https://github.com/embedchain/embedchain): A Python library for managing and syncing unstructured data with LLMs.
1112
- [FLAML (A Fast Library for Automated Machine Learning & Tuning)](https://microsoft.github.io/FLAML/docs/Getting-Started/): A Python library for automating selection of models, hyperparameters, and other tunable choices.
1213
- [Guidance](https://github.com/microsoft/guidance): A handy looking Python library from Microsoft that uses Handlebars templating to interleave generation, prompting, and logical control.

authors.yaml

Lines changed: 99 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,35 @@
22

33
# You can optionally customize how your information shows up cookbook.openai.com over here.
44
# If your information is not present here, it will be pulled from your GitHub profile.
5+
rajpathak-openai:
6+
name: "Raj Pathak"
7+
website: "https://www.linkedin.com/in/rajpathakopenai/"
8+
avatar: "https://avatars.githubusercontent.com/u/208723614?s=400&u=c852eed3be082f7fbd402b5a45e9b89a0bfed1b8&v=4"
9+
10+
chelseahu-openai:
11+
name: "Chelsea Hu"
12+
website: "https://www.linkedin.com/in/chelsea-tsaiszuhu/"
13+
avatar: "https://avatars.githubusercontent.com/u/196863678?v=4"
14+
15+
prashantmital-openai:
16+
name: "Prashant Mital"
17+
website: "https://www.linkedin.com/in/pmital/"
18+
avatar: "https://avatars.githubusercontent.com/u/173949238?v=4"
19+
20+
theophile-oai:
21+
name: "Theophile Sautory"
22+
website: "https://www.linkedin.com/in/theophilesautory"
23+
avatar: "https://avatars.githubusercontent.com/u/206768658?v=4"
24+
25+
robert-tinn:
26+
name: "Robert Tinn"
27+
website: "https://www.linkedin.com/in/robert-tinn/"
28+
avatar: "https://avatars.githubusercontent.com/u/208724428?v=4"
29+
30+
minh-hoque:
31+
name: "Minhajul Hoque"
32+
website: "https://www.linkedin.com/in/minhajul-hoque-83242b163/"
33+
avatar: "https://avatars.githubusercontent.com/u/84698472?v=4"
534

635
shikhar-cyber:
736
name: "Shikhar Kwatra"
@@ -58,6 +87,11 @@ ibigio:
5887
website: "https://twitter.com/ilanbigio"
5988
avatar: "https://pbs.twimg.com/profile_images/1841544725654077440/DR3b8DMr_400x400.jpg"
6089

90+
willhath-openai:
91+
name: "Will Hathaway"
92+
website: "https://www.willhath.com"
93+
avatar: "https://media.licdn.com/dms/image/v2/D4E03AQEHOtMrHtww4Q/profile-displayphoto-shrink_200_200/B4EZRR64p9HgAc-/0/1736541178829?e=2147483647&v=beta&t=w1rX0KhLZaK5qBkVLkJjmYmfNMbsV2Bcn8InFVX9lwI"
94+
6195
jhills20:
6296
name: "James Hills"
6397
website: "https://twitter.com/jamesmhills"
@@ -126,13 +160,13 @@ aaronwilkowitz-openai:
126160
charuj:
127161
name: "Charu Jaiswal"
128162
website: "https://www.linkedin.com/in/charu-j-8a866471"
129-
avatar: "https://avatars.githubusercontent.com/u/18404643?v=4"
163+
avatar: "https://avatars.githubusercontent.com/u/18404643?v=4"
130164

131165
rupert-openai:
132166
name: "Rupert Truman"
133167
website: "https://www.linkedin.com/in/rupert-truman/"
134168
avatar: "https://avatars.githubusercontent.com/u/171234447"
135-
169+
136170
keelan-openai:
137171
name: "Keelan Schule"
138172
website: "https://www.linkedin.com/in/keelanschule/"
@@ -171,8 +205,8 @@ evanweiss-openai:
171205
girishd:
172206
name: "Girish Dusane"
173207
website: "https://www.linkedin.com/in/girishdusane/"
174-
avatar: "https://avatars.githubusercontent.com/u/272708"
175-
208+
avatar: "https://avatars.githubusercontent.com/u/272708"
209+
176210
lxing-oai:
177211
name: "Luke Xing"
178212
website: "https://www.linkedin.com/in/lukexing/"
@@ -227,7 +261,7 @@ erickgort:
227261
name: "Erick Gort"
228262
website: "https://www.linkedin.com/in/erick-gort-32ab1678/"
229263
avatar: "https://avatars.githubusercontent.com/u/189261906?v=4"
230-
264+
231265
kylecote-tray:
232266
name: "Kyle Cote"
233267
website: "https://github.com/kylecote-tray"
@@ -248,6 +282,11 @@ msingh-openai:
248282
website: "https://github.com/msingh-openai"
249283
avatar: "https://avatars.githubusercontent.com/u/168678187?v=4"
250284

285+
akashdeepdeb:
286+
name: "Akashdeep Deb"
287+
website: "https://github.com/akdeb"
288+
avatar: "https://avatars.githubusercontent.com/u/20175219"
289+
251290
ted-at-openai:
252291
name: "Ted Sanders"
253292
website: "https://github.com/ted-at-openai"
@@ -267,3 +306,58 @@ erikakettleson-openai:
267306
name: "Erika Kettleson"
268307
website: "https://www.linkedin.com/in/erika-kettleson-85763196/"
269308
avatar: "https://avatars.githubusercontent.com/u/186107044?v=4"
309+
310+
jannik-maierhofer:
311+
name: "Jannik Maierhöfer"
312+
website: "https://www.linkedin.com/in/maierhoefer/"
313+
avatar: "https://avatars.githubusercontent.com/u/48529566?v=4"
314+
315+
josiah-openai:
316+
name: "Josiah Grace"
317+
website: "https://www.linkedin.com/in/josiahbgrace"
318+
avatar: "https://avatars.githubusercontent.com/u/181146311?v=4"
319+
320+
vishnu-oai:
321+
name: "Vishnu Chopra"
322+
website: "https://www.linkedin.com/in/vishnu-chopra/"
323+
avatar: "https://avatars.githubusercontent.com/u/206769912?v=4"
324+
325+
nm-openai:
326+
name: "Noah MacCallum"
327+
website: "https://x.com/noahmacca"
328+
avatar: "https://avatars.githubusercontent.com/u/171723556"
329+
330+
julian-openai:
331+
name: "Julian Lee"
332+
website: "https://x.com/julianl093"
333+
avatar: "https://avatars.githubusercontent.com/u/199828632"
334+
335+
rzhao-openai:
336+
name: "Randy Zhao"
337+
website: "https://www.linkedin.com/in/randy-zhao-27433616b"
338+
avatar: "https://avatars.githubusercontent.com/u/208724779?v=4"
339+
340+
brandonbaker-openai:
341+
name: "Brandon Baker"
342+
website: "https://www.linkedin.com/in/brandonbaker18"
343+
avatar: "https://avatars.githubusercontent.com/u/208719822"
344+
345+
tompakeman-oai:
346+
name: "Tom Pakeman"
347+
website: "https://www.linkedin.com/in/tom-pakeman/"
348+
avatar: "https://avatars.githubusercontent.com/u/204937754"
349+
350+
alistair-openai:
351+
name: "Alistair Gillespie"
352+
website: "https://www.linkedin.com/in/alistair-gillespie/"
353+
avatar: "https://avatars.githubusercontent.com/u/210626148"
354+
355+
phundal-openai:
356+
name: "Patrick Hundal"
357+
website: "https://www.linkedin.com/in/phundal/"
358+
avatar: "https://avatars.githubusercontent.com/u/189161955"
359+
360+
rkoenig-openai:
361+
name: "Robin Koenig"
362+
website: "https://www.linkedin.com/in/robinkoenig/"
363+
avatar: "https://media.licdn.com/dms/image/v2/C5603AQEqUVtbts8Huw/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1558137883581?e=1753920000&v=beta&t=jcm-qNJfmgVJsS6uNHxHu5T2nQoUWkXivthzxTJMWqA"

0 commit comments

Comments
 (0)