@@ -90,7 +90,7 @@ align: l-lt-lt
9090color: violet-light
9191---
9292
93- [ ^ ref1 ] : <div class =" ns-c-cite " >[Attention Is All You Need]( https://arxiv.org/abs/1706.03762) </div >
93+ [ ^ ref1 ] : <div class =" ns-c-cite " >< a href = " https://arxiv.org/abs/1706.03762 " >Attention Is All You Need</ a > </div >
9494[ ^ ref2 ] : <div class =" ns-c-cite " >Adapted from Hands-On Large Language Models by Jay Alammar & Maarten Grootendorst.</div >
9595
9696
@@ -196,25 +196,6 @@ color: violet-light
196196
197197LLMs generate output one token at a time[ ^ ref1 ]
198198
199- ---
200- layout: side-title
201- side: l
202- color: violet-light
203- titlewidth: is-4
204- align: rm-lm
205- ---
206-
207- :: title ::
208-
209- # Hands-on
210-
211- # <mdi-arrow-right />
212-
213- :: content ::
214-
215- Head over to app.portkey.ai and choose the "Login with SSO" option with your NetID@nyu.edu email address.
216-
217-
218199---
219200layout: top-title-two-cols
220201columns: is-6
@@ -228,10 +209,13 @@ color: violet-light
228209
229210:: left ::
230211- LLMs are programmatically accessible via an HTTP server, typically via the OpenAI API
231- - To invoke the LLM, you send an HTTP request with
232- - your ` API_KEY `
233- - message body, i.e. prompt and any conversation history
234- - parameters like maximum tokens, temperature, thinking/reasoning level, etc.
212+ - To invoke the LLM, you send an HTTP request with:
213+ <div class =" ns-c-tight " >
214+ - your ` API_KEY ` <br />
215+ - message body, i.e. prompt and any conversation history <br />
216+ - model to invoke <br />
217+ - parameters like maximum tokens, temperature, thinking/reasoning level, etc. <br />
218+ </div >
235219
236220:: right ::
237221
@@ -243,7 +227,7 @@ sequenceDiagram
243227 U->>Server: POST /v1/chat/completions <br/> Headers: Authorization (API_KEY)<br/>Body: messages, model, parameters
244228 activate Server
245229 Note over Server: LLM inference <br/> generates a response
246- Server-->>U: JSON response contains:<br/>- choices [] <br/>- usage stats<br/>- metadata
230+ Server-->>U: JSON response contains:<br/>- choices<br/>- usage stats<br/>- metadata
247231 deactivate Server
248232
249233```
@@ -270,47 +254,148 @@ curl -X POST "https://ai-gateway.apps.cloud.rt.nyu.edu/v1/chat/completions " \
270254 -H " Content-Type: application/json" \
271255 -d ' {
272256 "model":"@vertexai/gemini-2.5-flash-lite",
273- "messages": [
274- {"role": "system", "content": "You are a helpful assistant." },
275- { "role": "user", "content": "Explain quantum computing in simple terms"}],
276- "max_tokens":"128"
257+ "messages":
258+ [
259+ {
260+ "role": "system",
261+ "content": "You are a helpful assistant."
262+ },
263+ {
264+ "role": "user",
265+ "content": "Explain quantum computing in simple terms"
266+ }
267+ ],
268+ "max_tokens":"64"
277269 "temperature": 0.7
278270 }'
279271```
280272 </template >
281273 <template #2 >
282- Response Structure
274+
275+ Response
283276
284277``` json
285278{
286279 ...
287280 "object" :" chat.completion" ,
288281 "model" :" gemini-2.5-flash-lite" ,
289282 "provider" :" vertex-ai" ,
290- "choices" :[
291- {"message" :
292- {"role" :" assistant" ,
293- "content" :"Imagine a regular computer uses bits, which are like light switches that can be either ON (1) or OFF (0).
294- This is how it stores and processes information.\n\n**Quantum computing is like a super-powered, mind-bending
295- version of this.** Instead of just ON or OFF, a quantum computer uses **qubits**.\n\nHere's where it gets weird and wonderful:\n\n*
296- **Superposition: The \"Both ON and OFF\" Trick**\n A qubit can be ON, OFF, or **both ON and OFF at the same time**
297- . Think of it like a spinning coin. Until it lands, it" },
298- "index" :0 ,
299- "finish_reason" :" length" }],
300- "usage" :
301- {
302- "prompt_tokens" :12 ,
303- "completion_tokens" :128 ,
304- "total_tokens" :140 ,
283+ "choices" :
284+ [
285+ {"message" :
286+ {"role" :" assistant" ,
287+ "content" :"Imagine a regular computer uses bits, which are like light switches that can be either ON (1) or
288+ OFF (0). Quantum computers use **qubits**.\n\nHere's where it gets weird and wonderful:\n\n*
289+ **Qubits can be ON, OFF, or BOTH at the same time.** This" },
290+ "index" :0 ,
291+ "finish_reason" :" length" }
292+ ],
293+ "usage" :{
294+ "prompt_tokens" :12 , "completion_tokens" :64 , "total_tokens" :76 ,
305295 "completion_tokens_details" :{"reasoning_tokens" :0 }
306- }
296+ }
307297}
308298```
309299
310300 </template >
311301</v-switch >
312302
313303
304+ ---
305+ layout: top-title-two-cols
306+ columns: is-4
307+ color: violet-light
308+ ---
309+
310+ :: title ::
311+
312+ # LLM gateway
313+
314+ :: left ::
315+ - API access to LLMs for research workflows is facilitated by an LLM gateway (Portkey) at NYU.
316+ - Beyond providing a unified interface for all LLMs, it:
317+ <div class =" ns-c-tight " >
318+ - has a UI for prototyping <br />
319+ - prompt library to version and template your prompts <br />
320+ - allows you to view the logs for each request <br />
321+ - lets you perform batch processing <br />
322+ </div >
323+ - We will be exploring it in the hands on session now.
324+
325+ :: right ::
326+
327+ <img src =" /portkey_overview.png " />
328+
329+
330+ ---
331+ layout: side-title
332+ side: l
333+ color: violet-light
334+ titlewidth: is-4
335+ align: rm-lm
336+ ---
337+
338+ :: title ::
339+
340+ # Hands on
341+
342+ # <mdi-arrow-right />
343+
344+ :: content ::
345+
346+ Head over to app.portkey.ai and choose the "Login with SSO" option with your NetID@nyu.edu email address.
347+
348+
349+ ---
350+ layout: top-title-two-cols
351+ columns: is-8
352+ color: violet-light
353+ ---
354+
355+ :: title ::
356+
357+ # Creating an API Key
358+
359+ :: left ::
360+
361+ <img src =" /portkey_workspace.png " />
362+
363+ <br />
364+ User vs Service Keys: logs with user key will have the NetID of the user as part of the metadata while the services will not.
365+
366+ Stick to user keys unless you're developing a service.
367+
368+ :: right ::
369+
370+ <img src =" /portkey_key_create.png " />
371+
372+
373+ ---
374+ layout: top-title-two-cols
375+ columns: is-3
376+ color: violet-light
377+ ---
378+
379+ :: title ::
380+
381+ # Prompt Playground
382+
383+ :: left ::
384+ - Explore the effect of parameters
385+ - Run the same prompt across various models
386+ - Create prompt templates with dynamic variables
387+ - Enable tool calling (we will discuss this in depth soon)
388+
389+ :: right ::
390+ <v-switch >
391+ <template #1 >
392+ <img src =" /prompt_playground.png " />
393+ </template >
394+ <template #2 >
395+ <img src =" /prompt_playground_compare.png " />
396+ </template >
397+ </v-switch >
398+
314399
315400---
316401layout: side-title
0 commit comments