Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): Fix credentials cost filter not able to filter the block cost #8837

Merged
merged 5 commits into from
Nov 29, 2024

Conversation

majdyz
Copy link
Contributor

@majdyz majdyz commented Nov 28, 2024

We've started enabling cost based on the partial value of the credentials field. And this logic has never been supported.

Changes 🏗️

  • Add partial object matching on the input data filter for evaluating the block cost.
  • Add missing credentials for ExtractWebsiteContentBlock
  • Removed fallback cost on LLM blocks.

Checklist 📋

For code changes:

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • ...
Example test plan
  • Create from scratch and execute an agent with at least 3 blocks
  • Import an agent from file upload, and confirm it executes correctly
  • Upload agent to marketplace
  • Import an agent from marketplace and confirm it executes correctly
  • Edit an agent from monitor, and confirm it executes correctly

For configuration changes:

  • .env.example is updated or already compatible with my changes
  • docker-compose.yml is updated or already compatible with my changes
  • I have included a list of my configuration changes in the PR description (under Changes)
Examples of configuration changes
  • Changing ports
  • Adding new services that need to communicate with each other
  • Secrets or environment variable changes
  • New or infrastructure changes such as databases

@majdyz majdyz requested a review from a team as a code owner November 28, 2024 15:08
@github-actions github-actions bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end labels Nov 28, 2024
Copy link

netlify bot commented Nov 28, 2024

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
🔨 Latest commit 53a67d3
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs-dev/deploys/67491c62dac14100081eb5cf

Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Logic Bug
The recursive _is_filter_match function may not handle all edge cases properly, especially for deeply nested objects or arrays. The function should validate input types and handle potential null/undefined values more carefully.

Code Duplication
The isFilterMatch function in the frontend duplicates the same logic as the backend's _is_filter_match. Consider extracting this into a shared utility function to maintain consistency.

Code Organization
The cost configuration is becoming complex with multiple provider-specific sections. Consider refactoring to organize costs by provider in separate configuration files or objects.

Copy link

netlify bot commented Nov 28, 2024

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 53a67d3
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/67491c62a3b7860008fd7246

Pwuts
Pwuts previously approved these changes Nov 28, 2024
@majdyz majdyz requested a review from Pwuts November 29, 2024 01:46
@majdyz majdyz added this pull request to the merge queue Nov 29, 2024
Merged via the queue into dev with commit eeb5b4a Nov 29, 2024
21 checks passed
@majdyz majdyz deleted the zamilmajdy/fix-credentials-cost-filter branch November 29, 2024 08:59
aarushik93 pushed a commit that referenced this pull request Dec 1, 2024
…ock cost (#8837)

We've started enabling cost based on the *partial value* of the
`credentials` field. And this logic has never been supported.

### Changes 🏗️

* Add partial object matching on the input data filter for evaluating
the block cost.
* Add missing credentials for `ExtractWebsiteContentBlock`
* Removed fallback cost on LLM blocks.

### Checklist 📋

#### For code changes:
- [ ] I have clearly listed my changes in the PR description
- [ ] I have made a test plan
- [ ] I have tested my changes according to the test plan:
  <!-- Put your test plan here: -->
  - [ ] ...

<details>
  <summary>Example test plan</summary>
  
  - [ ] Create from scratch and execute an agent with at least 3 blocks
- [ ] Import an agent from file upload, and confirm it executes
correctly
  - [ ] Upload agent to marketplace
- [ ] Import an agent from marketplace and confirm it executes correctly
  - [ ] Edit an agent from monitor, and confirm it executes correctly
</details>

#### For configuration changes:
- [ ] `.env.example` is updated or already compatible with my changes
- [ ] `docker-compose.yml` is updated or already compatible with my
changes
- [ ] I have included a list of my configuration changes in the PR
description (under **Changes**)

<details>
  <summary>Examples of configuration changes</summary>

  - Changing ports
  - Adding new services that need to communicate with each other
  - Secrets or environment variable changes
  - New or infrastructure changes such as databases
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/backend AutoGPT Platform - Back end platform/blocks platform/frontend AutoGPT Platform - Front end size/l
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants