Spaces:
Runtime error
Runtime error
KonradSzafer
commited on
Commit
•
2014dcd
1
Parent(s):
f9b4b24
channel id config working
Browse files- discord_bot/__main__.py +1 -1
- discord_bot/client/client.py +1 -1
- qa_engine/config.py +1 -1
- qa_engine/qa_engine.py +0 -3
discord_bot/__main__.py
CHANGED
@@ -16,7 +16,7 @@ qa_engine = QAEngine(
|
|
16 |
)
|
17 |
client = DiscordClient(
|
18 |
qa_engine=qa_engine,
|
19 |
-
channel_ids=config.
|
20 |
num_last_messages=config.num_last_messages,
|
21 |
use_names_in_context=config.use_names_in_context,
|
22 |
enable_commands=config.enable_commands,
|
|
|
16 |
)
|
17 |
client = DiscordClient(
|
18 |
qa_engine=qa_engine,
|
19 |
+
channel_ids=config.discord_channel_ids,
|
20 |
num_last_messages=config.num_last_messages,
|
21 |
use_names_in_context=config.use_names_in_context,
|
22 |
enable_commands=config.enable_commands,
|
discord_bot/client/client.py
CHANGED
@@ -46,7 +46,7 @@ class DiscordClient(discord.Client):
|
|
46 |
'The number of last messages in context should be at least 1'
|
47 |
|
48 |
self.qa_engine: QAEngine = qa_engine
|
49 |
-
self.channel_ids: list[int] = channel_ids
|
50 |
self.num_last_messages: int = num_last_messages
|
51 |
self.use_names_in_context: bool = use_names_in_context
|
52 |
self.enable_commands: bool = enable_commands
|
|
|
46 |
'The number of last messages in context should be at least 1'
|
47 |
|
48 |
self.qa_engine: QAEngine = qa_engine
|
49 |
+
self.channel_ids: list[int] = eval(channel_ids)
|
50 |
self.num_last_messages: int = num_last_messages
|
51 |
self.use_names_in_context: bool = use_names_in_context
|
52 |
self.enable_commands: bool = enable_commands
|
qa_engine/config.py
CHANGED
@@ -36,7 +36,7 @@ class Config:
|
|
36 |
|
37 |
# Discord bot config - optional
|
38 |
discord_token: str = get_env('DISCORD_TOKEN', '-', warn=False)
|
39 |
-
|
40 |
num_last_messages: int = int(get_env('NUM_LAST_MESSAGES', 2, warn=False))
|
41 |
use_names_in_context: bool = eval(get_env('USE_NAMES_IN_CONTEXT', 'False', warn=False))
|
42 |
enable_commands: bool = eval(get_env('ENABLE_COMMANDS', 'True', warn=False))
|
|
|
36 |
|
37 |
# Discord bot config - optional
|
38 |
discord_token: str = get_env('DISCORD_TOKEN', '-', warn=False)
|
39 |
+
discord_channel_ids: list[int] = get_env('DISCORD_CHANNEL_IDS', field(default_factory=list), warn=False)
|
40 |
num_last_messages: int = int(get_env('NUM_LAST_MESSAGES', 2, warn=False))
|
41 |
use_names_in_context: bool = eval(get_env('USE_NAMES_IN_CONTEXT', 'False', warn=False))
|
42 |
enable_commands: bool = eval(get_env('ENABLE_COMMANDS', 'True', warn=False))
|
qa_engine/qa_engine.py
CHANGED
@@ -86,9 +86,6 @@ class TransformersPipelineModel(LLM):
|
|
86 |
)
|
87 |
|
88 |
def _call(self, prompt: str, stop: Optional[list[str]] = None) -> str:
|
89 |
-
from llmlingua import PromptCompressor
|
90 |
-
llm_lingua = PromptCompressor()
|
91 |
-
prompt = llm_lingua.compress_prompt(prompt, instruction="", question="", target_token=400)
|
92 |
output_text = self.pipeline(prompt)[0]['generated_text']
|
93 |
output_text = output_text.replace(prompt+'\n', '')
|
94 |
return output_text
|
|
|
86 |
)
|
87 |
|
88 |
def _call(self, prompt: str, stop: Optional[list[str]] = None) -> str:
|
|
|
|
|
|
|
89 |
output_text = self.pipeline(prompt)[0]['generated_text']
|
90 |
output_text = output_text.replace(prompt+'\n', '')
|
91 |
return output_text
|