{"id":16878811,"url":"https://github.com/peterj/gen-ai-for-beginners","last_synced_at":"2026-05-21T14:07:39.346Z","repository":{"id":235927095,"uuid":"726617677","full_name":"peterj/gen-ai-for-beginners","owner":"peterj","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-02T22:09:10.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-25T04:43:27.298Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-12-02T22:09:01.000Z","updated_at":"2023-12-02T22:12:25.000Z","dependencies_parsed_at":"2024-04-25T00:58:38.760Z","dependency_job_id":"fca38159-8cdf-4c68-9076-bfd6575e7e48","html_url":"https://github.com/peterj/gen-ai-for-beginners","commit_stats":null,"previous_names":["peterj/gen-ai-for-beginners"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterj%2Fgen-ai-for-beginners","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterj%2Fgen-ai-for-beginners/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterj%2Fgen-ai-for-beginners/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterj%2Fgen-ai-for-beginners/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterj","download_url":"https://codeload.github.com/peterj/gen-ai-for-beginners/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244511229,"owners_count":20464270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T15:51:33.142Z","updated_at":"2026-05-21T14:07:34.321Z","avatar_url":"https://github.com/peterj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generative AI for beginners\n\nThis repo contains examples from the [Generative AI for beginners course](https://github.com/microsoft/generative-ai-for-beginners) I went through in 3 YouTube live streams:\n\n1. [Part 1: Generative AI for beginners](https://www.youtube.com/watch?v=Irk9ANcurbM\u0026list=PLy0Gle4XyvbFyFCv73X1BTKKWM98uCGRf\u0026index=2\u0026t=1s)\n2. [Part 2: Generative AI for beginners](https://www.youtube.com/watch?v=PHMq-pFjMOM\u0026list=PLy0Gle4XyvbFyFCv73X1BTKKWM98uCGRf\u0026index=2)\n3. [Part 3: Generative AI for beginners](https://www.youtube.com/watch?v=eZEqZxhZTGk\u0026list=PLy0Gle4XyvbFyFCv73X1BTKKWM98uCGRf\u0026index=3)\n\n## Prerequisites\n\nYou'll need OpenAI API key - you can set it as an environment varaible (`OPENAI_API_KEY`) before running the scripts or create a `.env` file and add the API key there.\n\nYou'll also need Python - I was using Python 3.11.6. There will be other requirements such as `openai`, `numpy`, `pyyaml`, `requests`, `dotenv`, and others, but you can install them with `pip install \u003clibrary name\u003e`.\n\n## Running the scripts\n\nYou can run the scripts with `python \u003cscript name\u003e`. The scripts are:\n\n- `embed.py` - shows how to create embeddings from text and use cosine similarity to compare one embedding with another one.\n\n- `funcs.py` - shows how to define tools (functions) and pass them to the chat completion call. OpenAI can then extract the needed information (function arguments) from the prompt, so you can invoke the function.\n\n- `imagegen.py` - shows how to use Dall-E 3 to generate images from prompts, how to do image editing (i.e. you have to provide an input image with transparent areas that Dall-E can fill out), and how to create image variants (i.e. you can provide an input image and Dall-E creates a variant of that image).\n\n- `textgen.py` - shows the chat/completions API and how to use it to generate text from prompts.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterj%2Fgen-ai-for-beginners","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterj%2Fgen-ai-for-beginners","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterj%2Fgen-ai-for-beginners/lists"}