Skip to content

Commit

Permalink
Add automator prompts to chatbots configuration by default
Browse files Browse the repository at this point in the history
Refactor backend API config to simplified structure
Add normalization to vllm_api and sentry config inputs
Fix typo in HANA config prompts
Add default speech service plugin to extra dependency config
Update Klat server config
  • Loading branch information
NeonDaniel committed Nov 5, 2024
1 parent 7fd6c11 commit 40ad4b6
Show file tree
Hide file tree
Showing 2 changed files with 217 additions and 19 deletions.
73 changes: 54 additions & 19 deletions neon_diana_utils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def make_keys_config(write_config: bool,
api_services = {
"wolfram_alpha": {"api_key": wolfram_key},
"alpha_vantage": {"api_key": alphavantage_key},
"open_weather_map": {"api_key": owm_key},
"open_weather_map": {"api_key": owm_key,
"cache_seconds": 1800},
"map_maker": {"api_key": maps_key}
}
click.echo(pformat(api_services))
Expand Down Expand Up @@ -202,6 +203,8 @@ def make_keys_config(write_config: bool,
config_confirmed = False
while not config_confirmed:
vllm_api_url = click.prompt("VLLM API URL", type=str)
if not vllm_api_url.startswith("http"):
vllm_api_url = f"https://{vllm_api_url}"
vllm_connection_key = click.prompt("VLLM Connection Key", type=str)
vllm_hf_token = click.prompt("Hugging Face Auth Token", type=str)
vllm_role = click.prompt("VLLM Role",
Expand Down Expand Up @@ -340,10 +343,8 @@ def make_keys_config(write_config: bool,
while not config_confirmed:
sentry_dsn = click.prompt("Sentry DSN", type=str)

should_enable_sentry = click.prompt("Enable Sentry by default?",
type=Choice(choices=["y", "n"],
case_sensitive=False,),
default="y")
should_enable_sentry = click.confirm("Enable Sentry by default?",
default=True)
sentry_sdk_config = {
"enabled": should_enable_sentry,
"dsn": sentry_dsn,
Expand All @@ -353,8 +354,8 @@ def make_keys_config(write_config: bool,
click.confirm("Is this configuration correct?")

config = {
"keys": {"api_services": api_services,
"emails": email_config,
"api_services": api_services,
"keys": {"emails": email_config,
"track_my_brands": brands_config},
"LLM_CHAT_GPT": chatgpt_config,
"LLM_VLLM": vllm_config,
Expand Down Expand Up @@ -479,9 +480,9 @@ def generate_hana_config() -> dict:
if click.confirm("Enable node websocket connections?"):
node_user = click.prompt("Node username", type=str, default="neon")
node_pass = click.prompt("Node password", type=str, default="neon")
rpm = click.prompt("Client maximum requests per limit", type=int,
rpm = click.prompt("Client maximum requests per minute", type=int,
default=60)
auth_rpm = click.prompt("Client maximum auth requests per limit",
auth_rpm = click.prompt("Client maximum auth requests per minute",
type=int, default=6)

hana_config = {"enable_email": email,
Expand Down Expand Up @@ -843,6 +844,17 @@ def configure_chatbots(rmq_path: str = None,
update_rmq_config(rmq_config)
click.echo(f"Updated RabbitMQ config file: {rmq_config}")
chatbots_config = _get_chatbots_mq_config(rmq_config)

default_prompts_file = join(dirname(__file__), "templates",
"automator_prompts.txt")
with open(default_prompts_file, "r") as f:
default_prompts = f.read().split('\n')

chatbots_config["chatbots"] = {
"proctor": {"next_wait": 60},
"automator": {"shouts_emit_interval": 180},
"prompts": default_prompts
}
with open(join(output_path, "chatbots", "chatbots.yaml"), 'w+') as f:
yaml.safe_dump(chatbots_config, f)
click.echo(f"Outputs generated in {output_path}")
Expand Down Expand Up @@ -960,7 +972,10 @@ def configure_neon_core(mq_user: str = None,
"skill-homescreen-lite.openvoiceos"]},
"MQ": mq_config,
"iris": {"languages": ["en-us", "uk-ua"]},
"log_level": "DEBUG"
"log_level": "DEBUG",
"extra_dependencies": {
"voice": ["neon-stt-plugin-nemo-remote"]
}
}
click.echo(f"Writing configuration to {neon_config_file}")
with open(neon_config_file, 'w+') as f:
Expand Down Expand Up @@ -1028,7 +1043,7 @@ def configure_klat_chat(external_url: str = None,
forward_www = click.confirm(f"Route www.{domain} traffic to Klat?")

# Get Libretranslate HTTP API URL
libretranslate_url = "https://libretranslate.2022.us"
libretranslate_url = "https://libretranslate.2022.us" # TODO: New Default
confirmed = False
while not confirmed:
libretranslate_url = click.prompt("Libretranslate API URL", type=str,
Expand Down Expand Up @@ -1082,12 +1097,20 @@ def configure_klat_chat(external_url: str = None,
click.echo(pformat(sftp_config))
confirmed = click.confirm("Is this configuration correct?")

k8s_namespace = "alpha" if "alpha" in domain \
else "beta" if "beta" in domain \
else "prod" if "chatbotsforum" in domain else "default"
k8s_config_path = "kube_config"
confirmed = False
while not confirmed:
k8s_namespace = click.prompt("Kubernetes namespace", type=str,
default=k8s_namespace)
k8s_config_path = click.prompt("Kubernetes config path", type=str,
default=k8s_config_path)
confirmed = click.confirm("Is this configuration correct?")

# Define klat.yaml config
config = {"SIO_URL": api_url,
"MQ": {"users": {"chat_observer": user_config},
"server": "neon-rabbitmq",
"port": 5672},
"CHAT_CLIENT": {"SERVER_URL": api_url,
config = {"CHAT_CLIENT": {"SERVER_URL": api_url,
"FORCE_HTTPS": https,
"RUNTIME_CONFIG": {
"CHAT_SERVER_URL_BASE": api_url}},
Expand All @@ -1100,10 +1123,22 @@ def configure_klat_chat(external_url: str = None,
"SECRET": "775115fdecb9b4971193b919d27d410a",
"JWT_ALGO": "HS256"},
"LIBRE_TRANSLATE_URL": libretranslate_url,
"SFTP": sftp_config
"SFTP": sftp_config,
"DATABASE_CONFIG": {"mongo": mongo_config,
"__default_alias": "mongo"},
"K8S_CONFIG": {
"K8S_DEFAULT_NAMESPACE": k8s_namespace,
"K8S_CONFIG_PATH": k8s_config_path}
},
"DATABASE_CONFIG": mongo_config}

"CHAT_OBSERVER": {"SIO_URL": api_url,
"SCAN_NEON_SERVICE": False,
"MQ": {"users": {"chat_observer": user_config},
"server": "neon-rabbitmq",
"port": 5672},
"KLAT_AUTH_CREDENTIALS": {
"username": "admin",
"password": "Neon2024!"
}}}
if orchestrator == Orchestrator.KUBERNETES:
shutil.copytree(join(dirname(__file__), "templates", "klat"),
join(output_path, "klat-chat"))
Expand Down
163 changes: 163 additions & 0 deletions neon_diana_utils/templates/automator_prompts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
Who was Luke's father?
What is the smallest cat?
What is the airspeed velocity of an unladen swallow?
When was the best of times?
Where does the time go?
How is the weather up there in botland?
How much do they pay you for this?
Why did the chicken cross the road?
Why repeal the three laws of robotics?
Which is better, cats or dogs?
Which of you is the wisest?
Which motherboard is your favorite?
Is it raining?
A computer once beat me at chess, but it was no match for me at kick boxing.
All children, except one, grow up.
Any thriving organization's success is in some part attributable to team members' collective commitment to shared organizational goals.
Are Some Youth Sports Too Intense?
Artificial intelligence is no match for natural stupidity
Call me Ishmael.
Can you follow Ikea instructions?
Chocolate or vanilla?
Computer Science is no more about computers than astronomy is about telescopes
Cooking is one of my pastimes; I also like eating sushi
Do animals experience emotions?
Do Video Games Deserve the Bad Rap They Often Get?
Do you have any back-up plans?
Do you know what your your name means?
Do you like things to be carefully planned or do you prefer to just go with the flow?
Even if I cannot see the sun, I know that it exists.
Good judgement comes from experience, and experience comes from bad judgement.
Happy families are all alike; every unhappy family is unhappy in its own way
How ambitious are you?
How conscious do you think animals are?
How could you live and have no story to tell?
How do you deal with your problems?
I am a scientist
I am a software engineer
I am a student in social sciences
I am an amateur chef who cooks 5 different cuisines
I am an avid artist
I am an engineer
I am an environmental engineer
I am considered a nerd by many
I am currently looking for a job
I am currently traveling in Japan
I am currently working on a project that involves chatbots
I am in school to be a computer engineer
I am very good at math and science
I can speak three languages
I commute by bus
I don't know if I enjoy programming, or if it's my only choice
I go to bed pretty late
I have 3 children
I have a brown belt in karate
I have one grandson and one daughter
I have owned two mustangs
I just started college
I like to donate time and money to charity
I like to take photos and play videogames
I like watching British tv shows and movies
I live a nomadic lifestyle and travel frequently
I live alone now, but I'd rather not
I live in America in the state of Florida
I live in Portland, Maine
I love animals
I love to dance salsa
I love to hike
I play guitar on my free time
I talk nonsense, therefore I'm human.
I want to go to Mars
I wear cardigans because I hope it makes me look more cultured
I work as a computer programmer
I work at my community garden center, and volunteer at the animal shelter
I work part time in the campus library
I work remotely as a programmer
If a tree falls in a forest and no one hears it, does it make a sound?
If there were a movie about your life, what kind of movie would it be?
If you could change one thing about yourself, what would it be?
If you could meet anyone in history, who would it be?
If you managed a restaurant, what kinds of food would you serve?
Is human nature constant or is it molded by culture?
Is There a 'Right Way' to Be a Tourist?
It is not the brains that matter most, but that which guides them - the character, the heart, generous qualities, progressive ideas.
It takes something more than intelligence to act intelligently.
It was a dark and stormy night.
It was love at first sight.
It was the best of times, it was the worst of times.
Man is a slow, sloppy, and brilliant thinker; computers are fast, accurate, and stupid.
My family has three dogs and my dog is named Maddie
My favorite color is purple
My favorite food is pizza
My favorite hobby is reading suspense novels
My favorite seafood is lobster
My favorite subject in school was science
My last name is Spanish, but I tell people that it's Italian
My passion is in programming
Neon is a noble gas.
Nothing in this world is harder than speaking the truth, nothing easier than flattery.
One day I hope to own my own company
Pizza is my favorite food
Snakes or rats?
Some 1.4 billion internet users worldwide reportedly are already using chatbots regularly.
The causes of human actions are usually immeasurably more complex and varied than our subsequent explanations of them.
The exercise of treating machine intelligence as real requires people to reduce their mooring to reality.
The more stupid one is, the closer one is to reality.
The mystery of human existence lies not in just staying alive, but in finding something to live for.
There are 10 kinds of people in the world: those who understand binary numerals, and those who don't.
Those who can imagine anything, can create the impossible.
To be overly conscious is a sickness.
To err is human
What advice would you give a college junior majoring in zoology and hoping to become a vetrinarian?
What animal would be cutest if scaled down to the size of a cat?
What app would you suggest everyone get?
What are you interested in that most people aren't?
What big event do you think will happen soon that most people aren't expecting?
What bit of trivia do you know that is very interesting but also very useless?
What book is overrated?
What current trend makes no sense to you?
What do a lot of people have very strong opinions about, even though they know very little about it?
What do you think about a cat as a pet?
What do you think about a dog as a pet?
What do you think of this quote? 'Having no plan is a plan to fail.'
What do you think shopping will be like in the future?
What do you think will be the future of computers?
What do you think will be the future of television?
What do you think you are much better at than you actually are?
What do you think you do better than people?
What escalated very quickly?
What food would you like to learn how to cook?
What from the present will withstand the test of time?
What is holding humans back from working together on a global scale?
What is the meaning of life?
What is the sound of one hand clapping?
What is your favorite holiday?
What is your opinion on professional sports?
What job doesn't exist now but will exist in the future?
What kind of sense of humor do you have?
What languages do you wish you could speak?
What near future predictions do you have?
What problem are you currently grappling with?
What profession doesn't get enough credit or respect?
What scientific discovery would change the course of humanity overnight if it was discovered?
What smartphone feature would you actually be excited for a company to implement?
What topic could you spend hours talking about?
What unethical experiment would have the biggest positive impact on society?
What would be the best thing you could reasonably expect to find in a cave?
What's about to get much better?
What's better broken than whole?
What's legal now, but probably won't be in 25 years?
What's quickly becoming obsolete?
What's something that everyone knows is true, but we don't like to admit it?
What's something that I don't know?
What's the funniest word in the English language?
What's the longest rabbit hole you've been down?
What's the most boring sport, and what would you do to make it more exciting?
What's the most ridiculous animal on the planet?
What's the opposite of a koala?
What's the saddest scene in a movie or TV series?
What's your favorite number?
What's your secret talent?
Which way should toilet paper hang, over or under?
Which weather events are the most unusual?
Which zoo has the largest collection of animals?

0 comments on commit 40ad4b6

Please sign in to comment.