Giter Club home page Giter Club logo

gchain's Introduction

Go Reference Build workflow Integration test

๐Ÿค” What is this?

Inspired by langchain to provide composability when building Large Language Model Application. GChain mission is to bring langchain concept to Go in idiomatic way.

This Library will help on many usecases, such as :

โ“ Question Answering over specific documents

๐Ÿ’ฌ Chatbots

๐Ÿ“„ Document Summarization

Install and Importing

$ go get github.com/wejick/gchain
import "github.com/wejick/gchain

Example

llmModel = _openai.NewOpenAIModel(authToken, "", "text-davinci-003",callback.NewManager(), true)
chain, err := llm_chain.NewLLMChain(llmModel, nil)
if err != nil {
    //handle error
}
outputMap, err := chain.Run(context.Background(), map[string]string{"input": "Indonesia Capital is Jakarta\nJakarta is the capital of "})
fmt.Println(outputMap["output"])

More example in the example folder

As our documentation is not yet complete, please refer to examples and integration test for reference.

Notice

  1. Don't use it if you have better option
  2. GChain priority is golang idiomatic. So eventhough it happily use many langchain concept, don't expect exactly the same behavior as this is not reimplementation.

gchain's People

Contributors

wejick avatar mfarrashakim avatar dependabot[bot] avatar

Stargazers

Riz avatar Zack Sargent avatar Satyam Tiwary avatar Brad Pillow avatar henry avatar  avatar Shivam Kumar avatar Simon Edwards avatar Joel Boehland avatar  avatar Rohan Seth avatar  avatar

Watchers

 avatar

gchain's Issues

Conversation chain with tools

I think before going on with Agent #6 since I don't have really good usecase so far, working on conversation chain with tools access may be can be a good stepping stone.
Let's explore how it will looks like to have a conversation chain with access of tools, this will not only evolve the chain but also tools and retrieval in general.

Many interesting question :

  1. Should tools interface compatible with retrieval?
  2. Should retrieval can be used directly as a tool?
  3. Or maybe we need to create a retrieval tool where it consume a retrieval and give user opportunity to put definition by them selves?

How to handle options

On LangChain there is the kwargs where it's passed from front to back, with the nature of Python's dynamic typing this kwargs can be reused by many layers from agent, to chain until model.
However, to have an idiomatic Go developer experience, that model is not ideal. If we talk about the perfect way, it should use a functional option pattern.

Need more research on how this model will looks like.

Debugger / tracer

In LangChain there's tracing functionality where we can see all the LLM invocation and use it to debug the implementation.

This functionality will be useful to have, however the API of langchain-server is opaque. I don't know where to get the source of it or any possibility to reuse it.
I would love to reuse any available tracer and UI, one idea is probably to use OpenTelemetry. I don't think it has proper UI for development need.

For implementation detail, we can use callback.

Agent support

Langchain has this concept of an agent, which gives Model access to a wide range of functionality or what it calls tools.

Supporting Agent is obviously a must, however, the implementation in Langchain is not easy to follow. I feel like there's need to simplify the way the agent works and we can probably also use this opportunity to use openAI function call to describe the tools instead.

Vectorstore search behavior

Today vector store search function will still do vector based search to the database. Instead of having vector parameter, it has string based parameter which will be converted to vector later.

Is it better for search to do a nonvector search instead if applicable?
do we need an extra option for this? what will be the default behavior?

How about hybrid search?

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.