Class: ElevenlabsClient::Endpoints::AgentsPlatform::KnowledgeBase
- Inherits:
-
Object
- Object
- ElevenlabsClient::Endpoints::AgentsPlatform::KnowledgeBase
- Defined in:
- lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb
Instance Method Summary collapse
-
#compute_rag_index(documentation_id, model:) ⇒ Hash
POST /v1/convai/knowledge-base/documentation_id/rag-index Trigger or get status of RAG indexing for a document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/compute-rag-index.
-
#create_from_file(file_io:, filename:, name: nil) ⇒ Hash
POST /v1/convai/knowledge-base/file Create a knowledge base document generated from the uploaded file Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/create-file.
-
#create_from_text(text, name: nil) ⇒ Hash
POST /v1/convai/knowledge-base/text Create a knowledge base document containing the provided text Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/create-text.
-
#create_from_url(url, name: nil) ⇒ Hash
POST /v1/convai/knowledge-base/url Create a knowledge base document generated by scraping the given webpage Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/create-url.
-
#delete(documentation_id, force: false) ⇒ Hash
DELETE /v1/convai/knowledge-base/documentation_id Delete a document from the knowledge base Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/delete.
-
#delete_rag_index(documentation_id, rag_index_id) ⇒ Hash
DELETE /v1/convai/knowledge-base/documentation_id/rag-index/rag_index_id Delete RAG index for the knowledge base document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/delete-rag-index.
-
#get(documentation_id, agent_id: nil) ⇒ Hash
GET /v1/convai/knowledge-base/documentation_id Get details about a specific documentation making up the agent's knowledge base Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get.
-
#get_agent_knowledge_base_size(agent_id) ⇒ Hash
GET /v1/convai/agent/agent_id/knowledge-base/size Returns the number of pages in the agent's knowledge base Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-size.
-
#get_chunk(documentation_id, chunk_id) ⇒ Hash
GET /v1/convai/knowledge-base/documentation_id/chunk/chunk_id Get details about a specific documentation part used by RAG Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-chunk.
-
#get_content(documentation_id) ⇒ String
GET /v1/convai/knowledge-base/documentation_id/content Get the entire content of a document from the knowledge base Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-content.
-
#get_dependent_agents(documentation_id, **options) ⇒ Hash
GET /v1/convai/knowledge-base/documentation_id/dependent-agents Get a list of agents depending on this knowledge base document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-dependent-agents.
-
#get_rag_index(documentation_id) ⇒ Hash
GET /v1/convai/knowledge-base/documentation_id/rag-index Get information about all RAG indexes of the specified document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-rag-index.
-
#get_rag_index_overview ⇒ Hash
GET /v1/convai/knowledge-base/rag-index Get total size and other information of RAG indexes used by knowledge base documents Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-rag-index-overview.
-
#initialize(client) ⇒ KnowledgeBase
constructor
A new instance of KnowledgeBase.
-
#list(**options) ⇒ Hash
GET /v1/convai/knowledge-base Get a list of available knowledge base documents Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/list.
-
#update(documentation_id, name:) ⇒ Hash
PATCH /v1/convai/knowledge-base/documentation_id Update the name of a document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/update.
Constructor Details
#initialize(client) ⇒ KnowledgeBase
Returns a new instance of KnowledgeBase.
7 8 9 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 7 def initialize(client) @client = client end |
Instance Method Details
#compute_rag_index(documentation_id, model:) ⇒ Hash
POST /v1/convai/knowledge-base/documentation_id/rag-index Trigger or get status of RAG indexing for a document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/compute-rag-index
138 139 140 141 142 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 138 def compute_rag_index(documentation_id, model:) endpoint = "/v1/convai/knowledge-base/#{documentation_id}/rag-index" request_body = { model: model } @client.post(endpoint, request_body) end |
#create_from_file(file_io:, filename:, name: nil) ⇒ Hash
POST /v1/convai/knowledge-base/file Create a knowledge base document generated from the uploaded file Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/create-file
120 121 122 123 124 125 126 127 128 129 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 120 def create_from_file(file_io:, filename:, name: nil) endpoint = "/v1/convai/knowledge-base/file" payload = { "file" => @client.file_part(file_io, filename) } payload["name"] = name if name @client.post_multipart(endpoint, payload) end |
#create_from_text(text, name: nil) ⇒ Hash
POST /v1/convai/knowledge-base/text Create a knowledge base document containing the provided text Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/create-text
105 106 107 108 109 110 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 105 def create_from_text(text, name: nil) endpoint = "/v1/convai/knowledge-base/text" request_body = { text: text } request_body[:name] = name if name @client.post(endpoint, request_body) end |
#create_from_url(url, name: nil) ⇒ Hash
POST /v1/convai/knowledge-base/url Create a knowledge base document generated by scraping the given webpage Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/create-url
91 92 93 94 95 96 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 91 def create_from_url(url, name: nil) endpoint = "/v1/convai/knowledge-base/url" request_body = { url: url } request_body[:name] = name if name @client.post(endpoint, request_body) end |
#delete(documentation_id, force: false) ⇒ Hash
DELETE /v1/convai/knowledge-base/documentation_id Delete a document from the knowledge base Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/delete
74 75 76 77 78 79 80 81 82 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 74 def delete(documentation_id, force: false) endpoint = "/v1/convai/knowledge-base/#{documentation_id}" if force endpoint = "#{endpoint}?force=true" end @client.delete(endpoint) end |
#delete_rag_index(documentation_id, rag_index_id) ⇒ Hash
DELETE /v1/convai/knowledge-base/documentation_id/rag-index/rag_index_id Delete RAG index for the knowledge base document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/delete-rag-index
162 163 164 165 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 162 def delete_rag_index(documentation_id, rag_index_id) endpoint = "/v1/convai/knowledge-base/#{documentation_id}/rag-index/#{rag_index_id}" @client.delete(endpoint) end |
#get(documentation_id, agent_id: nil) ⇒ Hash
GET /v1/convai/knowledge-base/documentation_id Get details about a specific documentation making up the agent's knowledge base Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get
44 45 46 47 48 49 50 51 52 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 44 def get(documentation_id, agent_id: nil) endpoint = "/v1/convai/knowledge-base/#{documentation_id}" if agent_id endpoint = "#{endpoint}?agent_id=#{agent_id}" end @client.get(endpoint) end |
#get_agent_knowledge_base_size(agent_id) ⇒ Hash
GET /v1/convai/agent/agent_id/knowledge-base/size Returns the number of pages in the agent's knowledge base Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-size
227 228 229 230 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 227 def get_agent_knowledge_base_size(agent_id) endpoint = "/v1/convai/agent/#{agent_id}/knowledge-base/size" @client.get(endpoint) end |
#get_chunk(documentation_id, chunk_id) ⇒ Hash
GET /v1/convai/knowledge-base/documentation_id/chunk/chunk_id Get details about a specific documentation part used by RAG Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-chunk
216 217 218 219 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 216 def get_chunk(documentation_id, chunk_id) endpoint = "/v1/convai/knowledge-base/#{documentation_id}/chunk/#{chunk_id}" @client.get(endpoint) end |
#get_content(documentation_id) ⇒ String
GET /v1/convai/knowledge-base/documentation_id/content Get the entire content of a document from the knowledge base Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-content
204 205 206 207 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 204 def get_content(documentation_id) endpoint = "/v1/convai/knowledge-base/#{documentation_id}/content" @client.get(endpoint) end |
#get_dependent_agents(documentation_id, **options) ⇒ Hash
GET /v1/convai/knowledge-base/documentation_id/dependent-agents Get a list of agents depending on this knowledge base document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-dependent-agents
186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 186 def get_dependent_agents(documentation_id, **) endpoint = "/v1/convai/knowledge-base/#{documentation_id}/dependent-agents" query_params = .compact if query_params.any? query_string = URI.encode_www_form(query_params) endpoint = "#{endpoint}?#{query_string}" end @client.get(endpoint) end |
#get_rag_index(documentation_id) ⇒ Hash
GET /v1/convai/knowledge-base/documentation_id/rag-index Get information about all RAG indexes of the specified document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-rag-index
150 151 152 153 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 150 def get_rag_index(documentation_id) endpoint = "/v1/convai/knowledge-base/#{documentation_id}/rag-index" @client.get(endpoint) end |
#get_rag_index_overview ⇒ Hash
GET /v1/convai/knowledge-base/rag-index Get total size and other information of RAG indexes used by knowledge base documents Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/get-rag-index-overview
172 173 174 175 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 172 def get_rag_index_overview endpoint = "/v1/convai/knowledge-base/rag-index" @client.get(endpoint) end |
#list(**options) ⇒ Hash
GET /v1/convai/knowledge-base Get a list of available knowledge base documents Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/list
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 25 def list(**) endpoint = "/v1/convai/knowledge-base" query_params = .compact if query_params.any? query_string = URI.encode_www_form(query_params) endpoint = "#{endpoint}?#{query_string}" end @client.get(endpoint) end |
#update(documentation_id, name:) ⇒ Hash
PATCH /v1/convai/knowledge-base/documentation_id Update the name of a document Documentation: https://elevenlabs.io/docs/api-reference/convai/knowledge-base/update
61 62 63 64 65 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb', line 61 def update(documentation_id, name:) endpoint = "/v1/convai/knowledge-base/#{documentation_id}" request_body = { name: name } @client.patch(endpoint, request_body) end |