diff --git a/playground/demos/llm_with_conversation/main.py b/playground/demos/llm_with_conversation/main.py new file mode 100644 index 00000000..2bb28b4b --- /dev/null +++ b/playground/demos/llm_with_conversation/main.py @@ -0,0 +1,21 @@ +import os + +from dotenv import load_dotenv + +# Import the OpenAIChat model and the Agent struct +from swarms.models import OpenAIChat +from swarms.structs import Agent + +# Load the environment variables +load_dotenv() + +# Get the API key from the environment +api_key = os.environ.get("OPENAI_API_KEY") + +# Initialize the language model +llm = OpenAIChat( + temperature=0.5, + model_name="gpt-4", + openai_api_key=api_key, + max_tokens=1000, +) diff --git a/playground/demos/personal_assistant/better_communication.py b/playground/demos/personal_assistant/better_communication.py index 420e2875..c6e79eb7 100644 --- a/playground/demos/personal_assistant/better_communication.py +++ b/playground/demos/personal_assistant/better_communication.py @@ -56,6 +56,7 @@ def play_audio(file_path): # Stop the mixer module and free resources pygame.mixer.quit() + while True: # Listen for user speech with sr.Microphone() as source: @@ -74,7 +75,6 @@ while True: print(f"Error: {e}") continue - # Run the Gemini model on the task print("Running GPT4 model...") out = llm(task) @@ -90,7 +90,7 @@ while True: # if play_audio.lower() == "yes": # Initialize the mixer module # Play the audio file - + time.sleep(5) - - playsound('runs/tts_speech.wav') \ No newline at end of file + + playsound("runs/tts_speech.wav") diff --git a/pyproject.toml b/pyproject.toml index b73f80a5..76150dde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "2.3.8" +version = "2.4.0" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] @@ -94,4 +94,4 @@ preview = true [tool.poetry.scripts] -swarms = 'swarms.cli._cli:run_file' \ No newline at end of file +swarms = 'swarms.cli._cli:cli' \ No newline at end of file diff --git a/swarms/cli/_cli.py b/swarms/cli/_cli.py index b4be4e02..8dee387f 100644 --- a/swarms/cli/_cli.py +++ b/swarms/cli/_cli.py @@ -2,7 +2,7 @@ import argparse import sys -def run_file(): +def cli(): parser = argparse.ArgumentParser(description="Swarms CLI") parser.add_argument( "file_name", help="Python file containing Swarms code to run" diff --git a/swarms/cli/run_file.py b/swarms/cli/run_file.py index de035b1e..171c6c56 100644 --- a/swarms/cli/run_file.py +++ b/swarms/cli/run_file.py @@ -2,7 +2,7 @@ import sys import subprocess -def run_file(): +def run_file(filename: str): """Run a given file. Usage: swarms run file_name.py