Giter Club home page Giter Club logo

Comments (6)

tmc avatar tmc commented on June 11, 2024 2

Ahhh ok. So we'd need to have a look. It's not very self-explanatory haha.

No worries. Which platform @tmc? Discord, Gitter, Matrix?

Sorry I should have indicated, we're in the langchain discord. (we should put this in the README..).

from langchaingo.

ChristianSch avatar ChristianSch commented on June 11, 2024 1

I would like to highlight my biggest problem. We have the ChatMessage as follows:

type ChatMessage interface {
	GetText() string
	GetType() ChatMessageType // <- role
}

The openAI API needs separated role and message fields though: https://platform.openai.com/docs/api-reference/chat/create. They are required.

The LLM contract allows passing strings only though.

// LLM is a langchaingo Large Language Model.
type LLM interface {
	Call(prompt string, stopWords []string) (string, error)
	Generate(prompts []string, stopWords []string) ([]*Generation, error)
}

The reference implementation seems to handle it by not using string-only messages:

chat([HumanMessage(content="Translate this sentence from English to French. I love programming.")])

Maybe we could generalize the LLM input to be a BaseMessage as well, and then strongly type it for all implementations? (Normal LLMs just get a text as input, chat role and text etc.)

What are everyone's thoughts? (@tmc?)

from langchaingo.

tmc avatar tmc commented on June 11, 2024 1

What's the type based upon?

That's just a copy of the concept from https://github.com/hwchase17/langchain/blob/master/langchain/schema.py#L88

See "role" here: https://github.com/hwchase17/langchain/blob/master/langchain/schema.py#L106 (and used here: https://github.com/hwchase17/langchain/blob/master/langchain/schema.py#L33)

@ChristianSch sorry I missed your follow-up comment here. Please feel free to join us in the langchain chat in the #langchain-go channel.

from langchaingo.

tmc avatar tmc commented on June 11, 2024

Hmm. I think we need to think through if “type” is sufficiently distinct from “role”. We have the role field on the GenericChatMessage struct.

from langchaingo.

ChristianSch avatar ChristianSch commented on June 11, 2024

What's the type based upon?

from langchaingo.

ChristianSch avatar ChristianSch commented on June 11, 2024

Ahhh ok. So we'd need to have a look. It's not very self-explanatory haha.

No worries. Which platform @tmc? Discord, Gitter, Matrix?

from langchaingo.

Related Issues (20)

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.