Class: LLM::ZAI

Inherits:
OpenAI show all
Defined in:
lib/llm/providers/zai.rb

Overview

The ZAI class implements a provider for zAI.

Examples:

#!/usr/bin/env ruby
require "llm"

llm = LLM.zai(key: ENV["KEY"])
bot = LLM::Bot.new(llm, stream: $stdout)
bot.chat("Greetings Robot", role: :user).flush

Constant Summary

Constants inherited from OpenAI

OpenAI::HOST

Instance Method Summary collapse

Methods inherited from OpenAI

#assistant_role, #complete, #embed, #models, #server_tools, #web_search

Methods inherited from Provider

#assistant_role, #chat, clients, #complete, #embed, #inspect, #models, #respond, #schema, #server_tool, #server_tools, #web_search, #with

Constructor Details

#initialize(host: "api.z.ai") ⇒ ZAI

Returns a new instance of ZAI.

Parameters:

  • host (String) (defaults to: "api.z.ai")

    A regional host or the default (“api.z.ai”)

  • key (String, nil)

    The secret key for authentication



20
21
22
# File 'lib/llm/providers/zai.rb', line 20

def initialize(host: "api.z.ai", **)
  super
end

Instance Method Details

#default_modelString

Returns the default model for chat completions #see https://docs.z.ai/guides/llm/glm-4.5#glm-4-5-flash glm-4.5-flash

Returns:

  • (String)


64
65
66
# File 'lib/llm/providers/zai.rb', line 64

def default_model
  "glm-4.5-flash"
end

#filesObject

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/llm/providers/zai.rb', line 26

def files
  raise NotImplementedError
end

#imagesLLM::XAI::Images

Returns:

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/llm/providers/zai.rb', line 32

def images
  raise NotImplementedError
end

#audioObject

Raises:

  • (NotImplementedError)


38
39
40
# File 'lib/llm/providers/zai.rb', line 38

def audio
  raise NotImplementedError
end

#moderationsObject

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/llm/providers/zai.rb', line 44

def moderations
  raise NotImplementedError
end

#responsesObject

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/llm/providers/zai.rb', line 50

def responses
  raise NotImplementedError
end

#vector_storesObject

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/llm/providers/zai.rb', line 56

def vector_stores
  raise NotImplementedError
end