Repository navigation
LiteLLM 1 · One interface across providers, and what it hides #21
akash-coded
started this conversation in
Exercises
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Exercise · LiteLLM · Interim
Language: Python · Topics: LiteLLM core, Bedrock routing, unified I/O, streaming · Level: Foundational
Scenario
TravelMind is wiring its support bot to Amazon Bedrock through LiteLLM. Passenger Rao (Gold tier, booking PNR JX48Q2) will chat with it. Before you change anything, you must read the pipeline and prove you understand what each line does.
Mental model: USB-C for LLMs. Your code has one plug. LiteLLM fits every socket.
flowchart LR APP[Support bot code] --> LITE[LiteLLM] LITE --> BR[Bedrock: Claude Haiku 4.5] LITE -. same code .-> OA[OpenAI] LITE -. same code .-> OL[Ollama]Reference snippet for this sheet:
Part A · Read the pipeline (MCQ)
Q1. The
bedrock/prefix in the model string tells LiteLLM to:Q2. On Bedrock you must NOT pass
api_key. Why?Q3. In the snippet,
resp.choices[0].message.contentholds:Q4. The
us.inus.anthropic.claude-haiku-4-5-...is:Part B · True or false (pick only)
Mark each T or F.
Q5.
completion()returns the same response shape whatever the provider.model="bedrock/..."formodel="openai/gpt-4o"forces you to rewrite the parsing code.Part C · Multi-select
Q6. Which are real LiteLLM capabilities? (choose all)
Part D · Predict the output
Q7. Given this loop, what does the FINAL
printstatement put on screen (describe exactly)?Q8. What is the effect of
end=""on how the streamed pieces appear?Part E · Match the columns
Q9. Match each term to its meaning. One meaning is a distractor with no match.
drop_params=Truebedrock/converse/<model>completion()Part F · Trace the flow
Q10. A request travels through the layer. Put these in order:
completion(model="bedrock/us...")Part G · Spot the issues and pick the fix
Q11. This call fails on Bedrock. Two things are wrong.
Identify both problems, then pick the correct minimal fix.
stream=Truebedrock/us.prefix, and setlitellm.drop_params = Trueso the temperature + top_p conflict is handledmessagesmax_tokensPart H · Tweak and reason
Q12. You change
max_tokens=200tomax_tokens=10and rerun. Based on the output you would see, what is the most likely observation, and what does that tell you aboutmax_tokens?Q13. A product manager asks: "Can we switch from Bedrock to another provider later without rewriting the bot?" Give the accurate one-line answer and name the exact change required.
Part I · Order the steps
Q14. To make your first Bedrock call through LiteLLM, order these:
litellm.completion(...)and readchoices[0].message.contentbedrock/us.anthropic.claude-haiku-4-5-...litellm.drop_params = TruePart J · Placement
Q15. Which box is LiteLLM in this stack?
flowchart TB U[TravelMind bot] --> AF[Strands agent loop] AF --> MA[???] MA --> PR[Bedrock]Part K · Skeptic check
Q16. TravelMind will only ever use Bedrock and runs one small service. Name one honest reason LiteLLM might be pure overhead here, and one future event that would flip that.
All reactions