langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

Add Pinata Tool

Open Zhixuan0318 opened this issue 7 months ago • 1 comments

Summary

This tool adds integration support to the Pinata SDK so that agents have the ability to manage files (upload, query, and delete) on the IPFS Web3.0 Storage via Pinata and manage groups (create, delete, get, list, and update) for your files in your Pinata account.

Notes

  • There are a total of 8 tool classes for this Pinata Tool integration:
  1. PinataUploadFileTool
  2. PinataQueryFileTool
  3. PinataDeleteFileTool
  4. PinataCreateGroupTool
  5. PinataDeleteGroupTool
  6. PinataGetGroupTool
  7. PinataListGroupTool
  8. PinataUpdateGroupTool
  • In order to use the tool, you need to create an API key on Pinata to obtain a JWT, which need to be include into the .env (had included into the env example)
  • The API key needs to have admin mode turned on to provide read and write access to all the files and group-related tools.
  • Integration test is added and all passed:
PASS  src/tools/tests/pinata.int.test.ts (5.979 s)
  Pinata Integration Test
    ✓ should create a group named - Example Group successfully (1002 ms)
    ✓ should retrieve the created group by ID (729 ms)
    ✓ should update the group name to Latest Example Group successfully (364 ms)
    ✓ should list the group with the updated name - Latest Example Group (251 ms)
    ✓ should upload a file (Astronaut Emoji) successfully to the group (1279 ms)
    ✓ should query and return the uploaded file (Astronaut Emoji) with the same parameters (259 ms)
    ✓ should delete the uploaded file (cleanup) (904 ms)
    ✓ should delete the group created (cleanup) (553 ms)

Test Suites: 1 passed, 1 total
Tests:       8 passed, 8 total
Snapshots:   0 total
Time:        6.51 s
Ran all test suites matching /pinata.int.test.ts/i.
  • An example is added.
  • Doc notebook is added, but some of the links to the API references are not added yet as I'm having trouble building the docs locally. Hopefully it can be added by any maintainers during edits.

Todo

  • Adding support to private IPFS, as currently this integration is only for public IPFS.
  • Once this JS tool integration is merged and released, I will start working on the Python version.
  • Adding more examples for each tool and coming out with a comprehensive tutorial (maybe a simple use case) on it.
  • Consider adding a Pinata toolkit

Twitter Handle

@tzx0318

Zhixuan0318 avatar Apr 21 '25 16:04 Zhixuan0318

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-docs ❌ Failed (Inspect) Apr 21, 2025 4:30pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Apr 21, 2025 4:30pm

vercel[bot] avatar Apr 21 '25 16:04 vercel[bot]

Hey @jacoblee93 and @benjamincburns, I just want to check whether this PR will be reviewed soon. Thanks!

Zhixuan0318 avatar May 25 '25 14:05 Zhixuan0318

Hi @Zhixuan0318,

The community package has become rather unwieldy, and we recommend against using it in production applications.

Is this something that you want people to be able to use in production? If so, I'd recommend repackaging your changes into a standalone NPM module. You can keep this in your own GitHub repo and publish it to NPM yourself without our involvement, but to make it discoverable you can still create a PR that adds a page about it in our integration docs.

Otherwise if you think that community is the best home for this, we'll leave it open and review it when we're able. Unfortunately adding new features to community isn't a high priority for us right now, so this may take a little while.

benjamincburns avatar May 25 '25 23:05 benjamincburns

@Zhixuan0318 Going to close this as I see your making some efforts here: https://github.com/Zhixuan0318/pinata-langchain.

I'll echo what Ben said about how community packages are getting a bit unruly for us to put our full attention on (including introducing new packages), which is why we recommend floating this into a standalone package. That being said we're constantly reassessing this, so if you have a case for why a pinata integration is better suited in here we're keen to hear it! We're also available if you have any questions about how we want to support packages like this that are apart of the broader langchain ecosystem.

hntrl avatar Jun 23 '25 19:06 hntrl