Skip to content

add initial Storage implementation #18

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

Merged
merged 4 commits into from
Apr 2, 2025
Merged

add initial Storage implementation #18

merged 4 commits into from
Apr 2, 2025

Conversation

cjber
Copy link
Contributor

@cjber cjber commented Mar 27, 2025

Had a go at implementing IPFS storage as tools. Haven't been able to test it, so unsure if this is works.

Ref NEB-154

@cjber cjber requested a review from Copilot March 27, 2025 17:36
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an initial implementation for IPFS storage integration using tools.

  • Adds a Storage service class with methods to fetch content and upload both JSON data and files to IPFS.
  • Updates the project dependencies by including aiohttp and ipython in the configuration.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
python/thirdweb-ai/src/thirdweb_ai/services/storage.py Added IPFS storage service with fetch and upload methods.
python/thirdweb-ai/pyproject.toml Added new dependencies: aiohttp for async HTTP requests and ipython for development tooling.
Comments suppressed due to low confidence (1)

python/thirdweb-ai/src/thirdweb_ai/services/storage.py:63

  • Use the file_path object's open() method instead of calling Path.open(file_path, ...) to properly read the file. Replace with: 'with file_path.open("rb") as file_content:'
with Path.open(file_path, "rb") as file_content:

@cjber cjber requested a review from jakeloo March 28, 2025 11:11
@cjber cjber marked this pull request as ready for review March 31, 2025 13:00
Copy link

linear bot commented Mar 31, 2025


raise ValueError(f"Path exists but is neither a file nor a directory: {data}")

raise ValueError(
Copy link
Member

Choose a reason for hiding this comment

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

i think in the else case, we can just encode it as bytes and upload it.

so that we can instruct the agent to "write the answer of 2+2 to ipfs", then it'd pass "4" to this function, and we'd just upload it as plain text.

@jakeloo
Copy link
Member

jakeloo commented Apr 1, 2025

Can we include some tests for the testing through the behavior and correctness of the upload function?

@cjber cjber merged commit 7d4be9e into main Apr 2, 2025
2 checks passed
@cjber cjber deleted the cb/storage branch April 2, 2025 11:11
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.

2 participants