> ## Content Index
> Fetch the complete content index at: https://blog.getzep.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Zep v0.17 - Summary Search and Enrichment, Scalability Improvements
- URL: https://blog.getzep.com/zep-v0-17/
- Published: 2023-10-31T17:48:47.000Z
- Updated: 2023-10-31T17:48:47.000Z
- Description: Zep now supports searching chat history summaries helping developers provide rich, succinct context to LLMs.
- Author: Daniel Chalef

[Zep 0.17.0, released today](https://github.com/getzep/zep/releases?ref=blog.getzep.com), now includes the ability to search over summaries created by Zep, offering a new and powerful path to grounding your LLM apps with long-term memory.

Zep periodically generates summaries from chat histories persisted to the Zep service. A summary and a set of recent chat messages are returned when a [developer retrieves recent memory from Zep](https://docs.getzep.com/sdk/chat%5Fhistory/memories/?ref=blog.getzep.com#getting-a-sessions-memory). 

Before v0.17, individual chat messages could be [searched and populated into a prompt](https://docs.getzep.com/sdk/chat%5Fhistory/search/?ref=blog.getzep.com). This has limitations, as vector similarity search can have poor results when chat messages are short or lack context. Think of a single one-word *yes* in answer to a question. This is important information but may not result in a vector search result.

Zep stores all historical summaries of a conversation. Now, you can search over these summaries and populate your prompt with them. Since a summary is a distillation of a conversation, they're more likely to match your search query and offer rich, succinct context to the LLM.

```typescript
import {
  MemorySearchPayload,
  NotFoundError,
  ZepClient
} from '@getzep/zep-js'

const searchPayload = new MemorySearchPayload({
  text: searchText,
  search_scope: 'summary',
  search_type: 'mmr',
  mmr_lambda: 0.5
})
const searchResults = await client.memory.searchMemory(
  sessionID,
  searchPayload,
  3
)
searchResults.forEach((searchResult) => {
  console.debug('Search Result: ', JSON.stringify(searchResult.summary?.content))
  console.debug(
    'Search Result Distance: ',
    JSON.stringify(searchResult.dist)
  )
})
```

Setting "search\_scope" to "summary" returns summary matches

Zep's native support for [Maximum Marginal Relevance Re-Ranking](https://docs.getzep.com/sdk/search%5Fquery/?ref=blog.getzep.com#maximal-marginal-relevance-re-ranking) is particularly useful with summaries. Successive summaries may include similar content, with Zep's similarity search returning the highest matching results but with little diversity. 

MMR re-ranks the results to ensure that the summaries you populate into your prompt are both relevant and each offers additional information to the LLM.

### Summary Enrichment with Named Entities

Zep now enriches summaries with Named Entities, similar to the enrichment already offered for individual chat messages. 

![](https://storage.ghost.io/c/79/c4/79c4903e-2432-4c0e-b8c8-c8988fef71ec/content/images/2023/10/image-1.png)

Search over summaries [can be filtered by the named entity metadata](https://docs.getzep.com/sdk/search%5Fquery/?ref=blog.getzep.com#filtering-using-metadata) added to the summary by Zep.

```typescript
const searchPayload = new MemorySearchPayload({
   metadata: {
      where: {
         and: [
            {
               jsonpath:
                  '$.system.entities[*] ? (@.Label == "WORK_OF_ART")',
            },
            {
               jsonpath:
                  '$.system.entities[*] ? (@.Name like_regex "^parable*" flag "i")',
            },
         ],
      },
   },
   text: searchText,
});
```

### Scalability Improvements

The Zep service is now entirely stateless, allowing simple scale-out of Zep instances. All background operations are now persisted in a message queue in Zep's back-end Postgres service and executed by Zep instances when available.

### Upgrading to v0.17.0  

1. To upgrade Zep, pull the latest containers from Zep GitHub Package Repo. If you're using `docker compose`, you can run:

```bash
git pull
docker compose pull
```

1. Modify your configuration by adding the `entities` and `embeddings` sections under `summarizer` according to your setup.

```yaml
extractors:
  messages:
    summarizer:
      enabled: true
      entities:
        enabled: true
      embeddings:
        enabled: true
        dimensions: 384
        service: "local"
```

Alternatively, add the following variables to your environment:

```bash
ZEP_EXTRACTORS_MESSAGES_SUMMARIZER_ENTITIES_ENABLED=true
ZEP_EXTRACTORS_MESSAGES_SUMMARIZER_EMBEDDINGS_ENABLED=true
ZEP_EXTRACTORS_MESSAGES_SUMMARIZER_EMBEDDINGS_SERVICE=openai
ZEP_EXTRACTORS_MESSAGES_SUMMARIZER_EMBEDDINGS_DIMENSIONS=1536
```

Modify the above [embedding settings](https://docs.getzep.com/deployment/embeddings/?ref=blog.getzep.com) according to your requirements.

1. Upgrade Python or TypeScript SDKs to the latest available versions.

### Next Steps

- [Zep Quick Start Guide](https://docs.getzep.com/deployment/quickstart/?ref=blog.getzep.com)