Python: [BREAKING]: removed display_name, renamed context_providers, middleware and AggregateContextProvider (#3139)

* removed display_name, renamed context_providers, middleware and AggregateContextProvider

* fixes

* fixed test

* testfix

* removed mistakenly put back test

* updated new test

* rename middlewares to middleware

* middleware fixes
This commit is contained in:
Eduard van Valkenburg
2026-01-13 03:24:07 +01:00
committed by GitHub
Unverified
parent ef44fb4960
commit 203fb7b1c4
80 changed files with 596 additions and 838 deletions
@@ -116,18 +116,18 @@ This is only needed if you want to integrate with external caching systems.
```python
class SimpleDictCacheProvider:
"""Custom cache provider that implements the CacheProvider protocol."""
def __init__(self) -> None:
self._cache: dict[str, Any] = {}
async def get(self, key: str) -> Any | None:
"""Get a value from the cache."""
return self._cache.get(key)
async def set(self, key: str, value: Any, ttl_seconds: int | None = None) -> None:
"""Set a value in the cache."""
self._cache[key] = value
async def remove(self, key: str) -> None:
"""Remove a value from the cache."""
self._cache.pop(key, None)
@@ -154,7 +154,7 @@ async def run_with_agent_middleware() -> None:
chat_client=chat_client,
instructions=JOKER_INSTRUCTIONS,
name=JOKER_NAME,
middleware=purview_agent_middleware,
middleware=[purview_agent_middleware],
)
print("-- Agent Middleware Path --")
@@ -239,7 +239,7 @@ async def run_with_custom_cache_provider() -> None:
chat_client=chat_client,
instructions=JOKER_INSTRUCTIONS,
name=JOKER_NAME,
middleware=purview_agent_middleware,
middleware=[purview_agent_middleware],
)
print("-- Custom Cache Provider Path --")
@@ -279,7 +279,7 @@ async def run_with_custom_cache_provider() -> None:
chat_client=chat_client,
instructions=JOKER_INSTRUCTIONS,
name=JOKER_NAME,
middleware=purview_agent_middleware,
middleware=[purview_agent_middleware],
)
print("-- Default Cache Path --")