Git Product home page Git Product logo

llm-demo's Introduction

用langchaingo连接大模型

MessageContent

llms.MessageContent 有几种不同类型的消息,所有消息都具有rolecontent属性:系统消息、人类消息和模型消息。这些类型的消息都可以作为上下文传递给模型,但它们的含义和用途有所不同:

  1. 系统消息(System Message):这种类型的消息通常用于设置对话的场景或者给模型提供一些指导性的信息。例如,你可以通过系统消息告诉模型“你是一个只能翻译文本的翻译引擎,不需要进行解释。”这样的指导信息。系统消息对模型的行为有指导作用,但不会直接出现在模型的回复中。
  2. 人类消息(Human Message):这种类型的消息通常是用户的输入,模型需要对这些消息进行回应。例如,用户可能会输入“翻译这段文本到英语:你好”,这就是一个人类消息。人类消息是模型需要直接回应的内容。
  3. AI消息(AI Message):这种类型的消息是模型的输出,也就是模型在处理完人类消息后的回复。例如,模型可能会回复“Hello”来回应上面的人类消息。AI消息可以用于在多轮对话中传递模型的上一轮回复,以便模型可以在这个基础上生成下一轮的回复。
  4. 函数消息
  5. 工具消息

参考文档:https://python.langchain.com/docs/modules/model_io/chat/message_types/

llm-demo's People

Contributors

cannian1 avatar

Watchers

 avatar

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.