Files
Giles Odigwe 6f6ee61834 Python: Fix broken samples and add missing READMEs (#5038)
* Python: Fix broken samples and add missing READMEs

- simple_context_provider: move instructions kwarg into options dict
- suspend_resume_session: use OpenAIChatCompletionClient for in-memory demo
- foundry_chat_client_with_hosted_mcp: move store kwarg into options dict
- Add README.md for context_providers and conversations sample folders

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Python: Fix additional sample issues in context_providers

- mem0_basic: send preferences query before sleep so Mem0 can learn them,
  print result from new session recall
- mem0_sessions: add session for multi-turn conversation in agent-scoped
  example, remove user_id from agent-scoped provider (Mem0 API stores
  memories without user_id when agent_id is provided), use single message
  for storing preferences
- redis_basics: print retrieved context messages instead of raw object
- redis_sessions: add missing load_dotenv() call
- redis_basics/redis_sessions: fix docstrings referencing wrong client type
- azure_redis_conversation: replace duplicate copyright with load_dotenv()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Python: Fix broken link in declarative README

openai_responses_agent.py was renamed to openai_agent.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-01 21:35:16 +00:00

1.7 KiB

Context Provider Samples

These samples demonstrate how to use context providers to enrich agent conversations with external knowledge — from custom logic to Azure AI Search (RAG) and memory services.

Samples

File / Folder Description
simple_context_provider.py Implement a custom context provider by extending BaseContextProvider to extract and inject structured user information across turns.
azure_ai_foundry_memory.py Use FoundryMemoryProvider to add semantic memory — automatically retrieves, searches, and stores memories via Azure AI Foundry.
azure_ai_search/ Retrieval Augmented Generation (RAG) with Azure AI Search in semantic and agentic modes. See its own README.
mem0/ Memory-powered context using the Mem0 integration (open-source and managed). See its own README.
redis/ Redis-backed context providers for conversation memory and sessions. See its own README.

Prerequisites

For simple_context_provider.py:

  • FOUNDRY_PROJECT_ENDPOINT: Your Azure AI Foundry project endpoint
  • FOUNDRY_MODEL: Model deployment name
  • Azure CLI authentication (az login)

For azure_ai_foundry_memory.py:

  • FOUNDRY_PROJECT_ENDPOINT: Your Azure AI Foundry project endpoint
  • FOUNDRY_MODEL: Chat/responses model deployment name
  • AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME: Embedding model deployment name (e.g., text-embedding-ada-002)
  • Azure CLI authentication (az login)

See each subfolder's README for provider-specific prerequisites.