0
点赞
收藏
分享

微信扫一扫

CentOS:Kibana下载X-Pack

中间件小哥 2024-06-14 阅读 7

Chat and Language Models

LLMs are currently available in two API types:

  • LanguageModels. Their API is very simple - they accept a String as input and return a String as output.
    This API is now becoming obsolete in favor of chat API (second API type).
  • ChatLanguageModels. These accept either a single or multiple ChatMessages as input
    and return an AiMessage as output.
    ChatMessage usually contains text, but some LLMs also support a mix of text and Images.
    Examples of such chat models include OpenAI’s gpt-3.5-turbo and Google’s gemini-pro.

Support for LanguageModels will no longer be expanded in LangChain4j,
so in all new features, we will use a ChatLanguageModel API.

ChatLanguageModel is the low-level API in LangChain4j, offering the most power and flexibility.
There are also high-level APIs (Chains and AiServices) that we will cover later, after we go over the basics.

Apart from ChatLanguageModel and LanguageModel, LangChain4j supports the following types of models:

  • EmbeddingModel - This model can translate text into an Embedding.
  • ImageModel - This model can generate and edit Images.
  • ModerationModel - This model can check if the text contains harmful content.
  • ScoringModel - This model can score (or rank) multiple pieces of text against a query,
    essentially determining how relevant each piece of text is to the query. This is useful for RAG.
    These will be covered later.

Now, let’s take a closer look at the ChatLanguageModel API.

public interface ChatLanguageModel {
   

    String gen
举报

相关推荐

0 条评论