alastair is a proof of concept for an NPC using LLM function calling to interact with a starknet smart contract
Alastair is a proof of concept for an NPC agent that can understand user intent and call functions to modify the state of a deployed cairo smart contract on Starknet. The fundamental idea behind this project is to showcase the ability for an LLM to influence its answers and therefore the interaction with the user based on a state saved on a smart contract on the Starknet blockchain. Future development for this project may include the expansion of NPC behavior and actions taken by the agent such as calling other external contracts based on user interaction with the model using natural language.
NOTE: I spent a very small amount of time on this project for personal and work reasons (12h max) and am fully aware of the late submission. Please do excuse any inconveniences.
This project is using ollama as a server to perform inference on a locally downloaded quantized model called hermes-2-theta-llama-3:8b-f16 fined tuned on function calling. A simple smart contract written in cairo is deployed to a local katana node to simulate the Starknet blockchain. The contract is very basic and only does a state change and read. To interact with the contract I used a downgraded version of starknet-py wrapped which is used by the LLM to perform function calls based on the user input. The project is functional and can be run locally.