From d56fd8d92513cbeef33568388df5702d0d670d91 Mon Sep 17 00:00:00 2001 From: Igor Ilic <30923996+dexters1@users.noreply.github.com> Date: Wed, 5 Feb 2025 22:20:07 +0100 Subject: [PATCH] chore: Change Code graph gh action to use OpenAI API (#499) ## Description ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin ## Summary by CodeRabbit - **Chores** - Updated the CI configuration for integration tests to use revised secret values, ensuring improved alignment with current external API credential requirements and deprecating legacy references. - Made several secrets optional in the workflow, enhancing flexibility during execution. - Removed several outdated secrets from multiple workflows, streamlining the configuration. - Improved error handling in the code processing logic by adding exception management for `AttributeError` and `AssertionError`. --- .github/workflows/reusable_python_example.yml | 23 +------------------ .github/workflows/test_code_graph_example.yml | 10 ++------ .../workflows/test_multimedia_example.yaml | 8 +------ .../repo_processor/get_local_dependencies.py | 6 +++++ 4 files changed, 10 insertions(+), 37 deletions(-) diff --git a/.github/workflows/reusable_python_example.yml b/.github/workflows/reusable_python_example.yml index 0897e639d..1e7a6d0cc 100644 --- a/.github/workflows/reusable_python_example.yml +++ b/.github/workflows/reusable_python_example.yml @@ -16,24 +16,10 @@ on: required: true GRAPHISTRY_PASSWORD: required: true - LLM_MODEL: - required: true - LLM_ENDPOINT: - required: true LLM_API_KEY: required: true OPENAI_API_KEY: required: false - LLM_API_VERSION: - required: true - EMBEDDING_MODEL: - required: true - EMBEDDING_ENDPOINT: - required: true - EMBEDDING_API_KEY: - required: true - EMBEDDING_API_VERSION: - required: true env: RUNTIME__LOG_LEVEL: ERROR @@ -70,15 +56,8 @@ jobs: env: ENV: 'dev' PYTHONFAULTHANDLER: 1 - LLM_MODEL: ${{ secrets.LLM_MODEL }} - LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }} - LLM_API_KEY: ${{ secrets.LLM_API_KEY }} - LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }} + LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }} - EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }} - EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} - EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }} GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }} run: poetry run python ${{ inputs.example-location }} ${{ inputs.arguments }} diff --git a/.github/workflows/test_code_graph_example.yml b/.github/workflows/test_code_graph_example.yml index 1200b5b11..47c36c467 100644 --- a/.github/workflows/test_code_graph_example.yml +++ b/.github/workflows/test_code_graph_example.yml @@ -17,13 +17,7 @@ jobs: example-location: ./examples/python/code_graph_example.py arguments: "--repo_path ./evals" secrets: - LLM_MODEL: ${{ secrets.LLM_MODEL }} - LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }} - LLM_API_KEY: ${{ secrets.LLM_API_KEY }} - LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }} - EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }} - EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }} - EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} - EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }} GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }} diff --git a/.github/workflows/test_multimedia_example.yaml b/.github/workflows/test_multimedia_example.yaml index c307002a8..3d06959de 100644 --- a/.github/workflows/test_multimedia_example.yaml +++ b/.github/workflows/test_multimedia_example.yaml @@ -16,13 +16,7 @@ jobs: with: example-location: ./examples/python/multimedia_example.py secrets: - #LLM_MODEL: ${{ secrets.LLM_MODEL }} - #LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }} LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} # Use OpenAI until we deploy models to handle multimedia - #LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }} - EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }} - EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }} - EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} - EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }} GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }} diff --git a/cognee/tasks/repo_processor/get_local_dependencies.py b/cognee/tasks/repo_processor/get_local_dependencies.py index 46756ba40..600ff25a5 100644 --- a/cognee/tasks/repo_processor/get_local_dependencies.py +++ b/cognee/tasks/repo_processor/get_local_dependencies.py @@ -73,6 +73,12 @@ def _update_code_entity(script: jedi.Script, code_entity: Dict[str, any]) -> Non # TODO: See if there is a way to handle EOFError properly logger.error(f"Failed to analyze code entity {code_entity['name']}: {e}") return + except AttributeError as e: + # TODO: See if there is a way to handle AttributeError properly + logger.error(f"Failed to analyze code entity {code_entity['name']}: {e}") + except AssertionError as e: + # TODO: See if there is a way to handle AttributeError properly + logger.error(f"Failed to analyze code entity {code_entity['name']}: {e}") except Exception as e: # logging.warning(f"Failed to analyze code entity {code_entity['name']}: {e}") logger.error(f"Failed to analyze code entity {code_entity['name']}: {e}")