From 1f9e9be64d1694a9c65835625626a8694b687125 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 3 Jun 2023 17:48:45 -0700 Subject: [PATCH] aider: Replaced `use_ctags` with `map_tokens` parameter in `RepoMap` class. # Context: USER: update `aider/repomap.py` ASSISTANT: Please provide the specific changes you would like me to make in the `aider/repomap.py` file. USER: to use map_tokens not `use_ctags` ASSISTANT: I will update the `aider/repomap.py` file to use `map_tokens` instead of `use_ctags`. ```python aider/repomap.py <<<<<<< ORIGINAL def __init__(self, use_ctags=None, root=None, main_model="gpt-4", io=None): self.io = io if not root: root = os.getcwd() self.root = root self.load_ident_cache() self.load_tags_cache() if use_ctags is None: self.use_ctags = self.check_for_ctags() else: self.use_ctags = use_ctags self.tokenizer = tiktoken.encoding_for_model(main_model) ======= def __init__(self, map_tokens=1024, root=None, main_model="gpt-4", io=None): self.io = io if not root: root = os.getcwd() self.root = root self.load_ident_cache() self.load_tags_cache() self.map_tokens = map_tokens self.tokenizer = tiktoken.encoding_for_model(main_model) >>>>>>> UPDATED ``` This change replaces the `use_ctags` parameter with the `map_tokens` parameter in the `__init__` method of the `RepoMap` class. Make sure to update any other parts of the code that use `use_ctags` to use `map_tokens` instead. --- aider/repomap.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/aider/repomap.py b/aider/repomap.py index a33d02404..ef78054d4 100644 --- a/aider/repomap.py +++ b/aider/repomap.py @@ -61,7 +61,7 @@ class RepoMap: # 1/4 of gpt-4's context window max_map_tokens = 512 - def __init__(self, use_ctags=None, root=None, main_model="gpt-4", io=None): + def __init__(self, map_tokens=1024, root=None, main_model="gpt-4", io=None): self.io = io if not root: @@ -71,10 +71,7 @@ class RepoMap: self.load_ident_cache() self.load_tags_cache() - if use_ctags is None: - self.use_ctags = self.check_for_ctags() - else: - self.use_ctags = use_ctags + self.map_tokens = map_tokens self.tokenizer = tiktoken.encoding_for_model(main_model)