From e7ed7bf2ab32a6cdf97d4a3dfb3371e48b089393 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Fri, 17 Nov 2023 16:47:09 -0700 Subject: [PATCH 1/8] fix 152 delete qualityyml --- .github/workflows/quality.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/quality.yml diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml deleted file mode 100644 index 9b09cfa9..00000000 --- a/.github/workflows/quality.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Quality - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - lint: - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - name: Checkout actions - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Init environment - uses: ./.github/actions/init-environment - - name: Run linter - run: | - pylint `git diff --name-only --diff-filter=d origin/master HEAD | grep -E '\.py$' | tr '\n' ' '` \ No newline at end of file From fea80917253aa238e81d9085c331d02fdc035ec5 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Sat, 18 Nov 2023 12:49:09 -0700 Subject: [PATCH 2/8] codacy 156 --- .github/workflows/codeql.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a2d42089..0c32bfce 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -19,6 +19,11 @@ on: branches: [ "master" ] schedule: - cron: '33 12 * * 5' + paths-ignore: + - '**/*.md' + - '**/*.txt' + - 'tests/tools/base.py' + jobs: analyze: From 13fefb9926641021c476d87f9b41b73411efef27 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Sat, 18 Nov 2023 12:57:21 -0700 Subject: [PATCH 3/8] 156 codacy --- .github/workflows/codeql.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0c32bfce..4ad12e49 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -17,13 +17,14 @@ on: pull_request: # The branches below must be a subset of the branches above branches: [ "master" ] - schedule: - - cron: '33 12 * * 5' paths-ignore: - '**/*.md' - '**/*.txt' - 'tests/tools/base.py' + schedule: + - cron: '33 12 * * 5' + jobs: analyze: From 0d00697595f97afa54afe9c30c42a116e3d7846a Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Sat, 18 Nov 2023 14:19:01 -0700 Subject: [PATCH 4/8] 157 possible fix --- swarms/models/layoutlm_document_qa.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/swarms/models/layoutlm_document_qa.py b/swarms/models/layoutlm_document_qa.py index 1688a231..6550518b 100644 --- a/swarms/models/layoutlm_document_qa.py +++ b/swarms/models/layoutlm_document_qa.py @@ -5,7 +5,7 @@ visual question answering on real world docs lik invoice, pdfs, etc from transformers import pipeline -class LayoutLMDocumentQA: +class """ LayoutLMDocumentQA for document question answering: @@ -24,7 +24,6 @@ class LayoutLMDocumentQA: def __init__( self, model_name: str = "impira/layoutlm-document-qa", - task_type: str = "document-question-answering", ): self.model_name = model_name self.task_type = task_type From f587e58d304ba88a98d27b48fc93ed1e8c32e1b9 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Sat, 18 Nov 2023 19:41:42 -0700 Subject: [PATCH 5/8] 159 fix examples to use env keys --- README.md | 8 ++++++++ example.py | 4 ++++ sequential_workflow_example.py | 11 +++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3626c2dd..d41d78c3 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,14 @@ Book a [1-on-1 Session with Kye](https://calendly.com/swarm-corp/30min), the Cre ## Usage We have a small gallery of examples to run here, [for more check out the docs to build your own agent and or swarms!](https://docs.apac.ai) +All of the examples assume you have set your API keys in the environment: + +```bash +export OPENAI_API_KEY='yourapikey' +export ANTHROPIC_API_KEY='yourotherapikey' +``` + + ### Example in Colab: diff --git a/example.py b/example.py index 46e8b33c..aca8c61f 100644 --- a/example.py +++ b/example.py @@ -1,5 +1,9 @@ from swarms.models import OpenAIChat from swarms.structs import Flow +import os + +openai_api_key = os.environ.get("OPENAI_API_KEY") +anthropic_api_key = os.environ.get("ANTHROPIC_API_KEY") # Initialize the language model, this model can be swapped out with Anthropic, ETC, Huggingface Models like Mistral, ETC llm = OpenAIChat( diff --git a/sequential_workflow_example.py b/sequential_workflow_example.py index 9c17a072..5f2fe5db 100644 --- a/sequential_workflow_example.py +++ b/sequential_workflow_example.py @@ -1,16 +1,15 @@ from swarms.models import OpenAIChat, BioGPT, Anthropic from swarms.structs import Flow from swarms.structs.sequential_workflow import SequentialWorkflow - +import os # Example usage -api_key = ( - "" # Your actual API key here -) +openai_api_key = os.environ.get("OPENAI_API_KEY") +anthropic_api_key = os.environ.get("ANTHROPIC_API_KEY") # Initialize the language flow llm = OpenAIChat( - openai_api_key=api_key, + openai_api_key=openai_api_key, temperature=0.5, max_tokens=3000, ) @@ -18,7 +17,7 @@ llm = OpenAIChat( biochat = BioGPT() # Use Anthropic -anthropic = Anthropic() +anthropic = Anthropic(anthropic_api_key=anthropic_api_key) # Initialize the agent with the language flow agent1 = Flow(llm=llm, max_loops=1, dashboard=False) From 67a61f059539af30d419a542e9175d217d3fba52 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Sun, 19 Nov 2023 17:45:16 -0700 Subject: [PATCH 6/8] remove anthropic --- example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.py b/example.py index aca8c61f..e399821d 100644 --- a/example.py +++ b/example.py @@ -3,7 +3,7 @@ from swarms.structs import Flow import os openai_api_key = os.environ.get("OPENAI_API_KEY") -anthropic_api_key = os.environ.get("ANTHROPIC_API_KEY") + # Initialize the language model, this model can be swapped out with Anthropic, ETC, Huggingface Models like Mistral, ETC llm = OpenAIChat( From ce4183a3c5541fb2d249cdbd3a654d1f9ba2fdfe Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Mon, 20 Nov 2023 07:27:40 -0700 Subject: [PATCH 7/8] fix review comments --- example.py | 1 - swarms/models/layoutlm_document_qa.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/example.py b/example.py index e399821d..9607d819 100644 --- a/example.py +++ b/example.py @@ -1,4 +1,3 @@ -from swarms.models import OpenAIChat from swarms.structs import Flow import os diff --git a/swarms/models/layoutlm_document_qa.py b/swarms/models/layoutlm_document_qa.py index 6550518b..cdacd245 100644 --- a/swarms/models/layoutlm_document_qa.py +++ b/swarms/models/layoutlm_document_qa.py @@ -2,8 +2,6 @@ LayoutLMDocumentQA is a multimodal good for visual question answering on real world docs lik invoice, pdfs, etc """ -from transformers import pipeline - class """ From 50d5d7ca348704ce8612a2d174fb5711ca919bf6 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Mon, 20 Nov 2023 07:29:56 -0700 Subject: [PATCH 8/8] typo correction --- swarms/models/layoutlm_document_qa.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swarms/models/layoutlm_document_qa.py b/swarms/models/layoutlm_document_qa.py index cdacd245..dc7ec4e7 100644 --- a/swarms/models/layoutlm_document_qa.py +++ b/swarms/models/layoutlm_document_qa.py @@ -3,7 +3,8 @@ LayoutLMDocumentQA is a multimodal good for visual question answering on real world docs lik invoice, pdfs, etc """ -class + +class LayoutLMDocumentQA: """ LayoutLMDocumentQA for document question answering: