Giter Site home page Giter Site logo

neurocult / agency Goto Github PK

View Code? Open in Web Editor NEW
378.0 5.0 19.0 915 KB

๐Ÿ•ต๏ธโ€โ™‚๏ธ Library designed for developers eager to explore the potential of Large Language Models (LLMs) and other generative AI through a clean, effective, and Go-idiomatic approach.

License: MIT License

Go 100.00%
ai chatgpt golang llm agents artificial-general-intelligence artificial-intelligence autonomous-agents generative-ai go

agency's Introduction

Agency: The Go Way to AI

Library designed for developers eager to explore the potential of Large Language Models (LLMs) and other generative AI through a clean, effective, and Go-idiomatic approach.

Welcome to the agency! ๐Ÿ•ต๏ธโ€โ™‚๏ธ

Dracula-agent, mascot of the "agency" library.

๐Ÿ’ป Quick Start

Install package:

go get github.com/neurocult/agency

Chat example:

package main

import (
	"bufio"
	"context"
	"fmt"
	"os"

	_ "github.com/joho/godotenv/autoload"

	"github.com/neurocult/agency"
	"github.com/neurocult/agency/providers/openai"
)

func main() {
	assistant := openai.
		New(openai.Params{Key: os.Getenv("OPENAI_API_KEY")}).
		TextToText(openai.TextToTextParams{Model: "gpt-3.5-turbo"}).
		SetPrompt("You are helpful assistant.")

	messages := []agency.Message{}
	reader := bufio.NewReader(os.Stdin)
	ctx := context.Background()

	for {
		fmt.Print("User: ")

		text, err := reader.ReadString('\n')
		if err != nil {
			panic(err)
		}

		input := agency.UserMessage(text)
		answer, err := assistant.SetMessages(messages).Execute(ctx, input)
		if err != nil {
			panic(err)
		}

		fmt.Println("Assistant: ", answer)

		messages = append(messages, input, answer)
	}
}

That's it!

See examples to find out more complex usecases including RAGs and multimodal operations.

๐Ÿš€ Features

โœจ Pure Go: fast and lightweight, statically typed, no need to mess with Python or JavaScript

โœจ Write clean code and follow clean architecture by separating business logic from concrete implementations

โœจ Easily create custom operations by implementing simple interface

โœจ Compose operations together into processes with the ability to observe each step via interceptors

โœจ OpenAI API bindings (can be used for any openai-compatable API: text to text (completion), text to image, text to speech, speech to text

๐Ÿค” Why need Agency?

At the heart of Agency is the ambition to empower users to build autonomous agents. While perfect for all range of generative AI applications, from chat interfaces to complex data analysis, our library's ultimate goal is to simplify the creation of autonomous AI systems. Whether you're building individual assistant or coordinating agent swarms, Agency provides the tools and flexibility needed to bring these advanced concepts to life with ease and efficiency.

In the generative AI landscape, Go-based libraries are rare. The most notable is LangChainGo, a Go port of the Python LangChain. However, translating Python to Go can be clunky and may not fit well with Go's idiomatic style. Plus, some question LangChain's design, even in Python. This situation reveals a clear need for an idiomatic Go alternative.

Our goal is to fill this gap with a Go-centric library that emphasizes clean, simple code and avoids unnecessary complexities. Agency is designed with a small, robust core, easy to extend and perfectly suited to Go's strengths in static typing and performance. It's our answer to the lack of Go-native solutions in generative AI.

Tutorial

๐Ÿ›ฃ Roadmap

In the next versions:

  • Support for external function calls
  • Metadata (tokens used, audio duration, etc)
  • More provider-adapters, not only openai
  • Image to text operations
  • Powerful API for autonomous agents
  • Tagging and JSON output parser

agency's People

Contributors

emil14 avatar mkrou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

agency's Issues

No license listed.

There is no license for this repo. Should there be a license? Can we have a license that allows us to use for business purposes?

Why go?

Hi neurocult,
Thanks for making this interesting project.
I am hesitating which framework to use, a go version or a python version.
Is the only reason why we choose a golang framework because it's more friendly to gophers?
Any insight would be much appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.