Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ We provide 2 starter kits:
1. Uses `LangChain`
2. Uses OpenAI's `Swarm` framework

Both agents are equipped with Coinbase's [AgentKit](https://github.com/coinbase/cdp-agentkit) for making on-chain transactions as well as a Twitter toolbox for read and write access to X.
Both agents use OpenGradient's verifiable inference and on-chain ML tools for AI-powered workflows.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion langchain-starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The agent is equipped by the following tools:

1. Dependencies are defined in `requirements.txt`, run `pip install -r requirements.txt` to install all dependencies. We recommend using virtualenv.
2. You'll need an OpenGradient token in order to run inferences. You can use the `opengradient` CLI to create it, read more on our [official docs](https://docs.opengradient.ai/developers/sdk/#credentials-setup).
3. Make a copy of the `.env.sh.template` file in the root folder and rename to `.env.sh`. Fill in with your OpenGradient token as well as Twitter API keys.
3. Make a copy of the `.env.sh.template` file in the root folder and rename to `.env.sh`. Fill in with your OpenGradient token.

Note: If you run into git permission denied error messages, please generate a Github SSH key.
```
Expand Down
2 changes: 1 addition & 1 deletion langchain-starter/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ def create_agent_executor():
agent_executor = create_react_agent(
model=llm,
tools=create_agent_toolkit(),
messages_modifier=AGENT_SYSTEM_PROMPT)
state_modifier=AGENT_SYSTEM_PROMPT)

return agent_executor
8 changes: 4 additions & 4 deletions langchain-starter/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from langchain_community.tools import WikipediaQueryRun
from langchain_community.utilities import WikipediaAPIWrapper
from langchain_core.tools import BaseTool
from opengradient.mltools import create_og_model_tool, ToolType
from opengradient.alphasense import create_run_model_tool, ToolType

# Define the tools the agent can use
def create_agent_toolkit() -> List[BaseTool]:
Expand All @@ -13,12 +13,12 @@ def create_agent_toolkit() -> List[BaseTool]:
tools.append(wikipedia)

# Add Spot Forecast model
tools.append(create_og_model_tool(
tools.append(create_run_model_tool(
tool_type=ToolType.LANGCHAIN,
model_cid="QmY1RjD3s4XPbSeKi5TqMwbxegumenZ49t2q7TrK7Xdga4",
tool_name="SuiSpotForecast",
input_getter=lambda: {"open_high_low_close": fetch_sui_price_candles()},
output_formatter=lambda out: f"The predicted price change is: {out['destandardized_prediction'][0] * 100}%",
model_input_provider=lambda: {"open_high_low_close": fetch_sui_price_candles()},
model_output_formatter=lambda out: f"The predicted price change is: {out['destandardized_prediction'][0] * 100}%",
tool_description="Runs an ML model to forecast the price of SUI 30 minutes from now. Requires no input."
))

Expand Down