Skip to content

Conversation

@NicolasGirardot
Copy link
Member

@NicolasGirardot NicolasGirardot commented Jan 5, 2026

Checklist

  • I have read the Contributor Guide
  • I have read and agree to the Code of Conduct
  • I have added a description of my changes and why I'd like them included in the section below

Description of Changes

Describe your changes here

Related Issues

List related issues here

Summary by Bito

  • Introduces the first implementation of the Edgee Python SDK with a new core module featuring robust API request handling, streaming API responses, and improved error management.
  • Refactors streaming functionality by removing the deprecated stream_text method and adding a unified send method for streaming responses in the core module (__init__.py).
  • Adds convenience getters and comprehensive unit tests to validate functionalities including API key handling, custom base URL configurations, and multiple response scenarios.
  • Enhances project configuration files with updated dependencies and added linting rules, while revising the uv.lock file with latest package changes for multiple platforms.
  • Overhauls test files by removing outdated coding patterns and ensuring consistency, while updating example files and test scripts in example/test.py to align with the new API.
  • Overall summary: Introduces and refactors the Edgee Python SDK with significant updates across core functionalities including new streaming methods, unified send method, dependencies, testing scripts, and project configurations, modernizing API handling and streamlining dependency resolution.

@bito-code-review
Copy link

bito-code-review bot commented Jan 6, 2026

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
New Feature - Core SDK Implementation

__init__.py - Introduced Edgee Python SDK implementation with core API handling, streaming support, and robust error management.

Other Improvements - Project & Codeowners Updates

CODEOWNERS - Added code ownership for the edgeers team.

pyproject.toml - Updated project configuration with new dependencies, linting rules, and build system settings.

uv.lock - Updated lock file with refreshed dependency versions and platform-specific package details.

Documentation - Example Usage Documentation

test.py - Added an example script to demonstrate how to use the Edgee SDK.

Testing - Comprehensive Unit Tests

test_edgee.py - Added extensive tests to validate core SDK functionalities, API key handling, and configuration options.

Copy link

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #8e8543

Actionable Suggestions - 2
  • edgee/__init__.py - 2
Additional Suggestions - 3
  • example/test.py - 2
    • Unsafe dict access · Line 19-19
      In test 1, using ['content'] could raise KeyError if the API response has no content (e.g., when tool_calls are present instead). It looks like this should use .get('content') for consistency with test 3 and to avoid crashes on edge cases.
      Code suggestion
       @@ -19,1 +19,1 @@
      -    print(f"Content: {response1.choices[0].message['content']}")
      +    print(f"Content: {response1.choices[0].message.get('content')}")
    • Unsafe dict access · Line 34-34
      Similar to test 1, using ['content'] here risks KeyError if content is absent. Switching to .get('content') matches test 3's safer approach.
  • tests/test_edgee.py - 1
    • Misleading test name · Line 111-112
      The test method name 'test_send_with_input_object' is misleading since it uses a dictionary input, not an InputObject instance, which could confuse maintainers about what is being tested.
      Code suggestion
       @@ -111,2 +111,2 @@
      -    def test_send_with_input_object(self, mock_urlopen):
      -        """Should send request with InputObject (dict)"""
      +    def test_send_with_input_dict(self, mock_urlopen):
      +        """Should send request with input dict"""
Review Details
  • Files reviewed - 5 · Commit Range: 4658947..22c1d86
    • .github/CODEOWNERS
    • edgee/__init__.py
    • example/test.py
    • pyproject.toml
    • tests/test_edgee.py
  • Files skipped - 3
    • .github/workflows/check.yml - Reason: Filter setting
    • .github/workflows/release.yml - Reason: Filter setting
    • README.md - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines +133 to +134
try:
with urlopen(request) as response:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reliability: Missing HTTP Timeout

The urlopen call lacks a timeout, which could cause the request to hang indefinitely if the server doesn't respond. Adding a reasonable timeout improves reliability.

Code suggestion
Check the AI-generated fix before applying
Suggested change
try:
with urlopen(request) as response:
try:
with urlopen(request, timeout=30) as response:

Code Review Run #8e8543


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

try:
with urlopen(request) as response:
data = json.loads(response.read().decode("utf-8"))
except HTTPError as e:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error Handling: Incomplete Exception Coverage

Currently, only HTTPError is caught, but network connection failures raise URLError. Catching both ensures all request failures are handled gracefully.

Code suggestion
Check the AI-generated fix before applying
 - from urllib.error import HTTPError
 + from urllib.error import HTTPError, URLError
 @@ -136,3 +136,7 @@
 -        except HTTPError as e:
 -            error_body = e.read().decode("utf-8")
 -            raise RuntimeError(f"API error {e.code}: {error_body}") from e
 +        except (HTTPError, URLError) as e:
 +            if isinstance(e, HTTPError):
 +                error_body = e.read().decode("utf-8")
 +                raise RuntimeError(f"API error {e.code}: {error_body}") from e
 +            else:
 +                raise RuntimeError(f"Network error: {e.reason}") from e

Code Review Run #8e8543


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add ruff check , ruff fmt

@bito-code-review
Copy link

To add Ruff checks and formatting to the workflow, insert these steps after the Python setup in .github/workflows/check.yml. This assumes Ruff is installed via pip; adjust if using a different method.

.github/workflows/check.yml

- uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Install Ruff
        run: pip install ruff
      - name: Ruff format
        run: ruff format .
      - name: Ruff check
        run: ruff check .

@bito-code-review
Copy link

bito-code-review bot commented Jan 7, 2026

Code Review Agent Run #f0b778

Actionable Suggestions - 0
Additional Suggestions - 4
  • example/test.py - 1
    • Potential IndexError in streaming loops · Line 67-94
      The new streaming tests access chunk.choices[0] without checking if the list is non-empty, which could raise an IndexError if the API returns a chunk with no choices—though this seems unlikely in practice.
      Code suggestion
       @@ -71,1 +71,2 @@
      -):
      +):
      +    if not chunk.choices: continue
  • tests/test_edgee.py - 2
    • Unused import cleanup · Line 9-9
      Removed unused imports (BytesIO, SendResponse, Choice, Usage) from edgee module; verified no usages in file via grep and symbol search.
    • Unnecessary assignment removal · Line 125-125
      Removed unused 'result =' assignment in test_send_with_input_object; test only checks request args, not response, so no behavior change.
  • edgee/__init__.py - 1
    • Remove unused buffer variable · Line 224-224
      The 'buffer' variable is assigned on this line but never referenced in the stream method. Removing it improves code cleanliness without affecting functionality.
      Code suggestion
       @@ -223,2 +223,1 @@
      -                # Read and parse SSE stream
      -                buffer = ""
      +                # Read and parse SSE stream
Review Details
  • Files reviewed - 6 · Commit Range: 22c1d86..b9b3384
    • .github/CODEOWNERS
    • edgee/__init__.py
    • example/test.py
    • pyproject.toml
    • tests/test_edgee.py
    • uv.lock
  • Files skipped - 3
    • .github/workflows/check.yml - Reason: Filter setting
    • .github/workflows/release.yml - Reason: Filter setting
    • README.md - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@CLEMENTINATOR CLEMENTINATOR force-pushed the feat/first-implementation branch from 796cf6b to 2e772a1 Compare January 7, 2026 15:57
@CLEMENTINATOR CLEMENTINATOR force-pushed the feat/first-implementation branch from 2e772a1 to 66f5739 Compare January 7, 2026 15:58
@bito-code-review
Copy link

bito-code-review bot commented Jan 7, 2026

Code Review Agent Run #b0035a

Actionable Suggestions - 0
Additional Suggestions - 3
  • edgee/__init__.py - 3
    • Missing test coverage for SendResponse properties · Line 69-95
      The newly added convenience properties on SendResponse provide easy access to choice data, but they lack unit test coverage. While the implementation appears correct, adding tests would help catch any edge cases and ensure reliability.
    • Missing test coverage for StreamChunk properties · Line 116-135
      The convenience properties added to StreamChunk are not tested. Although straightforward, tests would confirm they handle empty choices and missing delta fields properly.
    • Missing test coverage for stream_text method · Line 309-324
      The new stream_text method lacks test coverage. It builds on the stream method and text property, so tests would ensure it filters chunks as intended.
Review Details
  • Files reviewed - 6 · Commit Range: b9b3384..66f5739
    • .github/CODEOWNERS
    • edgee/__init__.py
    • example/test.py
    • pyproject.toml
    • tests/test_edgee.py
    • uv.lock
  • Files skipped - 3
    • .github/workflows/check.yml - Reason: Filter setting
    • .github/workflows/release.yml - Reason: Filter setting
    • README.md - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review
Copy link

bito-code-review bot commented Jan 9, 2026

Code Review Agent Run #b39500

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: 66f5739..010dfc9
    • .github/CODEOWNERS
    • edgee/__init__.py
    • example/test.py
    • pyproject.toml
    • tests/test_edgee.py
    • uv.lock
  • Files skipped - 3
    • .github/workflows/check.yml - Reason: Filter setting
    • .github/workflows/release.yml - Reason: Filter setting
    • README.md - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@CLEMENTINATOR CLEMENTINATOR merged commit 7bccb99 into main Jan 9, 2026
2 checks passed
@CLEMENTINATOR CLEMENTINATOR deleted the feat/first-implementation branch January 9, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants