-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5cd306c
commit d93eeb8
Showing
7 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Farcaster Langchain Toolkit | ||
Farcaster integration with Langchain to enable agentic workflows using the core primitives defined in `cdp-agentkit-core`. | ||
|
||
This toolkit contains tools that enable an LLM agent to interact with [Farcaster](https://www.farcaster.xyz/) via the [Neynar API](https://docs.neynar.com/). The toolkit provides a wrapper around the Neynar API, allowing agents to perform social operations like posting casts and replies. | ||
|
||
## Setup | ||
|
||
### Prerequisites | ||
- Python 3.10 or higher | ||
- [OpenAI API Key](https://platform.openai.com/api-keys) | ||
- [Neynar API Key](https://docs.neynar.com/reference/getting-started) | ||
- [Neynar Signer UUID](https://docs.neynar.com/reference/create-signer) | ||
- Farcaster Account with FID | ||
|
||
### Installation | ||
bash | ||
pip install farcaster-langchain | ||
|
||
### Environment Setup | ||
|
||
Set the following environment variables: | ||
bash | ||
export OPENAI_API_KEY=<your-openai-api-key> | ||
export NEYNAR_API_KEY=<your-neynar-api-key> | ||
export NEYNAR_SIGNER_UUID=<your-signer-uuid> | ||
export FARCASTER_FID=<your-farcaster-id> | ||
|
||
## API Reference | ||
|
||
### FarcasterApiWrapper | ||
The main wrapper class that handles interactions with the Farcaster API via Neynar. | ||
|
||
#### Methods | ||
|
||
##### cast | ||
python | ||
def cast(text: str, channel_id: Optional[str] = None, embeds: Optional[List[str]] = None) -> str | ||
|
||
Post a new cast to Farcaster. Optionally specify a channel or include embedded URLs. | ||
|
||
##### get_notifications | ||
python | ||
def get_notifications(fid: Optional[str] = None) -> str | ||
|
||
Get recent notifications for the authenticated user or specified FID. | ||
|
||
##### get_user_details | ||
|
||
python | ||
def get_user_details(username: str) -> str | ||
|
||
Get details about a specific Farcaster user. | ||
|
||
### FarcasterToolkit | ||
A collection of LangChain tools for Farcaster interactions. | ||
|
||
#### Available Tools | ||
1. **user_details** - Get user details by FID | ||
2. **user_notifications** - Get notifications for the authenticated user | ||
3. **cast** - Post a cast (max 320 characters, with optional channel and embeds) | ||
4. **reply_to_cast** - Reply to an existing cast | ||
|
||
For detailed examples and usage, see the [main README](../README.md). | ||
|
||
## Contributing | ||
See [CONTRIBUTING.md](../CONTRIBUTING.md) for detailed setup instructions and contribution guidelines. | ||
|
||
## Documentation | ||
For detailed documentation, please visit: | ||
- [Agentkit-Core](https://coinbase.github.io/cdp-agentkit/cdp-agentkit-core/) | ||
- [Neynar API Documentation](https://docs.neynar.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
import sys | ||
import os | ||
|
||
sys.path.insert(0, os.path.abspath("..")) | ||
|
||
project = 'CDP Agentkit - Farcaster LangChain' | ||
author = 'Coinbase Developer Platform' | ||
release = '0.0.1' | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [ | ||
'myst_parser', # Parsing Markdown | ||
'sphinx.ext.autodoc', # Automatically generate documentation from docstrings | ||
'sphinx.ext.napoleon', # Google-style docstring support | ||
'sphinx_autodoc_typehints' # Type hints in function signatures | ||
] | ||
|
||
templates_path = ['_templates'] | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = 'alabaster' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
farcaster\_langchain package | ||
=========================== | ||
|
||
Submodules | ||
---------- | ||
|
||
farcaster\_langchain.farcaster\_api\_wrapper module | ||
------------------------------------------------ | ||
|
||
.. automodule:: farcaster_langchain.farcaster_api_wrapper | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
farcaster\_langchain.farcaster\_tool module | ||
---------------------------------------- | ||
|
||
.. automodule:: farcaster_langchain.farcaster_tool | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
farcaster\_langchain.farcaster\_toolkit module | ||
------------------------------------------ | ||
|
||
.. automodule:: farcaster_langchain.farcaster_toolkit | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
------------- | ||
|
||
.. automodule:: farcaster_langchain | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CDP Agentkit - Farcaster LangChain Documentation | ||
============================================== | ||
|
||
.. include:: README.md | ||
:parser: myst_parser.sphinx_ | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
:hidden: | ||
|
||
modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=. | ||
set BUILDDIR=_build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
farcaster_langchain | ||
================== | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
farcaster_langchain |