This project was originally forked from Perplexica, an open-source AI search engine. We've adapted and expanded upon their work to create a specialized tool for the Starknet ecosystem. We're grateful for their initial contribution which provided a base foundation for Starknet Agent.
Starknet Agent is an open-source AI-powered searching tool specifically designed for the Starknet Ecosystem. It uses advanced machine learning algorithms to search and understand the Starknet documentation and the Cairo Book, providing clear and accurate answers to your queries about Starknet and Cairo.
- Local LLMs: You can make use of local LLMs such as Llama3 and Mixtral using Ollama. 🚧 Work in progress
- Focus Modes: Special modes to better answer specific types of questions. Starknet Agent currently has 3 focus modes:
- Starknet Ecosystem: Searches the entire Starknet Ecosystem, including the Cairo Book and the Starknet documentation.
- Cairo Book: Searches the Cairo Book for answers.
- Starknet Docs: Searches the Starknet documentation for answers.
- Starknet Foundry: Searches the Starknet Foundry documentation for answers.
There are mainly 2 ways of installing Starknet Agent - With Docker, Without Docker. Using Docker is highly recommended.
-
Ensure Docker is installed and running on your system.
-
Clone the Starknet Agent repository:
git clone https://github.com/cairo-book/starknet-agent.git
-
After cloning, navigate to the directory containing the project files.
-
Setup your databases on MongoDB Atlas.
- Create a new cluster.
- Create a new database for each of the focus modes you intend to use. A single database for the ecosystem-wide mode is enough, e.g.:
starknet-ecosystem
. - Create a new collection inside each database that will store the embeddings. e.g.
all-chunks
for thestarknet-ecosystem
database. - Create a vectorSearch index named default on the collection (tab
Atlas Search
). Example index configuration:{ "fields": [ { "numDimensions": 2048, "path": "embedding", "similarity": "cosine", "type": "vector" } ] }
-
Inside the packages/backend package, copy the
sample.config.toml
file to aconfig.toml
. For development setups, you need only fill in the following fields:-
OPENAI
: Your OpenAI API key. You only need to fill this if you wish to use OpenAI's models. -
ANTHROPIC
: Your Anthropic API key. You only need to fill this if you wish to use Anthropic models.Note: You can change these after starting Starknet Agent from the settings dialog.
-
SIMILARITY_MEASURE
: The similarity measure to use (This is filled by default; you can leave it as is if you are unsure about it.) -
Databases:
ECOSYSTEM_DB
: This is the database for the entire Starknet Ecosystem, that aggregates all the other databases. You will need to fill this with your own database URL. example:
[ECOSYSTEM_DB] MONGODB_URI = "mongodb+srv://mongo:..." DB_NAME = "starknet-ecosystem" COLLECTION_NAME = "all-chunks"
- Other databases are for focused modes (in a single resource). You only need to fill these ones if you want to use the associated focused mode. You will need to create databases for each of the focused modes.
-
Models: The `[HOSTED_MODE] table defines the underlying LLM model used. We recommend using:
[HOSTED_MODE] DEFAULT_CHAT_PROVIDER = "anthropic" DEFAULT_CHAT_MODEL = "Claude 3.5 Sonnet" DEFAULT_EMBEDDING_PROVIDER = "openai" DEFAULT_EMBEDDING_MODEL = "Text embedding 3 large"
-
-
Generate the embeddings for the databases. You can do this by running the
generateEmbeddings.ts
script with bun. If you followed the example above, you will need to run the script with option4 (Everything)
for thestarknet-ecosystem
database.bun run packages/ingester/src/scripts/generateEmbeddings.ts
-
Run the development server with turbo.
turbo dev
-
Wait a few minutes for the setup to complete. You can access Starknet Agent at http://localhost:3000 in your web browser.
Note: After the containers are built, you can start Starknet Agent directly from Docker without having to open a terminal.
- Expanding coverage of Starknet-related resources
- Adding an Autonomous Agent Mode for more precise answers
For more information on contributing to Starknet Agent you can read the CONTRIBUTING.md file to learn more about Starknet Agent and how you can contribute to it.