diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c97596b66638f563104b02d06a7061b5184d872e --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +# Fantasy + +

+ The Charm Fantasy logo
+ Latest Release + GoDoc + Build Status +

+ +Build AI agents with Go. Multi-provider, multi-model, one API. + +1. Choose a model and provider +2. Add some tools +3. Compile to bytecode and let it rip + +> [!NOTE] +> Fantasy is currently a preview. Expect API changes. + +```go +import "charm.land/fantasy" +import "charm.land/fantasy/providers/openrouter" + +// Choose your fave provider-model combo. +provider := openrouter.New(openrouter.WithAPIKey(myHotKey)) +model, err := provider.LanguageModel("moonshotai/kimi-k2") +if err != nil { + fmt.Fprintln(os.Stderr, "Dang:", err) + os.Exit(1) +} + +// Make your own tools. +cuteDogTool := fantasy.NewAgentTool("cute_dog_tool", "Provide up-to-date info on cute dogs.", fetchCuteDogInfo) + +// Equip your agent. +agent := fantasy.NewAgent(model, fantasy.WithTools(cuteDogTool)) + +// Put that agent to work! +const prompt = "Find all the cute dogs in Silver Lake, Los Angeles." +result, err := agent.Generate(context.Background(), fantasy.AgentCall{Prompt: prompt}) +if err != nil { + fmt.Fprintln(os.Stderr, "Oof:", err) + os.Exit(1) +} +fmt.Println(result.Response.Content.Text()) +``` + +🍔 Hungry for more? [See the examples](https://github.com/charmbracelet/fantasy/tree/main/examples). + +## Multi-model? Multi-provider? + +Yeah! Fantasy is designed to support a wide variety of providers and models under a single API. While many providers such as Microsoft Azure, Amazon Bedrock, and OpenRouter have dedicated package, many other work just fine with `openaicompat`, the generic OpenAI-compatible layer. That said, if you find a provider that’s not compatible and needs special treatment, please let us know in an issue (or open a PR). + +## Work in Progress + +We built Fantasy to power [Crush](https://github.com/charmbracelet/crush), a hot coding agent for glamourously invincible development. Given that, Fantasy does not yet support things like: + +- Image models +- Audio models +- PDF uploads + +For things you’d like to see supported, PRs are welcome. + +## Whatcha think? + +We’d love to hear your thoughts on this project. Need help? We gotchu. You can find us on: + +- [Slack](https://charm.land/slack) +- [Discord][discord] +- [Twitter](https://twitter.com/charmcli) +- [The Fediverse](https://mastodon.social/@charmcli) +- [Bluesky](https://bsky.app/profile/charm.land) + +[discord]: https://charm.land/discord + +--- + +Part of [Charm](https://charm.land). + +The Charm logo + +Charm热爱开源 • Charm loves open source