Class: MockGraphqlAi::Resource
- Inherits:
-
Object
- Object
- MockGraphqlAi::Resource
- Defined in:
- lib/mock_graphql_ai.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#name ⇒ Object
Returns the value of attribute name.
-
#openai_access_token ⇒ Object
Returns the value of attribute openai_access_token.
-
#query ⇒ Object
Returns the value of attribute query.
-
#response ⇒ Object
Returns the value of attribute response.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Resource
constructor
A new instance of Resource.
- #respond! ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Resource
Returns a new instance of Resource.
9 10 11 12 13 14 |
# File 'lib/mock_graphql_ai.rb', line 9 def initialize(={}) @query = [:query] @openai_access_token = [:token] @temperature = 0.3 @model = "gpt-3.5-turbo" end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
7 8 9 |
# File 'lib/mock_graphql_ai.rb', line 7 def client @client end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/mock_graphql_ai.rb', line 7 def name @name end |
#openai_access_token ⇒ Object
Returns the value of attribute openai_access_token.
7 8 9 |
# File 'lib/mock_graphql_ai.rb', line 7 def openai_access_token @openai_access_token end |
#query ⇒ Object
Returns the value of attribute query.
7 8 9 |
# File 'lib/mock_graphql_ai.rb', line 7 def query @query end |
#response ⇒ Object
Returns the value of attribute response.
7 8 9 |
# File 'lib/mock_graphql_ai.rb', line 7 def response @response end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/mock_graphql_ai.rb', line 7 def type @type end |
Instance Method Details
#respond! ⇒ Object
16 17 18 19 20 |
# File 'lib/mock_graphql_ai.rb', line 16 def respond! @type, @name = grab_query_details initiate_openai_client get_response_from_ai end |