Skip to content

Commit

Permalink
[CLEANUP]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye committed Dec 24, 2023
1 parent fd58cfa commit 739125d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
21 changes: 21 additions & 0 deletions playground/demos/llm_with_conversation/main.py
Original file line number Diff line number Diff line change
@@ -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,
)
8 changes: 4 additions & 4 deletions playground/demos/personal_assistant/better_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -74,7 +75,6 @@ def play_audio(file_path):
print(f"Error: {e}")
continue


# Run the Gemini model on the task
print("Running GPT4 model...")
out = llm(task)
Expand All @@ -90,7 +90,7 @@ def play_audio(file_path):
# if play_audio.lower() == "yes":
# Initialize the mixer module
# Play the audio file

time.sleep(5)
playsound('runs/tts_speech.wav')

playsound("runs/tts_speech.wav")
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <kye@apac.ai>"]
Expand Down Expand Up @@ -94,4 +94,4 @@ preview = true


[tool.poetry.scripts]
swarms = 'swarms.cli._cli:run_file'
swarms = 'swarms.cli._cli:cli'
2 changes: 1 addition & 1 deletion swarms/cli/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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"
Expand Down
2 changes: 1 addition & 1 deletion swarms/cli/run_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import subprocess


def run_file():
def run_file(filename: str):
"""Run a given file.
Usage: swarms run file_name.py
Expand Down

0 comments on commit 739125d

Please sign in to comment.