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"])
ses = LLM::Session.new(llm, stream: $stdout)
ses.talk "Hello"

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, #developer_role, #embed, #inspect, #models, #persist!, #respond, #schema, #server_tool, #server_tools, #system_role, #tool_role, #tracer, #tracer=, #user_role, #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)


71
72
73
# File 'lib/llm/providers/zai.rb', line 71

def default_model
  "glm-4.5-flash"
end

#nameSymbol

Returns the provider's name

Returns:

  • (Symbol)

    Returns the provider's name



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

def name
  :zai
end

#filesObject

Raises:

  • (NotImplementedError)


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

def files
  raise NotImplementedError
end

#imagesLLM::XAI::Images

Returns:

Raises:

  • (NotImplementedError)


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

def images
  raise NotImplementedError
end

#audioObject

Raises:

  • (NotImplementedError)


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

def audio
  raise NotImplementedError
end

#moderationsObject

Raises:

  • (NotImplementedError)


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

def moderations
  raise NotImplementedError
end

#responsesObject

Raises:

  • (NotImplementedError)


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

def responses
  raise NotImplementedError
end

#vector_storesObject

Raises:

  • (NotImplementedError)


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

def vector_stores
  raise NotImplementedError
end