carbon_ruby_sdk 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +89 -0
- data/README.md +2325 -0
- data/Rakefile +10 -0
- data/carbon_ruby_sdk.gemspec +39 -0
- data/header.png +0 -0
- data/lib/carbon_ruby_sdk/api/auth_api.rb +177 -0
- data/lib/carbon_ruby_sdk/api/data_sources_api.rb +217 -0
- data/lib/carbon_ruby_sdk/api/embeddings_api.rb +565 -0
- data/lib/carbon_ruby_sdk/api/files_api.rb +1526 -0
- data/lib/carbon_ruby_sdk/api/health_api.rb +92 -0
- data/lib/carbon_ruby_sdk/api/integrations_api.rb +2201 -0
- data/lib/carbon_ruby_sdk/api/organizations_api.rb +92 -0
- data/lib/carbon_ruby_sdk/api/users_api.rb +209 -0
- data/lib/carbon_ruby_sdk/api/utilities_api.rb +710 -0
- data/lib/carbon_ruby_sdk/api/webhooks_api.rb +296 -0
- data/lib/carbon_ruby_sdk/api_client.rb +436 -0
- data/lib/carbon_ruby_sdk/api_client_custom.rb +14 -0
- data/lib/carbon_ruby_sdk/api_error.rb +53 -0
- data/lib/carbon_ruby_sdk/configuration.rb +354 -0
- data/lib/carbon_ruby_sdk/models/add_webhook_props.rb +220 -0
- data/lib/carbon_ruby_sdk/models/body_create_upload_file_uploadfile_post.rb +220 -0
- data/lib/carbon_ruby_sdk/models/chunk_properties.rb +248 -0
- data/lib/carbon_ruby_sdk/models/chunk_properties_nullable.rb +248 -0
- data/lib/carbon_ruby_sdk/models/chunks_and_embeddings.rb +246 -0
- data/lib/carbon_ruby_sdk/models/chunks_and_embeddings_upload_input.rb +247 -0
- data/lib/carbon_ruby_sdk/models/data_source_last_sync_actions.rb +38 -0
- data/lib/carbon_ruby_sdk/models/data_source_sync_statuses.rb +38 -0
- data/lib/carbon_ruby_sdk/models/data_source_type.rb +76 -0
- data/lib/carbon_ruby_sdk/models/data_source_type_nullable.rb +76 -0
- data/lib/carbon_ruby_sdk/models/delete_files_query_input.rb +252 -0
- data/lib/carbon_ruby_sdk/models/directory_item.rb +266 -0
- data/lib/carbon_ruby_sdk/models/document_response.rb +328 -0
- data/lib/carbon_ruby_sdk/models/document_response_list.rb +222 -0
- data/lib/carbon_ruby_sdk/models/embedding_and_chunk.rb +256 -0
- data/lib/carbon_ruby_sdk/models/embedding_generators.rb +43 -0
- data/lib/carbon_ruby_sdk/models/embedding_generators_nullable.rb +43 -0
- data/lib/carbon_ruby_sdk/models/embedding_properties.rb +226 -0
- data/lib/carbon_ruby_sdk/models/embeddings_and_chunks_filters.rb +232 -0
- data/lib/carbon_ruby_sdk/models/embeddings_and_chunks_order_by_columns.rb +37 -0
- data/lib/carbon_ruby_sdk/models/embeddings_and_chunks_query_input.rb +262 -0
- data/lib/carbon_ruby_sdk/models/embeddings_and_chunks_response.rb +236 -0
- data/lib/carbon_ruby_sdk/models/external_file_sync_statuses.rb +43 -0
- data/lib/carbon_ruby_sdk/models/external_source_item.rb +420 -0
- data/lib/carbon_ruby_sdk/models/fetch_urls_response.rb +236 -0
- data/lib/carbon_ruby_sdk/models/file_content_types.rb +36 -0
- data/lib/carbon_ruby_sdk/models/file_content_types_nullable.rb +36 -0
- data/lib/carbon_ruby_sdk/models/file_formats.rb +76 -0
- data/lib/carbon_ruby_sdk/models/file_formats_nullable.rb +76 -0
- data/lib/carbon_ruby_sdk/models/file_statistics.rb +256 -0
- data/lib/carbon_ruby_sdk/models/file_statistics_nullable.rb +256 -0
- data/lib/carbon_ruby_sdk/models/fresh_desk_connect_request.rb +316 -0
- data/lib/carbon_ruby_sdk/models/generic_success_response.rb +220 -0
- data/lib/carbon_ruby_sdk/models/get_embedding_documents_body.rb +416 -0
- data/lib/carbon_ruby_sdk/models/gitbook_connect_request.rb +234 -0
- data/lib/carbon_ruby_sdk/models/gitbook_sync_request.rb +336 -0
- data/lib/carbon_ruby_sdk/models/gmail_sync_input.rb +301 -0
- data/lib/carbon_ruby_sdk/models/http_validation_error.rb +217 -0
- data/lib/carbon_ruby_sdk/models/hybrid_search_tuning_params.rb +234 -0
- data/lib/carbon_ruby_sdk/models/hybrid_search_tuning_params_nullable.rb +235 -0
- data/lib/carbon_ruby_sdk/models/list_data_source_items_request.rb +239 -0
- data/lib/carbon_ruby_sdk/models/list_data_source_items_response.rb +236 -0
- data/lib/carbon_ruby_sdk/models/list_request.rb +230 -0
- data/lib/carbon_ruby_sdk/models/list_response.rb +222 -0
- data/lib/carbon_ruby_sdk/models/location_property_inner.rb +226 -0
- data/lib/carbon_ruby_sdk/models/modify_user_configuration_input.rb +234 -0
- data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +362 -0
- data/lib/carbon_ruby_sdk/models/order_dir.rb +36 -0
- data/lib/carbon_ruby_sdk/models/organization_response.rb +362 -0
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_api.rb +380 -0
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_filters.rb +238 -0
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_order_by_columns.rb +36 -0
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_query_input.rb +246 -0
- data/lib/carbon_ruby_sdk/models/organization_user_data_source_response.rb +236 -0
- data/lib/carbon_ruby_sdk/models/organization_user_file_tag_create.rb +236 -0
- data/lib/carbon_ruby_sdk/models/organization_user_file_tags_remove.rb +236 -0
- data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_filters.rb +330 -0
- data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_order_by_types.rb +39 -0
- data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_query_input.rb +276 -0
- data/lib/carbon_ruby_sdk/models/outlook_sync_input.rb +313 -0
- data/lib/carbon_ruby_sdk/models/pagination.rb +228 -0
- data/lib/carbon_ruby_sdk/models/presigned_url_response.rb +220 -0
- data/lib/carbon_ruby_sdk/models/rank_property.rb +226 -0
- data/lib/carbon_ruby_sdk/models/raw_text_input.rb +295 -0
- data/lib/carbon_ruby_sdk/models/raw_transcript_property_inner_value.rb +226 -0
- data/lib/carbon_ruby_sdk/models/resync_file_query_input.rb +240 -0
- data/lib/carbon_ruby_sdk/models/revoke_access_token_input.rb +220 -0
- data/lib/carbon_ruby_sdk/models/rss_feed_input.rb +301 -0
- data/lib/carbon_ruby_sdk/models/s3_auth_request.rb +234 -0
- data/lib/carbon_ruby_sdk/models/s3_file_sync_input.rb +313 -0
- data/lib/carbon_ruby_sdk/models/s3_get_file_input.rb +226 -0
- data/lib/carbon_ruby_sdk/models/single_chunks_and_embeddings_upload_input.rb +256 -0
- data/lib/carbon_ruby_sdk/models/sitemap_scrape_request.rb +361 -0
- data/lib/carbon_ruby_sdk/models/source_property.rb +226 -0
- data/lib/carbon_ruby_sdk/models/sync_directory_request.rb +220 -0
- data/lib/carbon_ruby_sdk/models/sync_files_request.rb +328 -0
- data/lib/carbon_ruby_sdk/models/tags.rb +232 -0
- data/lib/carbon_ruby_sdk/models/tags1.rb +230 -0
- data/lib/carbon_ruby_sdk/models/text_embedding_generators.rb +42 -0
- data/lib/carbon_ruby_sdk/models/token_response.rb +234 -0
- data/lib/carbon_ruby_sdk/models/upload_file_from_url_input.rb +326 -0
- data/lib/carbon_ruby_sdk/models/user_file.rb +524 -0
- data/lib/carbon_ruby_sdk/models/user_files_v2.rb +236 -0
- data/lib/carbon_ruby_sdk/models/user_request_content.rb +220 -0
- data/lib/carbon_ruby_sdk/models/user_response.rb +354 -0
- data/lib/carbon_ruby_sdk/models/validation_error.rb +250 -0
- data/lib/carbon_ruby_sdk/models/webhook.rb +290 -0
- data/lib/carbon_ruby_sdk/models/webhook_filters.rb +218 -0
- data/lib/carbon_ruby_sdk/models/webhook_no_key.rb +276 -0
- data/lib/carbon_ruby_sdk/models/webhook_order_by_columns.rb +36 -0
- data/lib/carbon_ruby_sdk/models/webhook_query_input.rb +246 -0
- data/lib/carbon_ruby_sdk/models/webhook_query_response.rb +236 -0
- data/lib/carbon_ruby_sdk/models/webscrape_request.rb +375 -0
- data/lib/carbon_ruby_sdk/models/white_labeling_response.rb +234 -0
- data/lib/carbon_ruby_sdk/models/youtube_transcript_response.rb +252 -0
- data/lib/carbon_ruby_sdk/version.rb +11 -0
- data/lib/carbon_ruby_sdk.rb +207 -0
- data/spec/api/auth_api_spec.rb +50 -0
- data/spec/api/data_sources_api_spec.rb +51 -0
- data/spec/api/embeddings_api_spec.rb +63 -0
- data/spec/api/files_api_spec.rb +178 -0
- data/spec/api/health_api_spec.rb +39 -0
- data/spec/api/integrations_api_spec.rb +226 -0
- data/spec/api/organizations_api_spec.rb +39 -0
- data/spec/api/users_api_spec.rb +51 -0
- data/spec/api/utilities_api_spec.rb +102 -0
- data/spec/api/webhooks_api_spec.rb +62 -0
- data/spec/api_client_spec.rb +191 -0
- data/spec/configuration_spec.rb +38 -0
- data/spec/getting_started_spec.rb +196 -0
- data/spec/models/add_webhook_props_spec.rb +28 -0
- data/spec/models/body_create_upload_file_uploadfile_post_spec.rb +28 -0
- data/spec/models/chunk_properties_nullable_spec.rb +40 -0
- data/spec/models/chunk_properties_spec.rb +40 -0
- data/spec/models/chunks_and_embeddings_spec.rb +40 -0
- data/spec/models/chunks_and_embeddings_upload_input_spec.rb +40 -0
- data/spec/models/data_source_last_sync_actions_spec.rb +22 -0
- data/spec/models/data_source_sync_statuses_spec.rb +22 -0
- data/spec/models/data_source_type_nullable_spec.rb +22 -0
- data/spec/models/data_source_type_spec.rb +22 -0
- data/spec/models/delete_files_query_input_spec.rb +46 -0
- data/spec/models/directory_item_spec.rb +46 -0
- data/spec/models/document_response_list_spec.rb +28 -0
- data/spec/models/document_response_spec.rb +88 -0
- data/spec/models/embedding_and_chunk_spec.rb +46 -0
- data/spec/models/embedding_generators_nullable_spec.rb +22 -0
- data/spec/models/embedding_generators_spec.rb +22 -0
- data/spec/models/embedding_properties_spec.rb +34 -0
- data/spec/models/embeddings_and_chunks_filters_spec.rb +34 -0
- data/spec/models/embeddings_and_chunks_order_by_columns_spec.rb +22 -0
- data/spec/models/embeddings_and_chunks_query_input_spec.rb +52 -0
- data/spec/models/embeddings_and_chunks_response_spec.rb +34 -0
- data/spec/models/external_file_sync_statuses_spec.rb +22 -0
- data/spec/models/external_source_item_spec.rb +124 -0
- data/spec/models/fetch_urls_response_spec.rb +34 -0
- data/spec/models/file_content_types_nullable_spec.rb +22 -0
- data/spec/models/file_content_types_spec.rb +22 -0
- data/spec/models/file_formats_nullable_spec.rb +22 -0
- data/spec/models/file_formats_spec.rb +22 -0
- data/spec/models/file_statistics_nullable_spec.rb +52 -0
- data/spec/models/file_statistics_spec.rb +52 -0
- data/spec/models/fresh_desk_connect_request_spec.rb +76 -0
- data/spec/models/generic_success_response_spec.rb +28 -0
- data/spec/models/get_embedding_documents_body_spec.rb +106 -0
- data/spec/models/gitbook_connect_request_spec.rb +34 -0
- data/spec/models/gitbook_sync_request_spec.rb +76 -0
- data/spec/models/gmail_sync_input_spec.rb +70 -0
- data/spec/models/http_validation_error_spec.rb +28 -0
- data/spec/models/hybrid_search_tuning_params_nullable_spec.rb +34 -0
- data/spec/models/hybrid_search_tuning_params_spec.rb +34 -0
- data/spec/models/list_data_source_items_request_spec.rb +40 -0
- data/spec/models/list_data_source_items_response_spec.rb +34 -0
- data/spec/models/list_request_spec.rb +34 -0
- data/spec/models/list_response_spec.rb +28 -0
- data/spec/models/location_property_inner_spec.rb +22 -0
- data/spec/models/modify_user_configuration_input_spec.rb +34 -0
- data/spec/models/o_auth_url_request_spec.rb +106 -0
- data/spec/models/order_dir_spec.rb +22 -0
- data/spec/models/organization_response_spec.rb +94 -0
- data/spec/models/organization_user_data_source_api_spec.rb +100 -0
- data/spec/models/organization_user_data_source_filters_spec.rb +40 -0
- data/spec/models/organization_user_data_source_order_by_columns_spec.rb +22 -0
- data/spec/models/organization_user_data_source_query_input_spec.rb +46 -0
- data/spec/models/organization_user_data_source_response_spec.rb +34 -0
- data/spec/models/organization_user_file_tag_create_spec.rb +34 -0
- data/spec/models/organization_user_file_tags_remove_spec.rb +34 -0
- data/spec/models/organization_user_files_to_sync_filters_spec.rb +88 -0
- data/spec/models/organization_user_files_to_sync_order_by_types_spec.rb +22 -0
- data/spec/models/organization_user_files_to_sync_query_input_spec.rb +64 -0
- data/spec/models/outlook_sync_input_spec.rb +76 -0
- data/spec/models/pagination_spec.rb +34 -0
- data/spec/models/presigned_url_response_spec.rb +28 -0
- data/spec/models/rank_property_spec.rb +22 -0
- data/spec/models/raw_text_input_spec.rb +70 -0
- data/spec/models/raw_transcript_property_inner_value_spec.rb +22 -0
- data/spec/models/resync_file_query_input_spec.rb +40 -0
- data/spec/models/revoke_access_token_input_spec.rb +28 -0
- data/spec/models/rss_feed_input_spec.rb +70 -0
- data/spec/models/s3_auth_request_spec.rb +34 -0
- data/spec/models/s3_file_sync_input_spec.rb +76 -0
- data/spec/models/s3_get_file_input_spec.rb +34 -0
- data/spec/models/single_chunks_and_embeddings_upload_input_spec.rb +46 -0
- data/spec/models/sitemap_scrape_request_spec.rb +100 -0
- data/spec/models/source_property_spec.rb +22 -0
- data/spec/models/sync_directory_request_spec.rb +28 -0
- data/spec/models/sync_files_request_spec.rb +82 -0
- data/spec/models/tags1_spec.rb +22 -0
- data/spec/models/tags_spec.rb +22 -0
- data/spec/models/text_embedding_generators_spec.rb +22 -0
- data/spec/models/token_response_spec.rb +34 -0
- data/spec/models/upload_file_from_url_input_spec.rb +88 -0
- data/spec/models/user_file_spec.rb +190 -0
- data/spec/models/user_files_v2_spec.rb +34 -0
- data/spec/models/user_request_content_spec.rb +28 -0
- data/spec/models/user_response_spec.rb +88 -0
- data/spec/models/validation_error_spec.rb +40 -0
- data/spec/models/webhook_filters_spec.rb +28 -0
- data/spec/models/webhook_no_key_spec.rb +52 -0
- data/spec/models/webhook_order_by_columns_spec.rb +22 -0
- data/spec/models/webhook_query_input_spec.rb +46 -0
- data/spec/models/webhook_query_response_spec.rb +34 -0
- data/spec/models/webhook_spec.rb +58 -0
- data/spec/models/webscrape_request_spec.rb +106 -0
- data/spec/models/white_labeling_response_spec.rb +34 -0
- data/spec/models/youtube_transcript_response_spec.rb +46 -0
- data/spec/spec_helper.rb +107 -0
- metadata +440 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'spec_helper'
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
# Unit tests for Carbon::OrganizationsApi
|
13
|
+
describe 'OrganizationsApi' do
|
14
|
+
before do
|
15
|
+
# run before each test
|
16
|
+
@api_instance = Carbon::OrganizationsApi.new
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
# run after each test
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'test an instance of OrganizationsApi' do
|
24
|
+
it 'should create an instance of OrganizationsApi' do
|
25
|
+
expect(@api_instance).to be_instance_of(Carbon::OrganizationsApi)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# unit tests for get
|
30
|
+
# Get Organization
|
31
|
+
# @param [Hash] opts the optional parameters
|
32
|
+
# @return [OrganizationResponse]
|
33
|
+
describe 'get test' do
|
34
|
+
it 'should work' do
|
35
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'spec_helper'
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
# Unit tests for Carbon::UsersApi
|
13
|
+
describe 'UsersApi' do
|
14
|
+
before do
|
15
|
+
# run before each test
|
16
|
+
@api_instance = Carbon::UsersApi.new
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
# run after each test
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'test an instance of UsersApi' do
|
24
|
+
it 'should create an instance of UsersApi' do
|
25
|
+
expect(@api_instance).to be_instance_of(Carbon::UsersApi)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# unit tests for get
|
30
|
+
# User Endpoint
|
31
|
+
# @param user_request_content
|
32
|
+
# @param [Hash] opts the optional parameters
|
33
|
+
# @return [UserResponse]
|
34
|
+
describe 'get test' do
|
35
|
+
it 'should work' do
|
36
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# unit tests for toggle_user_features
|
41
|
+
# Toggle User Features
|
42
|
+
# @param modify_user_configuration_input
|
43
|
+
# @param [Hash] opts the optional parameters
|
44
|
+
# @return [GenericSuccessResponse]
|
45
|
+
describe 'toggle_user_features test' do
|
46
|
+
it 'should work' do
|
47
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'spec_helper'
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
# Unit tests for Carbon::UtilitiesApi
|
13
|
+
describe 'UtilitiesApi' do
|
14
|
+
before do
|
15
|
+
# run before each test
|
16
|
+
@api_instance = Carbon::UtilitiesApi.new
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
# run after each test
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'test an instance of UtilitiesApi' do
|
24
|
+
it 'should create an instance of UtilitiesApi' do
|
25
|
+
expect(@api_instance).to be_instance_of(Carbon::UtilitiesApi)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# unit tests for fetch_urls
|
30
|
+
# Fetch Urls
|
31
|
+
# Extracts all URLs from a webpage. Args: url (str): URL of the webpage Returns: FetchURLsResponse: A response object with a list of URLs extracted from the webpage and the webpage content.
|
32
|
+
# @param url
|
33
|
+
# @param [Hash] opts the optional parameters
|
34
|
+
# @return [FetchURLsResponse]
|
35
|
+
describe 'fetch_urls test' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# unit tests for fetch_youtube_transcripts
|
42
|
+
# Fetch Youtube Transcripts
|
43
|
+
# Fetches english transcripts from YouTube videos. Args: id (str): The ID of the YouTube video. raw (bool): Whether to return the raw transcript or not. Defaults to False. Returns: dict: A dictionary with the transcript of the YouTube video.
|
44
|
+
# @param id
|
45
|
+
# @param [Hash] opts the optional parameters
|
46
|
+
# @option opts [Boolean] :raw
|
47
|
+
# @return [YoutubeTranscriptResponse]
|
48
|
+
describe 'fetch_youtube_transcripts test' do
|
49
|
+
it 'should work' do
|
50
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# unit tests for process_sitemap
|
55
|
+
# Sitemap
|
56
|
+
# Retrieves all URLs from a sitemap, which can subsequently be utilized with our `web_scrape` endpoint. <!--Args: url (str): URL of the sitemap Returns: dict: A dictionary with a list of URLs extracted from the sitemap.-->
|
57
|
+
# @param url
|
58
|
+
# @param [Hash] opts the optional parameters
|
59
|
+
# @return [Object]
|
60
|
+
describe 'process_sitemap test' do
|
61
|
+
it 'should work' do
|
62
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# unit tests for scrape_sitemap
|
67
|
+
# Scrape Sitemap
|
68
|
+
# Extracts all URLs from a sitemap and performs a web scrape on each of them. Args: sitemap_url (str): URL of the sitemap Returns: dict: A response object with the status of the scraping job message.-->
|
69
|
+
# @param sitemap_scrape_request
|
70
|
+
# @param [Hash] opts the optional parameters
|
71
|
+
# @return [Object]
|
72
|
+
describe 'scrape_sitemap test' do
|
73
|
+
it 'should work' do
|
74
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# unit tests for scrape_web
|
79
|
+
# Web Scrape
|
80
|
+
# Conduct a web scrape on a given webpage URL. Our web scraper is fully compatible with JavaScript and supports recursion depth, enabling you to efficiently extract all content from the target website. <!--Args: scraping_requests (List[WebscrapeRequest]): A list of WebscrapeRequest objects. Returns: dict: A response object with the status of the scraping job message.-->
|
81
|
+
# @param webscrape_request
|
82
|
+
# @param [Hash] opts the optional parameters
|
83
|
+
# @return [Object]
|
84
|
+
describe 'scrape_web test' do
|
85
|
+
it 'should work' do
|
86
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# unit tests for search_urls
|
91
|
+
# Search Urls
|
92
|
+
# Perform a web search and obtain a list of relevant URLs. As an illustration, when you perform a search for “content related to MRNA,” you will receive a list of links such as the following: - https://tomrenz.substack.com/p/mrna-and-why-it-matters - https://www.statnews.com/2020/11/10/the-story-of-mrna-how-a-once-dismissed-idea-became-a-leading-technology-in-the-covid-vaccine-race/ - https://www.statnews.com/2022/11/16/covid-19-vaccines-were-a-success-but-mrna-still-has-a-delivery-problem/ - https://joomi.substack.com/p/were-still-being-misled-about-how Subsequently, you can submit these links to the web_scrape endpoint in order to retrieve the content of the respective web pages. Args: query (str): Query to search for Returns: FetchURLsResponse: A response object with a list of URLs for a given search query.
|
93
|
+
# @param query
|
94
|
+
# @param [Hash] opts the optional parameters
|
95
|
+
# @return [FetchURLsResponse]
|
96
|
+
describe 'search_urls test' do
|
97
|
+
it 'should work' do
|
98
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'spec_helper'
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
# Unit tests for Carbon::WebhooksApi
|
13
|
+
describe 'WebhooksApi' do
|
14
|
+
before do
|
15
|
+
# run before each test
|
16
|
+
@api_instance = Carbon::WebhooksApi.new
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
# run after each test
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'test an instance of WebhooksApi' do
|
24
|
+
it 'should create an instance of WebhooksApi' do
|
25
|
+
expect(@api_instance).to be_instance_of(Carbon::WebhooksApi)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# unit tests for add_url
|
30
|
+
# Add Webhook Url
|
31
|
+
# @param add_webhook_props
|
32
|
+
# @param [Hash] opts the optional parameters
|
33
|
+
# @return [Webhook]
|
34
|
+
describe 'add_url test' do
|
35
|
+
it 'should work' do
|
36
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# unit tests for delete_url
|
41
|
+
# Delete Webhook Url
|
42
|
+
# @param webhook_id
|
43
|
+
# @param [Hash] opts the optional parameters
|
44
|
+
# @return [GenericSuccessResponse]
|
45
|
+
describe 'delete_url test' do
|
46
|
+
it 'should work' do
|
47
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# unit tests for urls
|
52
|
+
# Webhook Urls
|
53
|
+
# @param webhook_query_input
|
54
|
+
# @param [Hash] opts the optional parameters
|
55
|
+
# @return [WebhookQueryResponse]
|
56
|
+
describe 'urls test' do
|
57
|
+
it 'should work' do
|
58
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'spec_helper'
|
10
|
+
|
11
|
+
describe Carbon::ApiClient do
|
12
|
+
context 'initialization' do
|
13
|
+
context 'URL stuff' do
|
14
|
+
context 'host' do
|
15
|
+
it 'removes http from host' do
|
16
|
+
|
17
|
+
configuration = Carbon::Configuration.new
|
18
|
+
configuration.host = 'http://example.com'
|
19
|
+
expect(configuration.host).to eq('example.com')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'removes https from host' do
|
23
|
+
configuration = Carbon::Configuration.new
|
24
|
+
configuration.host = 'https://wookiee.com'
|
25
|
+
expect(configuration.host).to eq('wookiee.com')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'removes trailing path from host' do
|
29
|
+
configuration = Carbon::Configuration.new
|
30
|
+
configuration.host = 'hello.com/v4'
|
31
|
+
expect(configuration.host).to eq('hello.com')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
configuration = Carbon::Configuration.new
|
38
|
+
configuration.base_path = 'v4/dog'
|
39
|
+
expect(configuration.base_path).to eq('/v4/dog')
|
40
|
+
end
|
41
|
+
|
42
|
+
it "doesn't prepend a slash if one is already there" do
|
43
|
+
configuration = Carbon::Configuration.new
|
44
|
+
configuration.base_path = '/v4/dog'
|
45
|
+
expect(configuration.base_path).to eq('/v4/dog')
|
46
|
+
end
|
47
|
+
|
48
|
+
it "ends up as a blank string if nil" do
|
49
|
+
configuration = Carbon::Configuration.new
|
50
|
+
configuration.base_path = nil
|
51
|
+
expect(configuration.base_path).to eq('')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '#deserialize' do
|
58
|
+
it "handles Array<Integer>" do
|
59
|
+
api_client = Carbon::ApiClient.new
|
60
|
+
headers = { 'Content-Type' => 'application/json' }
|
61
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
62
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
63
|
+
expect(data).to be_instance_of(Array)
|
64
|
+
expect(data).to eq([12, 34])
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'handles Array<Array<Integer>>' do
|
68
|
+
api_client = Carbon::ApiClient.new
|
69
|
+
headers = { 'Content-Type' => 'application/json' }
|
70
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
71
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
72
|
+
expect(data).to be_instance_of(Array)
|
73
|
+
expect(data).to eq([[12, 34], [56]])
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'handles Hash<String, String>' do
|
77
|
+
api_client = Carbon::ApiClient.new
|
78
|
+
headers = { 'Content-Type' => 'application/json' }
|
79
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
80
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
81
|
+
expect(data).to be_instance_of(Hash)
|
82
|
+
expect(data).to eq(:message => 'Hello')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "#object_to_hash" do
|
87
|
+
it 'ignores nils and includes empty arrays' do
|
88
|
+
# uncomment below to test object_to_hash for model
|
89
|
+
# api_client = Carbon::ApiClient.new
|
90
|
+
# _model = Carbon::ModelName.new
|
91
|
+
# update the model attribute below
|
92
|
+
# _model.id = 1
|
93
|
+
# update the expected value (hash) below
|
94
|
+
# expected = {id: 1, name: '', tags: []}
|
95
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe '#build_collection_param' do
|
100
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
101
|
+
let(:api_client) { Carbon::ApiClient.new }
|
102
|
+
|
103
|
+
it 'works for csv' do
|
104
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'works for ssv' do
|
108
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'works for tsv' do
|
112
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'works for pipes' do
|
116
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'works for multi' do
|
120
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'fails for invalid collection format' do
|
124
|
+
expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#json_mime?' do
|
129
|
+
let(:api_client) { Carbon::ApiClient.new }
|
130
|
+
|
131
|
+
it 'works' do
|
132
|
+
expect(api_client.json_mime?(nil)).to eq false
|
133
|
+
expect(api_client.json_mime?('')).to eq false
|
134
|
+
|
135
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
136
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
137
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
138
|
+
|
139
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
140
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
141
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe '#select_header_accept' do
|
146
|
+
let(:api_client) { Carbon::ApiClient.new }
|
147
|
+
|
148
|
+
it 'works' do
|
149
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
150
|
+
expect(api_client.select_header_accept([])).to be_nil
|
151
|
+
|
152
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
153
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
154
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
155
|
+
|
156
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
157
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
describe '#select_header_content_type' do
|
162
|
+
let(:api_client) { Carbon::ApiClient.new }
|
163
|
+
|
164
|
+
it 'works' do
|
165
|
+
expect(api_client.select_header_content_type(nil)).to be_nil
|
166
|
+
expect(api_client.select_header_content_type([])).to be_nil
|
167
|
+
|
168
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
169
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
170
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
171
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
172
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
describe '#sanitize_filename' do
|
177
|
+
let(:api_client) { Carbon::ApiClient.new }
|
178
|
+
|
179
|
+
it 'works' do
|
180
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
181
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
182
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
183
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
184
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
185
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
186
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
187
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
188
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'spec_helper'
|
10
|
+
|
11
|
+
describe Carbon::Configuration do
|
12
|
+
let(:config) { Carbon::Configuration.default }
|
13
|
+
|
14
|
+
before(:each) do
|
15
|
+
# uncomment below to setup host and base_path
|
16
|
+
# require 'URI'
|
17
|
+
# uri = URI.parse("https://api.carbon.ai")
|
18
|
+
# Carbon.configure do |c|
|
19
|
+
# c.host = uri.host
|
20
|
+
# c.base_path = uri.path
|
21
|
+
# end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#base_url' do
|
25
|
+
it 'should have the default value' do
|
26
|
+
# uncomment below to test default value of the base path
|
27
|
+
# expect(config.base_url).to eq("https://api.carbon.ai")
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should remove trailing slashes' do
|
31
|
+
[nil, '', '/', '//'].each do |base_path|
|
32
|
+
config.base_path = base_path
|
33
|
+
# uncomment below to test trailing slashes
|
34
|
+
# expect(config.base_url).to eq("https://api.carbon.ai")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,196 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
require 'securerandom'
|
4
|
+
require 'debug'
|
5
|
+
|
6
|
+
describe 'GettingStarted' do
|
7
|
+
before do
|
8
|
+
Carbon.access_token = "YOUR API KEY"
|
9
|
+
Carbon.api_key = "YOUR API KEY"
|
10
|
+
Carbon.customer_id = "YOUR API KEY"
|
11
|
+
Carbon.host = "http://127.0.0.1:4010"
|
12
|
+
end
|
13
|
+
|
14
|
+
after do
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'Utilities.scrape_web' do
|
18
|
+
result = Carbon::Utilities.scrape_web(
|
19
|
+
body: [
|
20
|
+
{
|
21
|
+
"url" => "url_example",
|
22
|
+
"recursion_depth" => 3,
|
23
|
+
"max_pages_to_scrape" => 100,
|
24
|
+
"chunk_size" => 1500,
|
25
|
+
"chunk_overlap" => 20,
|
26
|
+
"skip_embedding_generation" => false,
|
27
|
+
"enable_auto_sync" => false,
|
28
|
+
"generate_sparse_vectors" => false,
|
29
|
+
"prepend_filename_to_chunks" => false,
|
30
|
+
"html_tags_to_skip" => [],
|
31
|
+
"css_classes_to_skip" => [],
|
32
|
+
"css_selectors_to_skip" => [],
|
33
|
+
"embedding_model" => "OPENAI",
|
34
|
+
}
|
35
|
+
],
|
36
|
+
)
|
37
|
+
expect(result).to_not be_nil
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'data_sources.query_user_data_sources' do
|
41
|
+
configuration = Carbon::Configuration.new
|
42
|
+
configuration.access_token = 'YOUR API KEY'
|
43
|
+
configuration.api_key = 'YOUR API KEY'
|
44
|
+
configuration.customer_id = 'YOUR API KEY'
|
45
|
+
configuration.host = 'http://127.0.0.1:4010'
|
46
|
+
carbon = Carbon::Client.new(configuration)
|
47
|
+
pagination = {
|
48
|
+
"limit" => 10,
|
49
|
+
"offset" => 0,
|
50
|
+
}
|
51
|
+
order_by = "created_at"
|
52
|
+
order_dir = "desc"
|
53
|
+
filters = {
|
54
|
+
"source" => "GOOGLE_DRIVE",
|
55
|
+
}
|
56
|
+
result = carbon.data_sources.query_user_data_sources(
|
57
|
+
pagination: pagination,
|
58
|
+
order_by: order_by,
|
59
|
+
order_dir: order_dir,
|
60
|
+
filters: filters,
|
61
|
+
)
|
62
|
+
p result
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'data_sources.query_user_data_sources static pattern' do
|
66
|
+
result = Carbon::DataSources.query_user_data_sources(
|
67
|
+
pagination: {
|
68
|
+
"limit" => 10,
|
69
|
+
"offset" => 0,
|
70
|
+
},
|
71
|
+
order_by: "created_at",
|
72
|
+
order_dir: "desc",
|
73
|
+
filters: {
|
74
|
+
"source" => "GOOGLE_DRIVE",
|
75
|
+
},
|
76
|
+
)
|
77
|
+
|
78
|
+
# assert result is not nil
|
79
|
+
expect(result).to_not be_nil
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'integrations.sync_gitbook' do
|
83
|
+
result = Carbon::Integrations.sync_gitbook_with_http_info(
|
84
|
+
space_ids: [
|
85
|
+
"string_example"
|
86
|
+
],
|
87
|
+
data_source_id: 1,
|
88
|
+
tags: {},
|
89
|
+
chunk_size: 1500,
|
90
|
+
chunk_overlap: 20,
|
91
|
+
skip_embedding_generation: false,
|
92
|
+
embedding_model: "OPENAI",
|
93
|
+
generate_sparse_vectors: false,
|
94
|
+
prepend_filename_to_chunks: false,
|
95
|
+
)
|
96
|
+
expect(result).to_not be_nil
|
97
|
+
expect(result.data).to_not be_nil
|
98
|
+
expect(result.status_code).to eq(200)
|
99
|
+
expect(result.headers).to_not be_nil
|
100
|
+
expect(result.response).to_not be_nil
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'embedding.get_documents' do
|
104
|
+
configuration = Carbon::Configuration.new
|
105
|
+
configuration.access_token = 'YOUR API KEY'
|
106
|
+
configuration.api_key = 'YOUR API KEY'
|
107
|
+
configuration.customer_id = 'YOUR API KEY'
|
108
|
+
configuration.host = 'http://127.0.0.1:4010'
|
109
|
+
carbon = Carbon::Client.new(configuration)
|
110
|
+
result = carbon.embeddings.get_documents(
|
111
|
+
query: "a",
|
112
|
+
k: 1,
|
113
|
+
tags: {
|
114
|
+
"key": "string_example",
|
115
|
+
},
|
116
|
+
query_vector: [
|
117
|
+
3.14
|
118
|
+
],
|
119
|
+
file_ids: [
|
120
|
+
1
|
121
|
+
],
|
122
|
+
parent_file_ids: [
|
123
|
+
1
|
124
|
+
],
|
125
|
+
tags_v2: {
|
126
|
+
},
|
127
|
+
include_tags: true,
|
128
|
+
include_vectors: true,
|
129
|
+
include_raw_file: true,
|
130
|
+
hybrid_search: true,
|
131
|
+
hybrid_search_tuning_parameters: {
|
132
|
+
"weight_a" => 0.5,
|
133
|
+
"weight_b" => 0.5,
|
134
|
+
},
|
135
|
+
media_type: "TEXT",
|
136
|
+
embedding_model: "OPENAI",
|
137
|
+
)
|
138
|
+
expect(result).to_not be_nil
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'Webhooks.urls' do
|
142
|
+
result = Carbon::Webhooks.urls(
|
143
|
+
pagination: {
|
144
|
+
"limit" => 10,
|
145
|
+
"offset" => 0,
|
146
|
+
},
|
147
|
+
order_by: "created_at",
|
148
|
+
order_dir: "desc",
|
149
|
+
filters: {
|
150
|
+
"ids" => [],
|
151
|
+
},
|
152
|
+
)
|
153
|
+
expect(result).to_not be_nil
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'Embeddings.upload_chunks_and_embeddings' do
|
157
|
+
result = Carbon::Embeddings.upload_chunks_and_embeddings(
|
158
|
+
embedding_model: "OPENAI",
|
159
|
+
chunks_and_embeddings: [
|
160
|
+
{
|
161
|
+
"file_id" => 1,
|
162
|
+
"chunks_and_embeddings" => [
|
163
|
+
{
|
164
|
+
"chunk_number" => 1,
|
165
|
+
"chunk" => "chunk_example",
|
166
|
+
"embedding" => [
|
167
|
+
3.14
|
168
|
+
],
|
169
|
+
}
|
170
|
+
],
|
171
|
+
}
|
172
|
+
],
|
173
|
+
overwrite_existing: false,
|
174
|
+
)
|
175
|
+
expect(result).to_not be_nil
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'files.upload' do
|
179
|
+
# read from directory of this file ../README.md to file
|
180
|
+
file = File.open(File.join(File.dirname(__FILE__), "../README.md"), "rb")
|
181
|
+
|
182
|
+
result = Carbon::Files.upload(
|
183
|
+
file: file,
|
184
|
+
chunk_size: 1,
|
185
|
+
chunk_overlap: 1,
|
186
|
+
skip_embedding_generation: false,
|
187
|
+
set_page_as_boundary: false,
|
188
|
+
embedding_model: "OPENAI",
|
189
|
+
use_ocr: false,
|
190
|
+
generate_sparse_vectors: false,
|
191
|
+
prepend_filename_to_chunks: false,
|
192
|
+
max_items_per_chunk: 1,
|
193
|
+
)
|
194
|
+
expect(result).to_not be_nil
|
195
|
+
end
|
196
|
+
end
|