client.copilots.create_copilot(...)
-
-
-
Create a new copilot. The API key used will be added to the copilot for future Requests
-
-
-
from credal import CredalApi from credal.common import Collaborator client = CredalApi( api_key="YOUR_API_KEY", ) client.copilots.create_copilot( name="Customer Copilot", description="This copilot is used to answer customer requests based on internal documentation.", collaborators=[ Collaborator( email="[email protected]", role="editor", ) ], )
-
-
-
name:
str
— A descriptive name for the copilot.
-
description:
str
— An in depth name for the copilot's function. Useful for routing requests to the right copilot.
-
collaborators:
typing.Sequence[Collaborator]
— A list of collaborator emails and roles that will have access to the copilot.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.copilots.create_conversation(...)
-
-
-
OPTIONAL. Create a new conversation with the Copilot. The conversation ID can be used in the
sendMessage
endpoint. ThesendMessage
endpoint automatically creates new conversations upon first request, but calling this endpoint can simplify certain use cases where it is helpful for the application to have the conversation ID before the first message is sent.
-
-
-
import uuid from credal import CredalApi client = CredalApi( api_key="YOUR_API_KEY", ) client.copilots.create_conversation( agent_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), user_email="[email protected]", )
-
-
-
agent_id:
uuid.UUID
— Credal-generated Copilot ID to specify which agent to route the request to.
-
user_email:
str
— End-user for the conversation.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.copilots.provide_message_feedback(...)
-
-
-
import uuid from credal import CredalApi from credal.copilots import MessageFeedback client = CredalApi( api_key="YOUR_API_KEY", ) client.copilots.provide_message_feedback( user_email="[email protected]", message_id=uuid.UUID( "dd721cd8-4bf2-4b94-9869-258df3dab9dc", ), agent_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), message_feedback=MessageFeedback( feedback="NEGATIVE", suggested_answer="Yes, Credal is SOC 2 compliant.", descriptive_feedback="The response should be extremely clear and concise.", ), )
-
-
-
agent_id:
uuid.UUID
— Credal-generated Copilot ID to specify which agent to route the request to.
-
user_email:
str
— The user profile you want to use when providing feedback.
-
message_id:
uuid.UUID
— The message ID for which feedback is being provided.
-
message_feedback:
MessageFeedback
— The feedback provided by the user.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.copilots.send_message(...)
-
-
-
import uuid from credal import CredalApi from credal.copilots import InputVariable client = CredalApi( api_key="YOUR_API_KEY", ) client.copilots.send_message( agent_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), message="Is Credal SOC 2 compliant?", user_email="[email protected]", input_variables=[ InputVariable( name="input1", ids=[ uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ) ], ), InputVariable( name="input2", ids=[ uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c25", ), uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c26", ), ], ), ], )
-
-
-
agent_id:
uuid.UUID
— Credal-generated Copilot ID to specify which agent to route the request to.
-
message:
str
— The message you want to send to your copilot.
-
user_email:
str
— The user profile you want to use when sending the message.
-
conversation_id:
typing.Optional[uuid.UUID]
— Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations.
-
input_variables:
typing.Optional[typing.Sequence[InputVariable]]
— Optional input variables to be used in the message. Map the name of the variable to a list of urls.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.copilots.stream_message(...)
-
-
-
This endpoint allows you to send a message to a specific copilot and get the response back as a streamed set of Server-Sent Events.
-
-
-
import uuid from credal import CredalApi from credal.copilots import InputVariable client = CredalApi( api_key="YOUR_API_KEY", ) response = client.copilots.stream_message( copilot_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), message="Is this user eligible for benefits based on their date of birth?", email="[email protected]", input_variables=[ InputVariable( name="input1", ids=[ uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c26", ) ], ), InputVariable( name="input2", ids=[ uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c25", ), uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), ], ), ], ) for chunk in response: yield chunk
-
-
-
copilot_id:
uuid.UUID
— Credal-generated Copilot ID to specify which agent to route the request to.
-
message:
str
— The message you want to send to your copilot.
-
email:
str
— The user profile you want to use when sending the message.
-
conversation_id:
typing.Optional[uuid.UUID]
— Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations.
-
input_variables:
typing.Optional[typing.Sequence[InputVariable]]
— Optional input variables to be used in the message. Map the name of the variable to a list of urls.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.copilots.add_collection_to_copilot(...)
-
-
-
Link a collection with a copilot. The API Key used must be added to both the collection and the copilot beforehand.
-
-
-
import uuid from credal import CredalApi client = CredalApi( api_key="YOUR_API_KEY", ) client.copilots.add_collection_to_copilot( copilot_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), collection_id=uuid.UUID( "def1055f-83c5-43d6-b558-f7a38e7b299e", ), )
-
-
-
copilot_id:
uuid.UUID
— Credal-generated copilot ID to add the collection to.
-
collection_id:
uuid.UUID
— Credal-generated collection ID to add.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.copilots.remove_collection_from_copilot(...)
-
-
-
Unlink a collection with a copilot. The API Key used must be added to both the collection and the copilot beforehand.
-
-
-
import uuid from credal import CredalApi client = CredalApi( api_key="YOUR_API_KEY", ) client.copilots.remove_collection_from_copilot( copilot_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), collection_id=uuid.UUID( "def1055f-83c5-43d6-b558-f7a38e7b299e", ), )
-
-
-
copilot_id:
uuid.UUID
— Credal-generated copilot ID to add the collection to.
-
collection_id:
uuid.UUID
— Credal-generated collection ID to add.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.copilots.update_configuration(...)
-
-
-
Update the configuration for a copilot
-
-
-
import uuid from credal import CredalApi from credal.copilots import AiEndpointConfiguration, Configuration client = CredalApi( api_key="YOUR_API_KEY", ) client.copilots.update_configuration( copilot_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), configuration=Configuration( name="Customer Copilot", description="This copilot is used to answer customer requests based on internal documentation.", prompt="You are a polite, helpful assistant used to answer customer requests.", ai_endpoint_configuration=AiEndpointConfiguration( base_url="https://api.openai.com/v1/", api_key="<YOUR_API_KEY_HERE>", ), ), )
-
-
-
copilot_id:
uuid.UUID
— Credal-generated copilot ID to add the collection to.
-
configuration:
Configuration
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.copilots.delete_copilot(...)
-
-
-
import uuid from credal import CredalApi client = CredalApi( api_key="YOUR_API_KEY", ) client.copilots.delete_copilot( id=uuid.UUID( "ac20e6ba-0bae-11ef-b25a-efca73df4c3a", ), )
-
-
-
id:
uuid.UUID
— Copilot ID
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.document_catalog.upload_document_contents(...)
-
-
-
from credal import CredalApi client = CredalApi( api_key="YOUR_API_KEY", ) client.document_catalog.upload_document_contents( document_name="My Document", document_contents="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", document_external_id="73eead26-d124-4940-b329-5f068a0a8db9", allowed_users_email_addresses=["[email protected]", "[email protected]"], upload_as_user_email="[email protected]", )
-
-
-
document_name:
str
— The name of the document you want to upload.
-
document_contents:
str
— The full LLM-formatted text contents of the document you want to upload.
-
allowed_users_email_addresses:
typing.Sequence[str]
— Users allowed to access the document. Unlike Credal's out of the box connectors which reconcile various permissions models from 3rd party software, for custom uploads the caller is responsible for specifying who can access the document and currently flattening groups if applicable. Documents can also be marked as internal public.
-
upload_as_user_email:
str
— [Legacy] The user on behalf of whom the document should be uploaded. In most cases, this can simply be the email of the developer making the API call. This field will be removed in the future in favor of purely specifying permissions via allowedUsersEmailAddresses.
-
document_external_id:
str
— The external ID of the document. This is typically the ID as it exists in its original external system. Uploads to the same external ID will update the document in Credal.
-
document_external_url:
typing.Optional[str]
— The external URL of the document you want to upload. If provided Credal will link to this URL.
-
custom_metadata:
typing.Optional[typing.Optional[typing.Any]]
— Optional JSON representing any custom metdata for this document
-
collection_id:
typing.Optional[str]
— If specified, document will also be added to a particular document collection
-
force_update:
typing.Optional[bool]
— If specified, document contents will be re-uploaded and re-embedded even if the document already exists in Credal
-
internal_public:
typing.Optional[bool]
— If specified, document will be accessible to everyone within the organization of the uploader
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.document_catalog.sync_source_by_url(...)
-
-
-
Sync a document from a source URL. Does not support recursive web search. Reach out to a Credal representative for access.
-
-
-
from credal import CredalApi client = CredalApi( api_key="YOUR_API_KEY", ) client.document_catalog.sync_source_by_url( source_url="https://drive.google.com/file/d/123456/view", upload_as_user_email="[email protected]", )
-
-
-
upload_as_user_email:
str
-
source_url:
str
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.document_catalog.metadata(...)
-
-
-
Bulk patch metadata for documents, synced natively by Credal or manual API uploads
-
-
-
from credal import CredalApi from credal.common import ResourceIdentifier_ExternalResourceId from credal.document_catalog import DocumentMetadataPatch client = CredalApi( api_key="YOUR_API_KEY", ) client.document_catalog.metadata( sources=[ DocumentMetadataPatch( metadata={"Department": "HR", "Country": "United States"}, resource_identifier=ResourceIdentifier_ExternalResourceId( external_resource_id="170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr", resource_type="GOOGLE_DRIVE_ITEM", ), ), DocumentMetadataPatch( metadata={"Department": "Sales", "Vertical": "Healthcare"}, resource_identifier=ResourceIdentifier_ExternalResourceId( external_resource_id="123456", resource_type="ZENDESK_TICKET", ), ), ], upload_as_user_email="[email protected]", )
-
-
-
sources:
typing.Sequence[DocumentMetadataPatch]
-
upload_as_user_email:
str
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.document_collections.add_documents_to_collection(...)
-
-
-
Add documents to a document collection. Note that the documents must already exist in the document catalog to use this endpoint. If you want to upload a new document to a collection, use the
uploadDocumentContents
endpoint.
-
-
-
import uuid from credal import CredalApi from credal.common import ResourceIdentifier_ExternalResourceId client = CredalApi( api_key="YOUR_API_KEY", ) client.document_collections.add_documents_to_collection( collection_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), resource_identifiers=[ ResourceIdentifier_ExternalResourceId( external_resource_id="170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr", resource_type="GOOGLE_DRIVE_ITEM", ), ResourceIdentifier_ExternalResourceId( external_resource_id="398KAHdfkjsdf09r54UvyslPVWkQFOA0lOiu34in923", resource_type="GOOGLE_DRIVE_ITEM", ), ], )
-
-
-
collection_id:
uuid.UUID
— The ID of the document collection you want to add to.
-
resource_identifiers:
typing.Sequence[ResourceIdentifier]
— The set of resource identifier for which you want to add to the collection.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.document_collections.remove_documents_from_collection(...)
-
-
-
Remove documents from a collection
-
-
-
import uuid from credal import CredalApi from credal.common import ResourceIdentifier_ExternalResourceId client = CredalApi( api_key="YOUR_API_KEY", ) client.document_collections.remove_documents_from_collection( collection_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), resource_identifiers=[ ResourceIdentifier_ExternalResourceId( external_resource_id="170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr", resource_type="GOOGLE_DRIVE_ITEM", ), ResourceIdentifier_ExternalResourceId( external_resource_id="398KAHdfkjsdf09r54UvyslPVWkQFOA0lOiu34in923", resource_type="GOOGLE_DRIVE_ITEM", ), ], )
-
-
-
collection_id:
uuid.UUID
— The ID of the document collection you want to add to.
-
resource_identifiers:
typing.Sequence[ResourceIdentifier]
— The set of resource identifier for which you want to remove from the collection
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.document_collections.create_collection(...)
-
-
-
Create a new copilot. The API key used will be added to the copilot for future Requests
-
-
-
from credal import CredalApi from credal.common import Collaborator client = CredalApi( api_key="YOUR_API_KEY", ) client.document_collections.create_collection( name="Customer Collection", description="This collection is used to answer customer requests based on internal documentation.", collaborators=[ Collaborator( email="[email protected]", role="editor", ) ], )
-
-
-
name:
str
— A descriptive name for the collection.
-
description:
str
— An in depth name for the copilot's function. Useful for routing requests to the right copilot.
-
collaborators:
typing.Sequence[Collaborator]
— A list of collaborator emails and roles that will have access to the copilot.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.document_collections.delete_collection(...)
-
-
-
Delete the collection.
-
-
-
import uuid from credal import CredalApi client = CredalApi( api_key="YOUR_API_KEY", ) client.document_collections.delete_collection( collection_id=uuid.UUID( "ac20e6ba-0bae-11ef-b25a-efca73df4c3a", ), )
-
-
-
collection_id:
uuid.UUID
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.document_collections.create_mongo_collection_sync(...)
-
-
-
Credal lets you easily sync your MongoDB data for use in Collections and Copilots. Create a new sync from a MongoDB collection to a Credal collection.
-
-
-
import uuid from credal import CredalApi from credal.document_collections import ( MongoCollectionSyncConfig, MongoSourceFieldsConfig, ) client = CredalApi( api_key="YOUR_API_KEY", ) client.document_collections.create_mongo_collection_sync( mongo_uri="mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority", collection_id=uuid.UUID( "ac20e6ba-0bae-11ef-b25a-efca73df4c3a", ), config=MongoCollectionSyncConfig( sync_name="My sales transcripts", collection_name="myCollection", filter_expression={"status": {"$ne": "disabled"}}, source_fields=MongoSourceFieldsConfig( body="body", source_name="meetingName", source_system_updated="transcriptDatetime", source_url="link", ), ), )
-
-
-
collection_id:
uuid.UUID
-
mongo_uri:
str
-
config:
MongoCollectionSyncConfig
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.document_collections.update_mongo_collection_sync(...)
-
-
-
Credal lets you easily sync your MongoDB data for use in Collections and Copilots. Update an existing sync from a MongoDB collection to a Credal collection via the
mongoCredentialId
, to disambiguate between multiple potential syncs to a given collection.
-
-
-
import uuid from credal import CredalApi from credal.document_collections import ( MongoCollectionSyncConfig, MongoSourceFieldsConfig, ) client = CredalApi( api_key="YOUR_API_KEY", ) client.document_collections.update_mongo_collection_sync( mongo_uri="mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority", mongo_credential_id=uuid.UUID( "5988ed76-6ee1-11ef-97dd-1fca54b7c4bc", ), config=MongoCollectionSyncConfig( sync_name="My recent summarized sales transcripts", collection_name="myCollection", filter_expression={ "transcriptDatetime": {"$gt": "2023-01-01T00:00:00.000Z"} }, source_fields=MongoSourceFieldsConfig( body="transcriptSummary", source_name="meetingName", source_system_updated="transcriptDatetime", source_url="link", ), ), )
-
-
-
mongo_credential_id:
uuid.UUID
-
mongo_uri:
str
-
config:
MongoCollectionSyncConfig
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.permissions_service.check_resource_authorization_for_user(...)
-
-
-
Admin endpoint to check whether the specified user is authorized to read the specified resource.
-
-
-
from credal import CredalApi from credal.common import ResourceIdentifier_ExternalResourceId client = CredalApi( api_key="YOUR_API_KEY", ) client.permissions_service.check_resource_authorization_for_user( resource_identifier=ResourceIdentifier_ExternalResourceId( external_resource_id="170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr", resource_type="GOOGLE_DRIVE_ITEM", ), user_email="[email protected]", )
-
-
-
resource_identifier:
ResourceIdentifier
— The resource identifier for which you want to check authorization.
-
user_email:
str
— The user email to check authorization for.
-
disable_cache:
typing.Optional[bool]
— If specified, Credal will bypass the permissions cache and check current permissions for this resource
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.permissions_service.check_bulk_resources_authorization_for_user(...)
-
-
-
Admin endpoint to check whether the specified user is authorized to read the specified set of resources.
-
-
-
from credal import CredalApi from credal.common import ( ResourceIdentifier_ExternalResourceId, ResourceIdentifier_Url, ) client = CredalApi( api_key="YOUR_API_KEY", ) client.permissions_service.check_bulk_resources_authorization_for_user( resource_identifiers=[ ResourceIdentifier_Url( url="https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit", ), ResourceIdentifier_ExternalResourceId( external_resource_id="sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr", resource_type="ZENDESK_TICKET", ), ], user_email="[email protected]", )
-
-
-
resource_identifiers:
typing.Sequence[ResourceIdentifier]
— The set of resource identifier for which you want to check authorization. Currently limited to 20 resources.
-
user_email:
str
— The user email to check authorization for.
-
disable_cache:
typing.Optional[bool]
— If specified, Credal will bypass the permissions cache and check current permissions for all resources specified.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.permissions_service.list_cached_authorized_resources_for_user(...)
-
-
-
Admin endpoint to list all resources that the specified user is authorized to read. Note this endpoint returns cached results and may not be up-to-date. You can use the checkResourceAuthorizationForUser endpoint with disableCache set to true to get the most up-to-date results.
-
-
-
from credal import CredalApi client = CredalApi( api_key="YOUR_API_KEY", ) client.permissions_service.list_cached_authorized_resources_for_user( user_email="[email protected]", )
-
-
-
user_email:
str
— The user email to list authorized resources for.
-
resource_type:
typing.Optional[ResourceType]
— The type of resource you want to list. If not specified, all resource types will be listed.
-
limit:
typing.Optional[int]
— The maximum number of resources to return. Defaults to 100.
-
offset:
typing.Optional[int]
— The offset to use for pagination. If not specified, the first page of results will be returned.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.search.search_document_collection(...)
-
-
-
Search across all documents in a document collection using the document metadata and contents.
-
-
-
import uuid from credal import CredalApi from credal.search import DocumentCollectionSearchOptions, SingleFieldFilter client = CredalApi( api_key="YOUR_API_KEY", ) client.search.search_document_collection( collection_id=uuid.UUID( "82e4b12a-6990-45d4-8ebd-85c00e030c24", ), search_query="ABC Corp", structured_query_filters=[ SingleFieldFilter( field="status", operator="==", value="Open", ) ], user_email="[email protected]", search_options=DocumentCollectionSearchOptions( max_chunks=10, merge_contents=True, threshold=0.8, enable_smart_filtering=True, enable_query_extraction=True, enable_reranking=True, ), )
-
-
-
collection_id:
uuid.UUID
-
search_query:
str
-
user_email:
str
— The email of the user making the search request for permissions reduction.
-
structured_query_filters:
typing.Optional[typing.Sequence[SingleFieldFilter]]
— The structured query filters to apply to the search query.
-
search_options:
typing.Optional[DocumentCollectionSearchOptions]
-
metadata_filter_expression:
typing.Optional[str]
— Legacy metadata filter expression to apply to the search query. Use structuredQueryFilters instead.
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-
client.users.metadata(...)
-
-
-
Bulk patch metadata for users
-
-
-
from credal import CredalApi from credal.users import UserMetadataPatch client = CredalApi( api_key="YOUR_API_KEY", ) client.users.metadata( request=[ UserMetadataPatch( metadata={"State": "NY", "Job Role": "CEO"}, user_email="[email protected]", ), UserMetadataPatch( metadata={"State": "NY", "Department": "Engineering"}, user_email="[email protected]", ), ], )
-
-
-
request:
typing.Sequence[UserMetadataPatch]
-
request_options:
typing.Optional[RequestOptions]
— Request-specific configuration.
-
-