Skip to content

Commit d1aff09

Browse files
committed
Address PR review comments from Copilot code review
- workflow_hitl.py: Remove stale approval_mode comments (English + Spanish) - agent_knowledge_pg.py: Fix extend_messages(self) -> extend_messages(self.source_id) - agent_supervisor.py: Change logger level from DEBUG to INFO for consistency - README.md: Add PostgreSQL setup instructions for local environment (English + Spanish) - sqlite_viewer.py: Fix --db help text to say chat_history.sqlite3 - sqlite_viewer.py: Replace thread_id with session_id in SQL queries (English + Spanish) - agent_summarization.py: Use HISTORY_STATE_KEY constant instead of hard-coded 'memory' - agent_memory_redis.py: Fix print title RedisProvider -> RedisContextProvider - docker-compose.yml: Add REDIS_URL and POSTGRES_URL env vars for dev container
1 parent f82066d commit d1aff09

15 files changed

Lines changed: 56 additions & 46 deletions

.devcontainer/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ services:
99
environment:
1010
- OTEL_EXPORTER_OTLP_ENDPOINT=http://aspire-dashboard:18889
1111
- OTEL_EXPORTER_OTLP_PROTOCOL=grpc
12+
- REDIS_URL=redis://redis:6379
13+
- POSTGRES_URL=postgresql://admin:LocalPasswordOnly@db:5432/postgres
1214

1315
db:
1416
image: pgvector/pgvector:pg17

.github/prompts/review_slides.prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Review the given slides for consistency with the code samples in the repository.
77
Use the markitdown skill to convert the PDF to markdown first.
88

99
Point out any errors, inconsistencies, or areas that may need clarification. Provide specific feedback on how to improve the slides to better align with the code and concepts presented in the repository.
10-
Make sure all URLs/filenames are valid.
10+
Make sure all URLs/filenames are valid.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ The dev container includes a Redis server, which is used by the `agent_history_r
8787
docker run -d -p 6379:6379 redis:7-alpine
8888
```
8989

90+
5. *Optional:* To run the PostgreSQL examples (`agent_knowledge_postgres.py`, `agent_knowledge_pg.py`, `agent_knowledge_pg_rewrite.py`), you need PostgreSQL with pgvector running locally:
91+
92+
```shell
93+
docker run -d -p 5432:5432 -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=LocalPasswordOnly pgvector/pgvector:pg17
94+
```
95+
9096
## Configuring model providers
9197

9298
These examples can be run with Azure AI Foundry, OpenAI.com, or GitHub Models, depending on the environment variables you set. All the scripts reference the environment variables from a `.env` file, and an example `.env.sample` file is provided. Host-specific instructions are below.

examples/agent_knowledge_pg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ async def before_run(
311311

312312
knowledge_text = "\n".join(knowledge_lines)
313313
context.extend_messages(
314-
self,
314+
self.source_id,
315315
[Message(role="system", text=knowledge_text)],
316316
)
317317

examples/agent_memory_redis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async def example_agent_with_memory() -> None:
6767
6868
Requires Redis Stack (with RediSearch module) — see docker-compose.yaml.
6969
"""
70-
print("\n[bold]=== Agent with Redis Memory (RedisProvider) ===[/bold]")
70+
print("\n[bold]=== Agent with Redis Memory (RedisContextProvider) ===[/bold]")
7171

7272
user_id = str(uuid.uuid4())
7373

examples/agent_summarization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ async def process(
186186

187187
# Before the agent runs: check if we should compact the history
188188
if session and self.context_tokens > self.token_threshold:
189-
history = session.state["memory"]["messages"]
189+
history = session.state.get(self.HISTORY_STATE_KEY, {}).get("messages", [])
190190
if len(history) > 2:
191191
logger.info(
192192
"[📝 Summarization] Token usage (%d) exceeds threshold (%d). "
@@ -204,7 +204,7 @@ async def process(
204204
)
205205

206206
# Replace session history with a single summary message
207-
session.state["memory"]["messages"] = [
207+
session.state[self.HISTORY_STATE_KEY]["messages"] = [
208208
Message(role="assistant", text=f"[Summary of earlier conversation]\n{summary_text}"),
209209
]
210210

examples/agent_supervisor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
handler = RichHandler(show_path=False, rich_tracebacks=True, show_level=False)
1919
logging.basicConfig(level=logging.WARNING, handlers=[handler], force=True, format="%(message)s")
2020
logger = logging.getLogger(__name__)
21-
logger.setLevel(logging.DEBUG)
21+
logger.setLevel(logging.INFO)
2222

2323
# Configure OpenAI client based on environment
2424
load_dotenv(override=True)

examples/spanish/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ El dev container incluye un servidor Redis, que se usa en el ejemplo `agent_hist
8888
docker run -d -p 6379:6379 redis:7-alpine
8989
```
9090

91+
5. *Opcional:* Para ejecutar los ejemplos de PostgreSQL (`agent_knowledge_postgres.py`, `agent_knowledge_pg.py`, `agent_knowledge_pg_rewrite.py`), necesitas PostgreSQL con pgvector corriendo localmente:
92+
93+
```shell
94+
docker run -d -p 5432:5432 -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=LocalPasswordOnly pgvector/pgvector:pg17
95+
```
96+
9197
## Configurar proveedores de modelos
9298

9399
Estos ejemplos se pueden ejecutar con Azure AI Foundry, OpenAI.com o GitHub Models, dependiendo de las variables de entorno que configures. Todos los scripts hacen referencia a las variables de entorno de un archivo `.env`, y se proporciona un archivo de ejemplo `.env.sample`. Las instrucciones específicas de cada proveedor se encuentran a continuación.

examples/spanish/agent_knowledge_pg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ async def before_run(
311311

312312
knowledge_text = "\n".join(knowledge_lines)
313313
context.extend_messages(
314-
self,
314+
self.source_id,
315315
[Message(role="system", text=knowledge_text)],
316316
)
317317

examples/spanish/agent_memory_redis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async def example_agent_with_memory() -> None:
6767
6868
Requiere Redis Stack (con el módulo RediSearch): revisa docker-compose.yaml.
6969
"""
70-
print("\n[bold]=== Agente con memoria en Redis (RedisProvider) ===[/bold]")
70+
print("\n[bold]=== Agente con memoria en Redis (RedisContextProvider) ===[/bold]")
7171

7272
user_id = str(uuid.uuid4())
7373

0 commit comments

Comments
 (0)