From f08698fc3a3470f65bc00df4f791512d0af55748 Mon Sep 17 00:00:00 2001 From: Kye Date: Tue, 5 Dec 2023 12:12:32 -0800 Subject: [PATCH] [FIX][Zephyr] --- .env.example | 3 ++ swarms/models/__init__.py | 4 +-- tests/upload_tests_to_issues | 58 ++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 tests/upload_tests_to_issues diff --git a/.env.example b/.env.example index bebc8fa3..23f4d87b 100644 --- a/.env.example +++ b/.env.example @@ -42,3 +42,6 @@ PINECONE_API_KEY="" BING_COOKIE="" PSG_CONNECTION_STRING="" +GITHUB_USERNAME="" +GITHUB_REPO_NAME="" +GITHUB_TOKEN="" \ No newline at end of file diff --git a/swarms/models/__init__.py b/swarms/models/__init__.py index d2256aa8..089585a8 100644 --- a/swarms/models/__init__.py +++ b/swarms/models/__init__.py @@ -8,7 +8,7 @@ from swarms.models.openai_models import ( AzureOpenAI, OpenAIChat, ) # noqa: E402 -from swarms.models.zephyr import Zephyr # noqa: E402 +# from swarms.models.zephyr import Zephyr # noqa: E402 from swarms.models.biogpt import BioGPT # noqa: E402 from swarms.models.huggingface import HuggingfaceLLM # noqa: E402 from swarms.models.wizard_storytelling import ( @@ -42,7 +42,7 @@ __all__ = [ "OpenAI", "AzureOpenAI", "OpenAIChat", - "Zephyr", + # "Zephyr", "BaseMultiModalModel", "Idefics", # "Kosmos", diff --git a/tests/upload_tests_to_issues b/tests/upload_tests_to_issues new file mode 100644 index 00000000..cc2392e3 --- /dev/null +++ b/tests/upload_tests_to_issues @@ -0,0 +1,58 @@ +import os +import subprocess +import json +import re +import requests +from dotenv import load_dotenv + +load_dotenv + +# Constants +GITHUB_USERNAME = os.getenv('GITHUB_USERNAME') +REPO_NAME = os.getenv('GITHUB_REPO_NAME') +GITHUB_TOKEN = os.getenv('GITHUB_TOKEN') +ISSUES_URL = f'https://api.github.com/repos/{GITHUB_USERNAME}/{REPO_NAME}/issues' + +# Headers for authentication +headers = { + 'Authorization': f'token {GITHUB_TOKEN}', + 'Accept': 'application/vnd.github.v3+json' +} + +def run_pytest(): + result = subprocess.run(['pytest'], capture_output=True, text=True) + return result.stdout + result.stderr + +def parse_pytest_output(output): + errors = [] + current_error = None + + for line in output.split('\n'): + if line.startswith('_________________________'): + if current_error: + errors.append(current_error) + current_error = {'title': '', 'body': ''} + elif current_error is not None: + if not current_error['title']: + current_error['title'] = line.strip() + current_error['body'] += line + '\n' + + if current_error: + errors.append(current_error) + return errors + +def create_github_issue(title, body): + issue = {'title': title, 'body': body} + response = requests.post(ISSUES_URL, headers=headers, json=issue) + return response.json() + +def main(): + pytest_output = run_pytest() + errors = parse_pytest_output(pytest_output) + + for error in errors: + issue_response = create_github_issue(error['title'], error['body']) + print(f"Issue created: {issue_response.get('html_url')}") + +if __name__ == '__main__': + main()