Skip to content

Commit

Permalink
add a prompt to not use filler words
Browse files Browse the repository at this point in the history
  • Loading branch information
marmikcfc committed Jun 11, 2024
1 parent 84ea46e commit 538d666
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bolna/agent_manager/task_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ async def load_prompt(self, assistant_name, task_id, local, **kwargs):
self.prompts["system_prompt"] = enriched_prompt
self.system_prompt = {
'role': "system",
'content': f"{enriched_prompt}\n### Date\n Today\'s Date is {today}"
'content': f"{enriched_prompt}\n### Note:\nPlease, do not start your response with fillers like Got it, Noted etc. \n### Date\n Today\'s Date is {today}"
}
else:
self.system_prompt = {
Expand Down
26 changes: 16 additions & 10 deletions bolna/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,24 @@ async def store_file(bucket_name=None, file_key=None, file_data=None, content_ty
if local:
dir_name = PREPROCESS_DIR if preprocess_dir is None else preprocess_dir
directory_path = os.path.join(dir_name, os.path.dirname(file_key))
logger.info(file_data)
os.makedirs(directory_path, exist_ok=True)
if content_type == "json":
try:
logger.info(f"Writing to {dir_name}/{file_key} ")
with open(f"{dir_name}/{file_key}", 'w') as f:
data = json.dumps(file_data)
f.write(data)
elif content_type in ["mp3", "wav", "pcm", "csv"]:
with open(f"{dir_name}/{file_key}", 'w') as f:
data = file_data
f.write(data)

if content_type == "json":

with open(f"{dir_name}/{file_key}", 'w') as f:
data = json.dumps(file_data)
f.write(data)
elif content_type in ['csv']:
with open(f"{dir_name}/{file_key}", 'w') as f:
data = file_data
f.write(data)
elif content_type in ["mp3", "wav", "pcm"]:
with open(f"{dir_name}/{file_key}", 'wb') as f:
data = file_data
f.write(data)
except Exception as e:
logger.error(f"Could not save local file {e}")

async def get_raw_audio_bytes(filename, agent_name = None, audio_format='mp3', assistant_id=None, local = False, is_location = False):
# we are already storing pcm formatted audio in the filler config. No need to encode/decode them further
Expand Down
6 changes: 1 addition & 5 deletions bolna/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,7 @@ class Task(BaseModel):
toolchain: ToolsChainModel
task_type: Optional[str] = "conversation" # extraction, summarization, notification
task_config: ConversationConfig = dict()

@validator('voice')
def check_voice(cls, value):
return validate_attribute(value, ['Jason','Oscar','Travis','Joseph','Ram'])


class AgentModel(BaseModel):
agent_name: str
agent_type: str = "other"
Expand Down

0 comments on commit 538d666

Please sign in to comment.