jerome-white commited on
Commit
416107c
1 Parent(s): ef3d4ad

Encapsulate the database during chat construction

Browse files
Files changed (1) hide show
  1. mylib/_chat.py +4 -3
mylib/_chat.py CHANGED
@@ -23,8 +23,9 @@ class ChatController:
23
  'max_completion_tokens': 2 ** 12,
24
  }
25
 
26
- def __init__(self, client, gpt, chat):
27
  self.client = client
 
28
  self.gpt = gpt
29
  self.chat = chat
30
 
@@ -44,14 +45,14 @@ class ChatController:
44
  self.thread = self.client.beta.threads.create()
45
  self.attached = False
46
 
47
- def __call__(self, prompt, database):
48
  if not self.attached:
49
  self.client.beta.assistants.update(
50
  assistant_id=self.assistant.id,
51
  tool_resources={
52
  'file_search': {
53
  'vector_store_ids': [
54
- database.vector_store_id,
55
  ],
56
  },
57
  },
 
23
  'max_completion_tokens': 2 ** 12,
24
  }
25
 
26
+ def __init__(self, client, database, gpt, chat):
27
  self.client = client
28
+ self.database = database
29
  self.gpt = gpt
30
  self.chat = chat
31
 
 
45
  self.thread = self.client.beta.threads.create()
46
  self.attached = False
47
 
48
+ def __call__(self, prompt):
49
  if not self.attached:
50
  self.client.beta.assistants.update(
51
  assistant_id=self.assistant.id,
52
  tool_resources={
53
  'file_search': {
54
  'vector_store_ids': [
55
+ self.database.vector_store_id,
56
  ],
57
  },
58
  },