My Week 1 Lab 2 community contributions (cleared outputs) - #1591
Open
teo2001-repos wants to merge 1 commit into
Open
My Week 1 Lab 2 community contributions (cleared outputs)#1591teo2001-repos wants to merge 1 commit into
teo2001-repos wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Ed! Hope you are doing very well! In advance, thank you for your time.
Comments below also in the .ipynb file for anyone else who would like to understand what I did in this community contribution:
My contribution consist of three sets of changes. (Per Python's PEP-8 I hope my code is somewhat clear and readable enough that it does not need heavy commenting, fingers crossed).
Just for the sake of the exercise, I didn't ask any LLM to create the code or come up with the idea, so I could put just some thought to it.
1. To the Original lab
record()helper in the Groq and Ollama cells replacing thedisplay/appendseparate calls in those cells (so all the models use the record() function).2. Improved workflow
This section starts after the original lab cells. It follows the lecture prompt from Ed to try to make the workflow more sophisticated. I aimed to use only the content from the course so far and what Ed included in all the GitHub guides (e.g. Python's async), and to keep the workflow, so the essence is still there.
I created a dict for the LLM providers/models, so parallel runs with async are easier to manage and extra per-model settings and/or more models/providers can be added later.
Added to the judge prompt XML tags around the question, format, and responses. I read some time ago on Claude’s prompting guidance and related papers on structured prompts that this helps the LLM to understand the structure and in general is a good practice (arXiv papers 2510.22956, 2509.08182).
Also I added a prompt dict, easier management of prompt templates, and in the case of the judge, it could be filled for the particular call with the
str.format()method.New function helpers (including API-key prefix printing).
To be faithful to the original lab,
llm_call()keeps Ed’sreasoning_effort="none"behavior forgpt-5.4-nano, it works from a conditional.The async function llm_call is a starting point: it can be modified to expand/add conditions/features, for example: skip disabled models (e.g. in the LLMs dict with an "disabled" property), pull
max_tokens/reasoning_effort(it could be from the prompts dict), etc, switch SDKs (I coded this new section to use the OpenAISDK. As recreating an improved version of the original lab code.)3. Additional agentic design pattern
It works this way:
max()keeps the first model that reached that count. (This could be changed but for the moment let's say it's "destiny").Kind Regards,
Theo.