All episodes

Episode 07 · Implement with Foundry

Foundry: prompts, portal, SDK

The exam's gravity well. Mira walks the portal. Owen reads the Python out loud: AIProjectClient, get_openai_client, messages.

  • System and user prompts
  • Deploy a model in the Foundry portal
  • Lightweight chat client with the Foundry SDK
Microsoft Learn
0:00—

Transcript

On the mics

Mira Cole

Episode seven. We cross into the larger skill area: implement generative A.I. apps and agents by using Foundry. Today is the first three bullets. Prompts. Deploy in the portal. A lightweight chat client with the Foundry S.D.K.

Owen Park

Microsoft Foundry is the workshop. Models, agents, tools, one project, one endpoint family. The portal is at A.I. dot azure dot com. You create a project, you deploy a model from the catalog, you get a deployment name, and you can chat in a playground before you write code.

Mira Cole

Deploy, in exam language, means: pick a model, give it a deployment name, let Foundry host an endpoint. After that you interact in the playground, or you copy the project endpoint into code. You do not S.S.H. into a virtual machine to 'install G.P.T.'

Owen Park

Prompts. System prompt is the standing contract. Role, tone, constraints, output shape. User prompt is the request in this turn. If you put 'never invent policy numbers' in the user prompt, the next user can overwrite it. Put standing rules in the system prompt.

Mira Cole

Effective prompts are specific. Bad: 'help with claims.' Better: 'You are a claims assistant. Answer only from the provided policy excerpts. If the excerpt is missing, say you do not know. Return JSON with fields decision and reason.'

Owen Park

Zero-shot, few-shot, chain-of-thought, we already named those. On this exam, few-shot is how you lock a format. Chain-of-thought is for multi-step reasoning. Do not dump your entire wiki into the system prompt and call it engineering.

Mira Cole

The lightweight chat client is a small Python program. Packages you should recognize: azure-ai-projects, azure-identity, and openai. You authenticate with DefaultAzureCredential, not by pasting a key into a public notebook if you can help it.

Owen Park

Shape of the code, said in English. Create an A.I. Project Client with your project endpoint. Call get openai client to get a chat client that works even for non-OpenAI models deployed in the project. Call chat completions create with a model deployment name and a messages array. Print the content of the first choice.

Mira Cole

The messages array looks like two dictionaries. Role system, content your standing instructions. Role user, content the question. That is the whole lightweight app. The exam wants you to recognize that pattern, not recite every parameter.

Owen Park

Project endpoint looks like this: the resource name, then services dot A.I. dot azure dot com, then api slash projects, then the project name. You copy it from the project's Overview page. If a question shows a key and a model name with no project client, that might be talking to a model directly. Foundry's teaching point is the project client.

Mira Cole

Playground versus S.D.K. Playground is for trying prompts without code. S.D.K. is for an application. If the scenario says a developer needs a small chat app, it is the S.D.K. If it says a maker wants to test a prompt, it is the portal.

Mira Cole

Question one. Where should the instruction 'always answer in Spanish and never mention internal ticket I.D.s' live?

Owen Park

The system prompt. It is a standing rule. A user prompt is 'what is the status of my order.'

Mira Cole

Question two. You need to try three models on the same prompt before writing code. Where?

Owen Park

Foundry portal playground, after you deploy the models. Do not start by building three S.D.K. apps.

Mira Cole

Question three. Which Python objects show up in a lightweight Foundry chat client?

Owen Park

A.I. Project Client plus an OpenAI-compatible chat client from get openai client. Not a clustering pipeline, not an Azure Machine Learning workspace client from twenty twenty-two.

Mira Cole

Question four. Why might you use the Foundry S.D.K. instead of talking to a raw model endpoint?

Owen Park

Because the project client already knows your deployments. Switching models is a deployment name change, and you stay inside the project's identity, tracing, and content filters.

Mira Cole

Question five. A snippet sends only a user message, no system message, and the model keeps ignoring the required JSON schema. What is the simplest fix?

Owen Park

Add a system message that states the schema, maybe with a few-shot example. Do not raise temperature. That makes it worse.

Mira Cole

Episode eight is agents. Same workshop, extra furniture: instructions, tools, knowledge, a single-agent test in the portal, then a lightweight client that talks to the agent instead of the raw model.

Owen Park

The model does not run your function. It asks you to. That sentence will save you a question.