Generative AI & agentic solutions · 30–35%

Build generative AI apps

~3 min read

Endpoint + SDK decision

You needUse
Agents, evaluations, tracing, connections, Foundry direct models, governanceFoundry SDK (azure-ai-projects) + project endpoint (…services.ai.azure.com/api/projects/<name>)
Max OpenAI compatibility, portability, plain inferenceOpenAI SDK + Azure OpenAI endpoint (…openai.azure.com/openai/v1)

Both can coexist in one app. Foundry SDK chat client = project_client.get_openai_client() (still OpenAI under the hood).

Responses API vs ChatCompletions

Both are OpenAI chat APIs: you send messages, the model answers. The difference is who keeps the conversation state.

Responses (recommended)ChatCompletions (legacy/compat)
StateStatefulprevious_response_id chains turnsStateless — you resend full messages history
ModelsAzure OpenAI + Foundry direct modelsBroad ecosystem compatibility
MergesChatCompletions + Assistants patterns
r1 = client.responses.create(model="gpt-4.1", instructions="You are…", input="What is ML?")
r2 = client.responses.create(model="gpt-4.1", input="Example?", previous_response_id=r1.id)

Built-in tools (Responses API)

A tool is a capability you list in the request that the model may decide to call — running code, searching, or invoking your functions — before it answers.

ToolDoesTrigger phrase in questions
code_interpreterRuns Python in sandbox (pandas/numpy, no network)“calculate / analyze CSV / chart”
web_searchLive internet info“current / latest / after training cutoff”
file_searchSearches vector store of your uploaded files“answer from our PDFs”
functionModel emits a call, your code runs it, you send back function_call_output with the call_id“call our API / take action”
Function calling: the model never executes your function. It returns a structured call; your app runs it and sends the result back (function_call_output + call_id). Validate arguments — don’t trust them blindly.

RAG in an app

RAG (retrieval-augmented generation) is a pattern that fetches relevant data at question time and injects it into the prompt, so the model answers from your facts instead of its training memory. The three steps: retrieve matching content, augment the prompt with it, generate the answer. Embeddings (vectors) plus cosine similarity find meaning-matched content; Azure AI Search hosts the index; hybrid search recommended. For enterprise-scale agent knowledge, use Foundry IQ instead of building your own.

Evaluate models & apps

“Detect fabrications” means groundedness. “Summarization quality vs a reference” means ROUGE. “Translation quality” means BLEU.