Skip to content

Comments

Update dependencies#341

Merged
KaQuMiQ merged 1 commit intomainfrom
fature/haiway
Jun 18, 2025
Merged

Update dependencies#341
KaQuMiQ merged 1 commit intomainfrom
fature/haiway

Conversation

@KaQuMiQ
Copy link
Collaborator

@KaQuMiQ KaQuMiQ commented Jun 18, 2025

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jun 18, 2025

Warning

Rate limit exceeded

@KaQuMiQ has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between e84a58b and a4b5006.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • pyproject.toml (3 hunks)
  • src/draive/__init__.py (9 hunks)
  • src/draive/evaluation/evaluator.py (1 hunks)
  • src/draive/evaluation/score.py (1 hunks)
  • src/draive/mcp/server.py (1 hunks)
  • src/draive/parameters/model.py (1 hunks)
  • src/draive/stages/stage.py (2 hunks)

Walkthrough

The changes increment the project version and update several dependencies and development tools in the project configuration. The public API surface of the draive package is expanded by importing and exporting additional entities from the haiway package. Hash methods are introduced for the EvaluatorResult, EvaluationScore, and DataModel classes, enabling or clarifying their hashability. The lifecycle management of disposables in the MCPServer and the Stage class is refactored to simplify and clarify resource handling, replacing implicit or feature-based context management with more explicit and streamlined logic. No existing public function, class, or variable declarations are removed or modified.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🔭 Outside diff range comments (1)
src/draive/evaluation/score.py (1)

105-107: Inconsistent hashing for EvaluationScore

__eq__ says two scores are equal if their numeric value is equal.
__hash__ now defaults to identity, breaking the invariant a == b ⇒ hash(a) == hash(b).

Proposed implementation:

-    def __hash__(self) -> int:  # explicitly using super to silence warnings
-        return super().__hash__()
+    def __hash__(self) -> int:
+        # Hash must mirror equality semantics
+        return hash(self.value)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc2d8af and e84a58b.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • pyproject.toml (3 hunks)
  • src/draive/__init__.py (9 hunks)
  • src/draive/evaluation/evaluator.py (1 hunks)
  • src/draive/evaluation/score.py (1 hunks)
  • src/draive/mcp/server.py (1 hunks)
  • src/draive/parameters/model.py (1 hunks)
  • src/draive/stages/stage.py (2 hunks)
🔇 Additional comments (4)
src/draive/stages/stage.py (2)

1143-1149: Potential loss of disposable-provided State objects

Previously:

async with ctx_disposables as features:
    with ctx.updated(*features):

guaranteed that every State yielded by the disposables was injected into the context.
The refactor keeps the async with but drops the second ctx.updated(*features) layer:

async with ctx_disposables:
    return await execution(state=state)

If the new haiway.Disposables contract no longer yields State objects or now pushes them to
ctx internally, this is fine.
If it still yields, the produced States are now silently ignored, which will break any
down-stream code that relied on them.

Please verify the new contract and, if necessary, re-introduce ctx.updated(*features) or a
similar mechanism.


1161-1173: Same omission when both state and disposables are supplied

The mixed branch also removed *features from the context update:

async with ctx_disposables:
    with ctx.updated(ctx_state, *states, ctx.state(Processing)):

Any State produced by ctx_disposables may be lost.

Double-check that this is intentional; otherwise the same fix as above applies.

src/draive/__init__.py (1)

12-15: New haiway re-exports lack defensive import error handling

The freshly added symbols (File, FileAccess, LoggerObservability, ScopeContext,
StateContext, getenv_base64, process_concurrently, without_missing) are
hard-imported. If users install an earlier haiway than required, ImportError
will surface at import-time, even for code paths that do not use these names.

You did bump the minimal version to haiway~=0.22 (pyproject.toml), so that should
protect us, but projects often vendor‐lock older versions.
At minimum, ensure CI/publishing enforces the new requirement; optionally wrap the
imports in a version check to emit a clearer message.

Also applies to: 22-22, 25-25, 36-36, 45-45, 52-52

pyproject.toml (1)

24-25: Sanity-check freshly pinned versions before merging

Large jumps (openai 1.64 → 1.88, anthropic 0.47 → 0.54, …) occasionally introduce
backwards-incompatible API tweaks.

Consider running the quick scan below to spot obvious breaking changes or yanked releases:

#!/usr/bin/env bash
# Rough check that all pinned versions exist on PyPI
for pkg in numpy==2.2 haiway==0.22 cohere==5.15 openai==1.88 anthropic==0.54 \
           mistralai==1.8 google-genai==1.20 ollama==0.5 boto3==1.38 mcp==1.9; do
  python - <<PY
import json, sys, urllib.request, urllib.error, re
name, ver = "$pkg".split("==")
try:
    data = json.load(urllib.request.urlopen(f"https://pypi.org/pypi/{name}/{ver}/json"))
except urllib.error.HTTPError:
    print(f"❌  {pkg} not found on PyPI", file=sys.stderr)
PY
done

Also applies to: 33-42, 55-56, 63-64

Comment on lines +616 to +632
def __hash__(self) -> int:
hash_values: list[int] = []
for key in self.__PARAMETERS__.keys():
value: Any = getattr(self, key, MISSING)

# Skip MISSING values to ensure consistent hashing
if value is MISSING:
continue

# Convert to hashable representation
try:
hash_values.append(hash(value))

except TypeError:
continue # skip unhashable

return hash((self.__class__, tuple(hash_values)))
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

__hash__ breaks for the base DataModel and can silently collide

  1. self.__PARAMETERS__ may be the sentinel MISSING (e.g. on the un-parameterised base class).
    Calling .keys() on it raises AttributeError, so hash(DataModel()) will blow up.

  2. Skipping every unhashable value means two non-equal models can share the same hash, increasing
    the collision rate for sets / dict keys that use these instances.

Proposed minimal fix – guard for the sentinel and include a fallback hashing strategy:

     def __hash__(self) -> int:
-        hash_values: list[int] = []
-        for key in self.__PARAMETERS__.keys():
+        # Base class or invalid state – nothing to hash, but keep instances usable
+        if self.__PARAMETERS__ is MISSING:
+            return hash((self.__class__, ()))
+
+        hash_values: list[int] = []
+        for key in self.__PARAMETERS__:
             value: Any = getattr(self, key, MISSING)
@@
-        return hash((self.__class__, tuple(hash_values)))
+        return hash((self.__class__, tuple(hash_values)))

(Optional) To further reduce collisions, consider recursively converting common container
types (list, set, dict) into hashable equivalents instead of silently skipping them.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def __hash__(self) -> int:
hash_values: list[int] = []
for key in self.__PARAMETERS__.keys():
value: Any = getattr(self, key, MISSING)
# Skip MISSING values to ensure consistent hashing
if value is MISSING:
continue
# Convert to hashable representation
try:
hash_values.append(hash(value))
except TypeError:
continue # skip unhashable
return hash((self.__class__, tuple(hash_values)))
def __hash__(self) -> int:
# Base class or invalid state – nothing to hash, but keep instances usable
if self.__PARAMETERS__ is MISSING:
return hash((self.__class__, ()))
hash_values: list[int] = []
for key in self.__PARAMETERS__:
value: Any = getattr(self, key, MISSING)
# Skip MISSING values to ensure consistent hashing
if value is MISSING:
continue
# Convert to hashable representation
try:
hash_values.append(hash(value))
except TypeError:
continue # skip unhashable
return hash((self.__class__, tuple(hash_values)))
🤖 Prompt for AI Agents
In src/draive/parameters/model.py around lines 616 to 632, the __hash__ method
fails when self.__PARAMETERS__ is the sentinel MISSING, causing an
AttributeError on .keys(). To fix this, first check if self.__PARAMETERS__ is
MISSING and handle that case separately to avoid the error. Additionally,
instead of skipping unhashable values which can cause hash collisions, implement
a fallback hashing strategy that converts common container types like list, set,
and dict into hashable equivalents (e.g., tuples or frozensets) before hashing.
This will reduce silent collisions and improve hash uniqueness.

@KaQuMiQ KaQuMiQ merged commit 31bda0b into main Jun 18, 2025
4 of 5 checks passed
@KaQuMiQ KaQuMiQ deleted the fature/haiway branch June 18, 2025 12:58
@coderabbitai coderabbitai bot mentioned this pull request Aug 4, 2025
This was referenced Sep 27, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jan 13, 2026
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.

1 participant