Skip to content

Commit

Permalink
cache key fix + faq fix
Browse files Browse the repository at this point in the history
  • Loading branch information
WaelKarkoub committed May 4, 2024
1 parent 8390dec commit a3fb568
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 5 additions & 4 deletions autogen/agentchat/contrib/capabilities/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,18 +386,19 @@ def _compress_text(self, text: str) -> Tuple[int, str]:

def _cache_get(self, content: Union[str, List[Dict]]) -> Optional[Tuple[int, Union[str, List[Dict]]]]:
if self._cache:
key = f"{json.dumps(content)}_{self._min_tokens}"
cached_value = self._cache.get(key)
cached_value = self._cache.get(self._cache_key(content))
if cached_value:
return cached_value

def _cache_set(
self, content: Union[str, List[Dict]], compressed_content: Union[str, List[Dict]], tokens_saved: int
):
if self._cache:
key = json.dumps(content)
value = (tokens_saved, json.dumps(compressed_content))
self._cache.set(key, value)
self._cache.set(self._cache_key(content), value)

def _cache_key(self, content: Union[str, List[Dict]]) -> str:
return f"{json.dumps(content)}_{self._min_tokens}"

def _validate_min_tokens(self, min_tokens: Optional[int]):
if min_tokens is not None and min_tokens <= 0:
Expand Down
1 change: 0 additions & 1 deletion website/docs/FAQ.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ Migrating enhances flexibility, modularity, and customization in handling chat m
### How to migrate?

To ensure a smooth migration process, simply follow the detailed guide provided in [Introduction to TransfromMessages](/docs/topics/handling_long_contexts/intro_to_transform_messages.md).
To ensure a smooth migration process, simply follow the detailed guide provided in [Handling Long Context Conversations with Transform Messages](/docs/topics/long_contexts.md).

### What should I do if I get the error "TypeError: Assistants.create() got an unexpected keyword argument 'file_ids'"?

Expand Down

0 comments on commit a3fb568

Please sign in to comment.