pull/334/head
Kye 1 year ago
parent fd58cfa2a1
commit 739125d766

@ -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,
)

@ -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')
playsound("runs/tts_speech.wav")

@ -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>"]
@ -94,4 +94,4 @@ preview = true
[tool.poetry.scripts]
swarms = 'swarms.cli._cli:run_file'
swarms = 'swarms.cli._cli:cli'

@ -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"

@ -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

Loading…
Cancel
Save