Python: Update installation instructions (#1026)

* Update installation instructions

* address comments
This commit is contained in:
Tao Chen
2025-09-30 12:28:54 -07:00
committed by GitHub
Unverified
parent 2d20e644df
commit f7e9490494
17 changed files with 48 additions and 55 deletions
@@ -22,7 +22,7 @@ This folder contains an example demonstrating how to use the Redis context provi
### Install the package
```bash
pip install "agent-framework[redis]"
pip install "agent-framework-redis"
```
## Running Redis
@@ -20,7 +20,7 @@ realistic scenarios:
Requirements:
- A Redis instance with RediSearch enabled (e.g., Redis Stack)
- agent-framework with the Redis extra installed: pip install "agent-framework[redis]"
- agent-framework with the Redis extra installed: pip install "agent-framework-redis"
- Optionally an OpenAI API key if enabling embeddings for hybrid search
Run:
@@ -7,7 +7,7 @@ conversational details. Pass it as a constructor argument to create_agent.
Requirements:
- A Redis instance with RediSearch enabled (e.g., Redis Stack)
- agent-framework with the Redis extra installed: pip install "agent-framework[redis]"
- agent-framework with the Redis extra installed: pip install "agent-framework-redis"
- Optionally an OpenAI API key if enabling embeddings for hybrid search
Run:
@@ -19,7 +19,7 @@ Redis context provider. It covers three scenarios:
Requirements:
- A Redis instance with RediSearch enabled (e.g., Redis Stack)
- agent-framework with the Redis extra installed: pip install "agent-framework[redis]"
- agent-framework with the Redis extra installed: pip install "agent-framework-redis"
- Optionally an OpenAI API key for the chat client in this demo
Run:
@@ -30,15 +30,15 @@ import asyncio
import os
import uuid
from agent_framework_redis._provider import RedisProvider
from agent_framework.openai import OpenAIChatClient
from redisvl.utils.vectorize import OpenAITextVectorizer
from agent_framework_redis._provider import RedisProvider
from redisvl.extensions.cache.embeddings import EmbeddingsCache
from redisvl.utils.vectorize import OpenAITextVectorizer
# Please set the OPENAI_API_KEY and OPENAI_CHAT_MODEL_ID environment variables to use the OpenAI vectorizer
# Recommend default for OPENAI_CHAT_MODEL_ID is gpt-4o-mini
async def example_global_thread_scope() -> None:
"""Example 1: Global thread_id scope (memories shared across all operations)."""
print("1. Global Thread Scope Example:")
@@ -70,7 +70,8 @@ async def example_global_thread_scope() -> None:
"Before answering, always check for stored context containing information"
),
tools=[],
context_providers=provider)
context_providers=provider,
)
# Store a preference in the global scope
query = "Remember that I prefer technical responses with code examples when discussing programming."
@@ -108,7 +109,7 @@ async def example_per_operation_thread_scope() -> None:
api_config={"api_key": os.getenv("OPENAI_API_KEY")},
cache=EmbeddingsCache(name="openai_embeddings_cache", redis_url="redis://localhost:6379"),
)
provider = RedisProvider(
redis_url="redis://localhost:6379",
index_name="redis_threads_dynamic",
@@ -123,7 +124,7 @@ async def example_per_operation_thread_scope() -> None:
vector_algorithm="hnsw",
vector_distance_metric="cosine",
)
agent = client.create_agent(
name="ScopedMemoryAssistant",
instructions="You are an assistant with thread-scoped memory.",
@@ -176,7 +177,7 @@ async def example_multiple_agents() -> None:
api_config={"api_key": os.getenv("OPENAI_API_KEY")},
cache=EmbeddingsCache(name="openai_embeddings_cache", redis_url="redis://localhost:6379"),
)
personal_provider = RedisProvider(
redis_url="redis://localhost:6379",
index_name="redis_threads_agents",
@@ -188,13 +189,13 @@ async def example_multiple_agents() -> None:
vector_algorithm="hnsw",
vector_distance_metric="cosine",
)
personal_agent = client.create_agent(
name="PersonalAssistant",
instructions="You are a personal assistant that helps with personal tasks.",
context_providers=personal_provider,
)
work_provider = RedisProvider(
redis_url="redis://localhost:6379",
index_name="redis_threads_agents",
@@ -206,7 +207,7 @@ async def example_multiple_agents() -> None:
vector_algorithm="hnsw",
vector_distance_metric="cosine",
)
work_agent = client.create_agent(
name="WorkAssistant",
instructions="You are a work assistant that helps with professional tasks.",