Class: Maglev::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/maglev/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/maglev/configuration.rb', line 25

def initialize
  @embedding_provider = ProviderConfiguration.new(
    url: "https://api.openai.com/v1",
    model: "text-embedding-3-small",
    dimensions: 1536
  )
  @generation_provider = ProviderConfiguration.new(
    url: "https://api.openai.com/v1",
    model: "gpt-4.1-mini"
  )
  @chunk_size = 1000
  @context_max_characters = 4000
  @context_per_owner_characters = 1200
  @explain_question = "Explain what the available knowledge says about this record."
  @max_relation_depth = 3
  @attachment_allowed_content_types = ["text/plain", "text/markdown", "text/html", "application/xhtml+xml"]
  @attachment_max_bytes = 5 * 1024 * 1024
  @attachment_max_characters = 20_000
  @provider_max_attempts = 2
  @provider_timeout = 30
  @source_redactor = nil
end

Instance Attribute Details

#attachment_allowed_content_typesObject

Returns the value of attribute attachment_allowed_content_types.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def attachment_allowed_content_types
  @attachment_allowed_content_types
end

#attachment_extractorObject

Returns the value of attribute attachment_extractor.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def attachment_extractor
  @attachment_extractor
end

#attachment_max_bytesObject

Returns the value of attribute attachment_max_bytes.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def attachment_max_bytes
  @attachment_max_bytes
end

#attachment_max_charactersObject

Returns the value of attribute attachment_max_characters.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def attachment_max_characters
  @attachment_max_characters
end

#authorization_adapterObject

Returns the value of attribute authorization_adapter.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def authorization_adapter
  @authorization_adapter
end

#chunk_sizeObject

Returns the value of attribute chunk_size.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def chunk_size
  @chunk_size
end

#context_max_charactersObject

Returns the value of attribute context_max_characters.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def context_max_characters
  @context_max_characters
end

#context_per_owner_charactersObject

Returns the value of attribute context_per_owner_characters.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def context_per_owner_characters
  @context_per_owner_characters
end

#embedding_adapterObject

Returns the value of attribute embedding_adapter.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def embedding_adapter
  @embedding_adapter
end

#explain_questionObject

Returns the value of attribute explain_question.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def explain_question
  @explain_question
end

#generation_adapterObject

Returns the value of attribute generation_adapter.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def generation_adapter
  @generation_adapter
end

#loggerObject

Returns the value of attribute logger.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def logger
  @logger
end

#max_relation_depthObject

Returns the value of attribute max_relation_depth.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def max_relation_depth
  @max_relation_depth
end

#provider_max_attemptsObject

Returns the value of attribute provider_max_attempts.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def provider_max_attempts
  @provider_max_attempts
end

#provider_timeoutObject

Returns the value of attribute provider_timeout.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def provider_timeout
  @provider_timeout
end

#source_redactorObject

Returns the value of attribute source_redactor.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def source_redactor
  @source_redactor
end

#vector_storeObject

Returns the value of attribute vector_store.



17
18
19
# File 'lib/maglev/configuration.rb', line 17

def vector_store
  @vector_store
end

Instance Method Details

#embedding_dimensionsObject



64
# File 'lib/maglev/configuration.rb', line 64

def embedding_dimensions = @embedding_provider.dimensions

#embedding_dimensions=(dimensions) ⇒ Object



66
67
68
# File 'lib/maglev/configuration.rb', line 66

def embedding_dimensions=(dimensions)
  @embedding_provider.dimensions = dimensions
end

#embedding_modelObject



58
# File 'lib/maglev/configuration.rb', line 58

def embedding_model = @embedding_provider.model

#embedding_model=(model) ⇒ Object



60
61
62
# File 'lib/maglev/configuration.rb', line 60

def embedding_model=(model)
  @embedding_provider.model = model
end

#embedding_provider {|@embedding_provider| ... } ⇒ Object

Yields:



48
49
50
51
# File 'lib/maglev/configuration.rb', line 48

def embedding_provider
  yield @embedding_provider if block_given?
  @embedding_provider
end

#generation_modelObject



70
# File 'lib/maglev/configuration.rb', line 70

def generation_model = @generation_provider.model

#generation_model=(model) ⇒ Object



72
73
74
# File 'lib/maglev/configuration.rb', line 72

def generation_model=(model)
  @generation_provider.model = model
end

#generation_provider {|@generation_provider| ... } ⇒ Object

Yields:



53
54
55
56
# File 'lib/maglev/configuration.rb', line 53

def generation_provider
  yield @generation_provider if block_given?
  @generation_provider
end