|
| 1 | +# Copyright (C) 2024 Robotec.AI |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +import argparse |
| 16 | +import os |
| 17 | + |
| 18 | +import tomli |
| 19 | +import tomli_w |
| 20 | + |
| 21 | +CONFIG_CONTENT = """ |
| 22 | +[vendor] |
| 23 | +simple_model = "openai" |
| 24 | +complex_model = "openai" |
| 25 | +embeddings_model = "openai" |
| 26 | +
|
| 27 | +[aws] |
| 28 | +simple_model = "anthropic.claude-3-haiku-20240307-v1:0" |
| 29 | +complex_model = "anthropic.claude-3-5-sonnet-20240620-v1:0" |
| 30 | +embeddings_model = "amazon.titan-embed-text-v1" |
| 31 | +region_name = "us-east-1" |
| 32 | +
|
| 33 | +[openai] |
| 34 | +simple_model = "gpt-4o-mini" |
| 35 | +complex_model = "gpt-4o" |
| 36 | +embeddings_model = "text-embedding-ada-002" |
| 37 | +base_url = "https://api.openai.com/v1/" |
| 38 | +
|
| 39 | +[ollama] |
| 40 | +simple_model = "llama3.2" |
| 41 | +complex_model = "llama3.1:70b" |
| 42 | +embeddings_model = "llama3.2" |
| 43 | +base_url = "http://localhost:11434" |
| 44 | +
|
| 45 | +[tracing] |
| 46 | +project = "rai" |
| 47 | +
|
| 48 | +[tracing.langfuse] |
| 49 | +use_langfuse = false |
| 50 | +host = "http://localhost:3000" |
| 51 | +
|
| 52 | +[tracing.langsmith] |
| 53 | +use_langsmith = false |
| 54 | +host = "https://api.smith.langchain.com" |
| 55 | +
|
| 56 | +[asr] |
| 57 | +recording_device_name = "default" |
| 58 | +transcription_model = "LocalWhisper" |
| 59 | +language = "en" |
| 60 | +vad_model = "SileroVAD" |
| 61 | +silence_grace_period = 0.3 |
| 62 | +vad_threshold = 0.3 |
| 63 | +use_wake_word = false |
| 64 | +wake_word_model = "" |
| 65 | +wake_word_threshold = 0.5 |
| 66 | +wake_word_model_name = "" |
| 67 | +transcription_model_name = "tiny" |
| 68 | +
|
| 69 | +[tts] |
| 70 | +vendor = "ElevenLabs" |
| 71 | +voice = "" |
| 72 | +speaker_device_name = "default" |
| 73 | +""" |
| 74 | + |
| 75 | + |
| 76 | +def main(): |
| 77 | + parser = argparse.ArgumentParser() |
| 78 | + parser.add_argument("--force", action="store_true") |
| 79 | + args = parser.parse_args() |
| 80 | + |
| 81 | + try: |
| 82 | + if args.force and os.path.exists("config.toml"): |
| 83 | + os.remove("config.toml") |
| 84 | + if os.path.exists("config.toml") and not args.force: |
| 85 | + print( |
| 86 | + "config.toml already exists. Use --force to overwrite with default values." |
| 87 | + ) |
| 88 | + return |
| 89 | + |
| 90 | + config_dict = tomli.loads(CONFIG_CONTENT) |
| 91 | + |
| 92 | + with open("config.toml", "wb") as f: |
| 93 | + tomli_w.dump(config_dict, f) |
| 94 | + |
| 95 | + except (OSError, IOError) as e: |
| 96 | + print(f"Error writing config file: {e}") |
| 97 | + return |
| 98 | + except Exception as e: |
| 99 | + print(f"Unexpected error: {e}") |
| 100 | + return |
| 101 | + print("config.toml created successfully.") |
| 102 | + |
| 103 | + |
| 104 | +if __name__ == "__main__": |
| 105 | + main() |
0 commit comments