Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added a Configuration Script #430

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ max_tokens = 4096
temperature = 0.0

# [llm] #AZURE OPENAI:
# api_type= 'azure'
# api_type = 'azure'
# model = "YOUR_MODEL_NAME" #"gpt-4o-mini"
# base_url = "{YOUR_AZURE_ENDPOINT.rstrip('/')}/openai/deployments/{AZURE_DEPOLYMENT_ID}"
# api_key = "AZURE API KEY"
# max_tokens = 8096
# temperature = 0.0
# api_version="AZURE API VERSION" #"2024-08-01-preview"
# api_version = "AZURE API VERSION" #"2024-08-01-preview"

# Optional configuration for specific LLM models
[llm.vision]
Expand Down
59 changes: 59 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""
OpenManus Configurator
"""

def main():
lines = ["[llm]"]

def get_or_default(prompt, default):
value = input(prompt + " (" + default + "): ").strip()
return value if value else default

print("__________________________________________________________")
print("OpenManus Configuration")
print("__________________________________________________________")
print("")
print("Please enter the following information to configure OpenManus")
print("")
print("")
lines.append(
f"api_type = \"{get_or_default('API Type, openai or azure', 'openai')}\""
)
# Azure needs a version too
if lines[-1] == "azure":
lines.append(
f"api_version = \"{get_or_default('API Version', '2024-08-01-preview')}\""
)
lines.append(f"model = \"{get_or_default('Model', 'claude-3-5-sonnet')}\"")
lines.append(
f"base_url = \"{get_or_default('Base URL', 'https://api.openai.com/v1')}\""
)
lines.append(f"api_key = \"{get_or_default('API Key',"sk-...")}\"")
lines.append(f"max_tokens = {get_or_default('Max Tokens', '4096')}")
lines.append(f"temperature = {get_or_default('Temperature', '0.0')}")

if input("Do you want to configure a vision model? Y/n (n)") == "Y":
lines.append("")
lines.append("[llm.vision]")
lines.append(
f"api_type = \"{get_or_default('API Type, openai or azure', 'openai')}\""
)
# Azure needs a version too
if lines[-1] == "azure":
lines.append(
f"api_version = \"{get_or_default('API Version', '2024-08-01-preview')}\""
)
lines.append(f"model = \"{get_or_default('Model', 'claude-3-5-sonnet')}\"")
lines.append(
f"base_url = \"{get_or_default('Base URL', 'https://api.openai.com/v1')}\""
)
lines.append(f"api_key = \"{get_or_default('API Key',"sk-...")}\"")
lines.append(f"max_tokens = {get_or_default('Max Tokens', '4096')}")
lines.append(f"temperature = {get_or_default('Temperature', '0.0')}")

with open("config/config.toml", "w", encoding="utf-8") as file:
file.writelines("\n".join(lines))


if __name__ == "__main__":
main()