Class: Langchain::LLM::BaseResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/langchain/llm/response/base_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_response, model: nil) ⇒ BaseResponse

Returns a new instance of BaseResponse.



11
12
13
14
# File 'lib/langchain/llm/response/base_response.rb', line 11

def initialize(raw_response, model: nil)
  @raw_response = raw_response
  @model = model
end

Instance Attribute Details

#contextObject

Save context in the response when doing RAG workflow vectorsearch#ask()



9
10
11
# File 'lib/langchain/llm/response/base_response.rb', line 9

def context
  @context
end

#modelObject (readonly)

Returns the value of attribute model.



6
7
8
# File 'lib/langchain/llm/response/base_response.rb', line 6

def model
  @model
end

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



6
7
8
# File 'lib/langchain/llm/response/base_response.rb', line 6

def raw_response
  @raw_response
end

Instance Method Details

#chat_completionString

Returns the chat completion text

Returns:

  • (String)

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/langchain/llm/response/base_response.rb', line 35

def chat_completion
  raise NotImplementedError
end

#chat_completionsArray<String>

Return the chat completion candidates

Returns:

  • (Array<String>)

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/langchain/llm/response/base_response.rb', line 56

def chat_completions
  raise NotImplementedError
end

#completionString

Returns the completion text

Returns:

  • (String)

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/langchain/llm/response/base_response.rb', line 27

def completion
  raise NotImplementedError
end

#completion_tokensInteger

Number of tokens utilized to generate the completion

Returns:

  • (Integer)

Raises:

  • (NotImplementedError)


77
78
79
# File 'lib/langchain/llm/response/base_response.rb', line 77

def completion_tokens
  raise NotImplementedError
end

#completionsArray<String>

Return the completion candidates

Returns:

  • (Array<String>)

Raises:

  • (NotImplementedError)


49
50
51
# File 'lib/langchain/llm/response/base_response.rb', line 49

def completions
  raise NotImplementedError
end

#created_atTime

Returns the timestamp when the response was created

Returns:

  • (Time)

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/langchain/llm/response/base_response.rb', line 19

def created_at
  raise NotImplementedError
end

#embeddingArray<Float>

Return the first embedding

Returns:

  • (Array<Float>)

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/langchain/llm/response/base_response.rb', line 42

def embedding
  raise NotImplementedError
end

#embeddingsArray<Array>

Return the embeddings

Returns:

  • (Array<Array>)

Raises:

  • (NotImplementedError)


63
64
65
# File 'lib/langchain/llm/response/base_response.rb', line 63

def embeddings
  raise NotImplementedError
end

#prompt_tokensInteger

Number of tokens utilized in the prompt

Returns:

  • (Integer)

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/langchain/llm/response/base_response.rb', line 70

def prompt_tokens
  raise NotImplementedError
end

#total_tokensInteger

Total number of tokens utilized

Returns:

  • (Integer)

Raises:

  • (NotImplementedError)


84
85
86
# File 'lib/langchain/llm/response/base_response.rb', line 84

def total_tokens
  raise NotImplementedError
end