From a16100f8cdc0c55810afe8939af0ce5932481b05 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 11 Sep 2025 17:50:27 +0200 Subject: [PATCH 01/10] test: Add CI test for fastembed --- .../disable_independent_workflows.sh | 1 + .github/workflows/test_fastembed.yml | 28 +++++++++++++++++++ .github/workflows/test_suites.yml | 9 ++++++ 3 files changed, 38 insertions(+) create mode 100644 .github/workflows/test_fastembed.yml diff --git a/.github/workflows/disable_independent_workflows.sh b/.github/workflows/disable_independent_workflows.sh index 693c3092d..9ec4a711e 100755 --- a/.github/workflows/disable_independent_workflows.sh +++ b/.github/workflows/disable_independent_workflows.sh @@ -11,6 +11,7 @@ WORKFLOWS=( "test_multimetric_qa_eval_run.yaml" "test_graphrag_vs_rag_notebook.yml" "test_gemini.yml" + "test_fastembed.yml" "test_multimedia_example.yaml" "test_deduplication.yml" "test_eval_framework.yml" diff --git a/.github/workflows/test_fastembed.yml b/.github/workflows/test_fastembed.yml new file mode 100644 index 000000000..5d37c1118 --- /dev/null +++ b/.github/workflows/test_fastembed.yml @@ -0,0 +1,28 @@ +name: test | fastembed + +on: + workflow_call: + +jobs: + test-gemini: + name: Run Fastembed Test + runs-on: ubuntu-22.04 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Cognee Setup + uses: ./.github/actions/cognee_setup + with: + python-version: '3.11.x' + + - name: Run Fastembed Simple Example + env: + LLM_PROVIDER: "openai" + LLM_API_KEY: ${{ secrets.LLM_API_KEY }} + LLM_MODEL: "gpt-4o-mini" + EMBEDDING_PROVIDER: "fastembed" + EMBEDDING_MODEL: "sentence-transformers/all-MiniLM-L6-v2" + EMBEDDING_DIMENSIONS: "384" + EMBEDDING_MAX_TOKENS: "256" + run: uv run python ./examples/python/simple_example.py diff --git a/.github/workflows/test_suites.yml b/.github/workflows/test_suites.yml index b6e84ac1e..06e3e10da 100644 --- a/.github/workflows/test_suites.yml +++ b/.github/workflows/test_suites.yml @@ -121,6 +121,12 @@ jobs: uses: ./.github/workflows/test_gemini.yml secrets: inherit + fastembed-tests: + name: Fastembed Tests + needs: [basic-tests, e2e-tests, cli-tests] + uses: ./.github/workflows/test_fastembed.yml + secrets: inherit + openrouter-tests: name: OpenRouter Tests needs: [basic-tests, e2e-tests, cli-tests] @@ -140,6 +146,7 @@ jobs: vector-db-tests, example-tests, gemini-tests, + fastembed-tests, openrouter-tests, mcp-test, relational-db-migration-tests, @@ -163,6 +170,7 @@ jobs: db-examples-tests, mcp-test, gemini-tests, + fastembed-tests, openrouter-tests, ollama-tests, relational-db-migration-tests, @@ -185,6 +193,7 @@ jobs: "${{ needs.db-examples-tests.result }}" == "success" && "${{ needs.relational-db-migration-tests.result }}" == "success" && "${{ needs.gemini-tests.result }}" == "success" && + "${{ needs.fastembed-tests.result }}" == "success" && "${{ needs.openrouter-tests.result }}" == "success" && "${{ needs.docker-compose-test.result }}" == "success" && "${{ needs.docker-ci-test.result }}" == "success" && From 70ee19616621a8ded2fec6fc2efb1fb6c1d0a849 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 11 Sep 2025 18:20:11 +0200 Subject: [PATCH 02/10] Change amount of tests called in test-suites.yml --- .github/workflows/test_fastembed.yml | 2 +- .github/workflows/test_llms.yml | 25 ++++++++++++++++++++++ .github/workflows/test_suites.yml | 32 ++++++---------------------- 3 files changed, 33 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/test_llms.yml diff --git a/.github/workflows/test_fastembed.yml b/.github/workflows/test_fastembed.yml index 5d37c1118..787a270d6 100644 --- a/.github/workflows/test_fastembed.yml +++ b/.github/workflows/test_fastembed.yml @@ -20,7 +20,7 @@ jobs: env: LLM_PROVIDER: "openai" LLM_API_KEY: ${{ secrets.LLM_API_KEY }} - LLM_MODEL: "gpt-4o-mini" + LLM_MODEL: ${{ secrets.LLM_MODEL }} EMBEDDING_PROVIDER: "fastembed" EMBEDDING_MODEL: "sentence-transformers/all-MiniLM-L6-v2" EMBEDDING_DIMENSIONS: "384" diff --git a/.github/workflows/test_llms.yml b/.github/workflows/test_llms.yml new file mode 100644 index 000000000..8d493f0e7 --- /dev/null +++ b/.github/workflows/test_llms.yml @@ -0,0 +1,25 @@ +name: LLM Test Suites + +on: + workflow_call: + workflow_dispatch: + +env: + RUNTIME__LOG_LEVEL: ERROR + ENV: 'dev' + +jobs: + gemini-tests: + name: Gemini Tests + uses: ./.github/workflows/test_gemini.yml + secrets: inherit + + fastembed-tests: + name: Fastembed Tests + uses: ./.github/workflows/test_fastembed.yml + secrets: inherit + + openrouter-tests: + name: OpenRouter Tests + uses: ./.github/workflows/test_openrouter.yml + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/test_suites.yml b/.github/workflows/test_suites.yml index 06e3e10da..f051a31b3 100644 --- a/.github/workflows/test_suites.yml +++ b/.github/workflows/test_suites.yml @@ -115,22 +115,10 @@ jobs: secrets: inherit # Additional LLM tests - gemini-tests: - name: Gemini Tests - needs: [basic-tests, e2e-tests, cli-tests] - uses: ./.github/workflows/test_gemini.yml - secrets: inherit - - fastembed-tests: - name: Fastembed Tests - needs: [basic-tests, e2e-tests, cli-tests] - uses: ./.github/workflows/test_fastembed.yml - secrets: inherit - - openrouter-tests: - name: OpenRouter Tests - needs: [basic-tests, e2e-tests, cli-tests] - uses: ./.github/workflows/test_openrouter.yml + llm-tests: + name: LLM Test Suite + needs: [ basic-tests, e2e-tests, cli-tests ] + uses: ./.github/workflows/test_llms.yml secrets: inherit # Ollama tests moved to the end @@ -145,9 +133,7 @@ jobs: different-operating-systems-tests, vector-db-tests, example-tests, - gemini-tests, - fastembed-tests, - openrouter-tests, + llm-tests, mcp-test, relational-db-migration-tests, docker-compose-test, @@ -169,9 +155,7 @@ jobs: example-tests, db-examples-tests, mcp-test, - gemini-tests, - fastembed-tests, - openrouter-tests, + llm-tests, ollama-tests, relational-db-migration-tests, docker-compose-test, @@ -192,9 +176,7 @@ jobs: "${{ needs.example-tests.result }}" == "success" && "${{ needs.db-examples-tests.result }}" == "success" && "${{ needs.relational-db-migration-tests.result }}" == "success" && - "${{ needs.gemini-tests.result }}" == "success" && - "${{ needs.fastembed-tests.result }}" == "success" && - "${{ needs.openrouter-tests.result }}" == "success" && + "${{ needs.llm-tests.result }}" == "success" && "${{ needs.docker-compose-test.result }}" == "success" && "${{ needs.docker-ci-test.result }}" == "success" && "${{ needs.ollama-tests.result }}" == "success" ]]; then From 300d358d4fb867457d03cbe9ef3839a8b49ddf61 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 11 Sep 2025 18:23:46 +0200 Subject: [PATCH 03/10] test name change --- .github/workflows/test_fastembed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_fastembed.yml b/.github/workflows/test_fastembed.yml index 787a270d6..6c85d11d4 100644 --- a/.github/workflows/test_fastembed.yml +++ b/.github/workflows/test_fastembed.yml @@ -4,7 +4,7 @@ on: workflow_call: jobs: - test-gemini: + test-fastembed: name: Run Fastembed Test runs-on: ubuntu-22.04 steps: From b0c56207027e2f0bd17635eebde855568ab6c791 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Fri, 12 Sep 2025 09:47:27 +0200 Subject: [PATCH 04/10] Change how llm tests are called in workflow. Delete unnecessary workflows. --- .../disable_independent_workflows.sh | 3 +- .github/workflows/test_fastembed.yml | 28 ------- .github/workflows/test_gemini.yml | 29 ------- .github/workflows/test_llms.yml | 82 ++++++++++++++++--- .github/workflows/test_openrouter.yml | 30 ------- 5 files changed, 70 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/test_fastembed.yml delete mode 100644 .github/workflows/test_gemini.yml delete mode 100644 .github/workflows/test_openrouter.yml diff --git a/.github/workflows/disable_independent_workflows.sh b/.github/workflows/disable_independent_workflows.sh index 9ec4a711e..ff57da80d 100755 --- a/.github/workflows/disable_independent_workflows.sh +++ b/.github/workflows/disable_independent_workflows.sh @@ -10,8 +10,7 @@ WORKFLOWS=( "test_kuzu.yml" "test_multimetric_qa_eval_run.yaml" "test_graphrag_vs_rag_notebook.yml" - "test_gemini.yml" - "test_fastembed.yml" + "test_llms.yml" "test_multimedia_example.yaml" "test_deduplication.yml" "test_eval_framework.yml" diff --git a/.github/workflows/test_fastembed.yml b/.github/workflows/test_fastembed.yml deleted file mode 100644 index 6c85d11d4..000000000 --- a/.github/workflows/test_fastembed.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: test | fastembed - -on: - workflow_call: - -jobs: - test-fastembed: - name: Run Fastembed Test - runs-on: ubuntu-22.04 - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Cognee Setup - uses: ./.github/actions/cognee_setup - with: - python-version: '3.11.x' - - - name: Run Fastembed Simple Example - env: - LLM_PROVIDER: "openai" - LLM_API_KEY: ${{ secrets.LLM_API_KEY }} - LLM_MODEL: ${{ secrets.LLM_MODEL }} - EMBEDDING_PROVIDER: "fastembed" - EMBEDDING_MODEL: "sentence-transformers/all-MiniLM-L6-v2" - EMBEDDING_DIMENSIONS: "384" - EMBEDDING_MAX_TOKENS: "256" - run: uv run python ./examples/python/simple_example.py diff --git a/.github/workflows/test_gemini.yml b/.github/workflows/test_gemini.yml deleted file mode 100644 index 544e15a5e..000000000 --- a/.github/workflows/test_gemini.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: test | gemini - -on: - workflow_call: - -jobs: - test-gemini: - name: Run Gemini Test - runs-on: ubuntu-22.04 - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Cognee Setup - uses: ./.github/actions/cognee_setup - with: - python-version: '3.11.x' - - - name: Run Gemini Simple Example - env: - LLM_PROVIDER: "gemini" - LLM_API_KEY: ${{ secrets.GEMINI_API_KEY }} - LLM_MODEL: "gemini/gemini-1.5-flash" - EMBEDDING_PROVIDER: "gemini" - EMBEDDING_API_KEY: ${{ secrets.GEMINI_API_KEY }} - EMBEDDING_MODEL: "gemini/text-embedding-004" - EMBEDDING_DIMENSIONS: "768" - EMBEDDING_MAX_TOKENS: "8076" - run: uv run python ./examples/python/simple_example.py diff --git a/.github/workflows/test_llms.yml b/.github/workflows/test_llms.yml index 8d493f0e7..b70b2e5ed 100644 --- a/.github/workflows/test_llms.yml +++ b/.github/workflows/test_llms.yml @@ -2,24 +2,80 @@ name: LLM Test Suites on: workflow_call: - workflow_dispatch: env: RUNTIME__LOG_LEVEL: ERROR ENV: 'dev' jobs: - gemini-tests: - name: Gemini Tests - uses: ./.github/workflows/test_gemini.yml - secrets: inherit + test-gemini: + name: Run Gemini Test + runs-on: ubuntu-22.04 + steps: + - name: Check out repository + uses: actions/checkout@v4 - fastembed-tests: - name: Fastembed Tests - uses: ./.github/workflows/test_fastembed.yml - secrets: inherit + - name: Cognee Setup + uses: ./.github/actions/cognee_setup + with: + python-version: '3.11.x' - openrouter-tests: - name: OpenRouter Tests - uses: ./.github/workflows/test_openrouter.yml - secrets: inherit \ No newline at end of file + - name: Run Gemini Simple Example + env: + LLM_PROVIDER: "gemini" + LLM_API_KEY: ${{ secrets.GEMINI_API_KEY }} + LLM_MODEL: "gemini/gemini-1.5-flash" + EMBEDDING_PROVIDER: "gemini" + EMBEDDING_API_KEY: ${{ secrets.GEMINI_API_KEY }} + EMBEDDING_MODEL: "gemini/text-embedding-004" + EMBEDDING_DIMENSIONS: "768" + EMBEDDING_MAX_TOKENS: "8076" + run: uv run python ./examples/python/simple_example.py + + test-fastembed: + name: Run Fastembed Test + runs-on: ubuntu-22.04 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Cognee Setup + uses: ./.github/actions/cognee_setup + with: + python-version: '3.11.x' + + - name: Run Fastembed Simple Example + env: + LLM_PROVIDER: "openai" + LLM_API_KEY: ${{ secrets.LLM_API_KEY }} + LLM_MODEL: ${{ secrets.LLM_MODEL }} + EMBEDDING_PROVIDER: "fastembed" + EMBEDDING_MODEL: "sentence-transformers/all-MiniLM-L6-v2" + EMBEDDING_DIMENSIONS: "384" + EMBEDDING_MAX_TOKENS: "256" + run: uv run python ./examples/python/simple_example.py + + test-openrouter: + name: Run OpenRouter Test + runs-on: ubuntu-22.04 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Cognee Setup + uses: ./.github/actions/cognee_setup + with: + python-version: '3.11.x' + + - name: Run OpenRouter Simple Example + env: + LLM_PROVIDER: "custom" + LLM_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} + LLM_MODEL: "openrouter/x-ai/grok-code-fast-1" + LLM_ENDPOINT: "https://openrouter.ai/api/v1" + EMBEDDING_PROVIDER: "openai" + EMBEDDING_API_KEY: ${{ secrets.OPENAI_API_KEY }} + EMBEDDING_MODEL: "openai/text-embedding-3-large" + EMBEDDING_DIMENSIONS: "3072" + EMBEDDING_MAX_TOKENS: "8191" + run: uv run python ./examples/python/simple_example.py \ No newline at end of file diff --git a/.github/workflows/test_openrouter.yml b/.github/workflows/test_openrouter.yml deleted file mode 100644 index 9c2dcdebe..000000000 --- a/.github/workflows/test_openrouter.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: test | openrouter - -on: - workflow_call: - -jobs: - test-openrouter: - name: Run OpenRouter Test - runs-on: ubuntu-22.04 - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Cognee Setup - uses: ./.github/actions/cognee_setup - with: - python-version: '3.11.x' - - - name: Run OpenRouter Simple Example - env: - LLM_PROVIDER: "custom" - LLM_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} - LLM_MODEL: "openrouter/x-ai/grok-code-fast-1" - LLM_ENDPOINT: "https://openrouter.ai/api/v1" - EMBEDDING_PROVIDER: "openai" - EMBEDDING_API_KEY: ${{ secrets.OPENAI_API_KEY }} - EMBEDDING_MODEL: "openai/text-embedding-3-large" - EMBEDDING_DIMENSIONS: "3072" - EMBEDDING_MAX_TOKENS: "8191" - run: uv run python ./examples/python/simple_example.py From 82afdef484bbfcc38cea50a326ab72bd3052db06 Mon Sep 17 00:00:00 2001 From: Igor Ilic <30923996+dexters1@users.noreply.github.com> Date: Fri, 12 Sep 2025 07:27:31 -0400 Subject: [PATCH 05/10] Potential fix for code scanning alert no. 227: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/test_llms.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_llms.yml b/.github/workflows/test_llms.yml index b70b2e5ed..77ee4e2e7 100644 --- a/.github/workflows/test_llms.yml +++ b/.github/workflows/test_llms.yml @@ -1,5 +1,8 @@ name: LLM Test Suites +permissions: + contents: read + on: workflow_call: From a20fe8ad3471e1bdd8bdccebb26afcb8005888b9 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Fri, 12 Sep 2025 15:15:06 +0200 Subject: [PATCH 06/10] fix Azure error in test --- .github/workflows/test_llms.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_llms.yml b/.github/workflows/test_llms.yml index 77ee4e2e7..5a0f947c9 100644 --- a/.github/workflows/test_llms.yml +++ b/.github/workflows/test_llms.yml @@ -52,6 +52,8 @@ jobs: LLM_PROVIDER: "openai" LLM_API_KEY: ${{ secrets.LLM_API_KEY }} LLM_MODEL: ${{ secrets.LLM_MODEL }} + LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }} + LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }} EMBEDDING_PROVIDER: "fastembed" EMBEDDING_MODEL: "sentence-transformers/all-MiniLM-L6-v2" EMBEDDING_DIMENSIONS: "384" From 8ec74c48e77d4a1a052b7802a2d657a78ffb16a1 Mon Sep 17 00:00:00 2001 From: vasilije Date: Tue, 16 Sep 2025 16:16:25 -0700 Subject: [PATCH 07/10] added auto tagging --- .github/ISSUE_TEMPLATE/documentation.yml | 1 + .github/core-team.txt | 12 ++++ .github/workflows/label-core-team.yml | 76 ++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 .github/core-team.txt create mode 100644 .github/workflows/label-core-team.yml diff --git a/.github/ISSUE_TEMPLATE/documentation.yml b/.github/ISSUE_TEMPLATE/documentation.yml index 417289f5b..b01459ac6 100644 --- a/.github/ISSUE_TEMPLATE/documentation.yml +++ b/.github/ISSUE_TEMPLATE/documentation.yml @@ -71,3 +71,4 @@ body: required: true - label: I have specified the location of the documentation issue required: true + diff --git a/.github/core-team.txt b/.github/core-team.txt new file mode 100644 index 000000000..2e69a268c --- /dev/null +++ b/.github/core-team.txt @@ -0,0 +1,12 @@ +# Core team GitHub logins (one per line). Lines may begin with @; case-insensitive. +borisarzentar +daukadolt +dexters1 +hajdul88 +hande-k +lxobr +pazone +siillee +vasilije1990 + + diff --git a/.github/workflows/label-core-team.yml b/.github/workflows/label-core-team.yml new file mode 100644 index 000000000..8e32923d1 --- /dev/null +++ b/.github/workflows/label-core-team.yml @@ -0,0 +1,76 @@ +name: Label PRs from core team + +on: + pull_request_target: + types: [opened, reopened, synchronize, ready_for_review, edited] + +permissions: + contents: read + issues: write + +jobs: + label-core-team: + if: ${{ !github.event.pull_request.draft }} + runs-on: ubuntu-latest + steps: + - name: Check out base repository + uses: actions/checkout@v4 + with: + repository: ${{ github.repository }} + ref: ${{ github.event.pull_request.base.ref }} + + - name: Determine if PR author is a core team member + id: check_core + shell: bash + run: | + AUTHOR="${{ github.event.pull_request.user.login }}" + LIST_FILE=".github/core-team.txt" + + if [ ! -f "$LIST_FILE" ]; then + echo "core=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + + # Normalize author to lowercase and strip leading '@' + AUTHOR_NORM="$(echo "$AUTHOR" | tr '[:upper:]' '[:lower:]' | sed 's/^@//')" + + # Compare against normalized list values (ignore comments/blank lines) + if awk -v author="$AUTHOR_NORM" ' + BEGIN { found=0 } + { + line=$0 + sub(/^[ \t]+|[ \t]+$/, "", line) + if (line ~ /^#/ || line == "") next + sub(/^@/, "", line) + line=tolower(line) + if (line == author) { found=1; exit } + } + END { exit(found ? 0 : 1) } + ' "$LIST_FILE"; then + echo "core=true" >> "$GITHUB_OUTPUT" + else + echo "core=false" >> "$GITHUB_OUTPUT" + fi + + - name: Add core-team label + if: steps.check_core.outputs.core == 'true' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const label = 'core-team'; + const { owner, repo } = context.repo; + const prNumber = context.payload.pull_request.number; + try { + await github.rest.issues.addLabels({ + owner, + repo, + issue_number: prNumber, + labels: [label], + }); + core.info(`Label '${label}' added to PR #${prNumber}`); + } catch (error) { + core.warning(`Failed to add label: ${error.message}`); + } + + From f14751bca7506652d4120c8c8f032ee3ef720629 Mon Sep 17 00:00:00 2001 From: Vasilije <8619304+Vasilije1990@users.noreply.github.com> Date: Fri, 19 Sep 2025 18:26:19 +0200 Subject: [PATCH 08/10] Clarify UI running instructions in README Updated instructions to include setting LLM_API_KEY before running the UI. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 41bd1d4ea..30f829c93 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ You can also cognify your files and query using cognee UI. ### Running the UI -Try cognee UI by running ``` cognee-cli -ui ``` command on your terminal. +Try cognee UI by setting LLM_API_KEY and running ``` cognee-cli -ui ``` command on your terminal. ## Understand our architecture From 766b300fbc69f2502b85cbd8587fc9e94788dae3 Mon Sep 17 00:00:00 2001 From: oryx1729 Date: Sat, 20 Sep 2025 16:35:51 -0700 Subject: [PATCH 09/10] fix: handle reasoning_effort parameter gracefully across models - Set litellm.drop_params=True to auto-drop unsupported parameters - Changed reasoning_effort from extra_body to direct parameter - Added reasoning_effort to both async and sync methods - Removed redundant retry logic for unsupported parameters - Ensures compatibility with models that don't support reasoning_effort This fixes errors when using models that don't support the reasoning_effort parameter while maintaining the optimization for models that do support it. --- .../litellm_instructor/llm/openai/adapter.py | 31 +++---------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py b/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py index 7e8d75d10..12dad5f55 100644 --- a/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py +++ b/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py @@ -29,6 +29,8 @@ observe = get_observe() logger = get_logger() +# litellm to drop unsupported params, e.g., reasoning_effort when not supported by the model. +litellm.drop_params = True class OpenAIAdapter(LLMInterface): """ @@ -132,39 +134,13 @@ class OpenAIAdapter(LLMInterface): api_version=self.api_version, response_model=response_model, max_retries=self.MAX_RETRIES, - extra_body={"reasoning_effort": "minimal"}, + reasoning_effort="minimal", ) except ( ContentFilterFinishReasonError, ContentPolicyViolationError, InstructorRetryException, ) as error: - if ( - isinstance(error, InstructorRetryException) - and "content management policy" not in str(error).lower() - ): - logger.debug( - "LLM Model does not support reasoning_effort parameter, trying call without the parameter." - ) - return await self.aclient.chat.completions.create( - model=self.model, - messages=[ - { - "role": "user", - "content": f"""{text_input}""", - }, - { - "role": "system", - "content": system_prompt, - }, - ], - api_key=self.api_key, - api_base=self.endpoint, - api_version=self.api_version, - response_model=response_model, - max_retries=self.MAX_RETRIES, - ) - if not (self.fallback_model and self.fallback_api_key): raise ContentPolicyFilterError( f"The provided input contains content that is not aligned with our content policy: {text_input}" @@ -246,6 +222,7 @@ class OpenAIAdapter(LLMInterface): api_base=self.endpoint, api_version=self.api_version, response_model=response_model, + reasoning_effort="minimal", max_retries=self.MAX_RETRIES, ) From 1f63b6db553296d7d6ac39e28c57b8097b6bc54a Mon Sep 17 00:00:00 2001 From: oryx1729 Date: Sat, 20 Sep 2025 17:02:31 -0700 Subject: [PATCH 10/10] Make ruff happy --- .../litellm_instructor/llm/openai/adapter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py b/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py index 12dad5f55..b534a49f4 100644 --- a/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py +++ b/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py @@ -32,6 +32,7 @@ logger = get_logger() # litellm to drop unsupported params, e.g., reasoning_effort when not supported by the model. litellm.drop_params = True + class OpenAIAdapter(LLMInterface): """ Adapter for OpenAI's GPT-3, GPT-4 API. @@ -140,7 +141,7 @@ class OpenAIAdapter(LLMInterface): ContentFilterFinishReasonError, ContentPolicyViolationError, InstructorRetryException, - ) as error: + ): if not (self.fallback_model and self.fallback_api_key): raise ContentPolicyFilterError( f"The provided input contains content that is not aligned with our content policy: {text_input}"