Skip to main content

semantha® SDK

The semantha SDK is a high-level REST client to access the semantha API. The SDK is still under development. An overview of the current progress (i.e. implemented and tested resources and endpoints) may be found at the end of this document (State of Development). The semantha SDK is compatible with python >= 3.8.

Design guideline/idea

Every api call can easily be translated into a python sdk call: GET /api/info -> api.info.get() The SDK offers type hints and doc strings for services, parameters, input types and return types within your IDE.

Disclaimer

IMPORTANT: The SDK is still under development and interfaces may change at any time without notice. Use with caution and on own risk.

Update Notes

Version 5.8.0

Added endpoints:

  • /domains/{domainname}/documentclasses/{id}/documentclasses
  • /domains/{domainname}/documentclasses/{id}/referencedocuments
  • /domains/{domainname}/referencedocuments/{documentid}/paragraphs/{id}/links
  • /model/domains/{domainname}/backups

SDK covers now 193/197 services.

Version 5.7.0

Added new endpoints in:

  • /api/domains/{domainname}/documenttypes/*
  • /api/domains/{domainname}/documentclasses/{id}/customfields
  • /api/model/domains/{domainname}/classes/*

SDK covers now 184/197 services.

Version 5.6.0

Added most endpoints in */api/models/ ** SDK covers now 158/180 services.

Version 5.5.0

Removed language parameter on /api/domains/{domainname}/references Fixed bug on serialization of /api/domains/{domainname}/modelinstances response. Fixed return of binary responses of bulk services.

Version 5.4.0

Added new service:

  • /api/domains/{domainname}/summarizations which generations a summarization for a given list of texts and a given topic.

Added support for existing services:

  • /api/model/domains/{domainname}/boostwords/{id}
  • /api/model/domains/{domainname}/namedentities
  • /api/model/domains/{domainname}/namedentities/{id}
  • /api/model/domains/{domainname}/stopwords
  • /api/model/domains/{domainname}/stopwords/{id}
  • /api/model/domains/{domainname}/synonyms/{id}

Version 5.3.0

Added new service: /api/domains/{domainid}/answers with retrieval augemented answer generation based on your library entries. Added new parameter on /modelinstances

Version 5.2.0

The SDK is now automatically generated from our openapi.json specification. It covers 71/169 (=42%) of all available services. Many class names and package names have been changed.

Version 4.5.0

Major restructuring of the SDK. All sub-resources are directly accessible (instead of invoking getters). That also means that (except for a few) all functions are plain get/post/delete/put/patch. For example, in Versions < 4.5.0 a domain resource was fetched using semantha_sdk.domains.get_one("domain_name"). Starting with 4.5.0 it is semantha_sdk.domains("domain_name"). That also means that get/post/put/patch functions return semantha model objects (and never resources), which makes usage more consistent.

Access

To access semantha's API you will need an API and a server url. Both can be requested via this contact form.

Example Usage

Authentication with key

import semantha_sdk
api = semantha_sdk.login(server_url="<semantha server URL>", key="<your key>")
print("Talking to semantha server: " + api.info.get().version)

Authentication with key file

import semantha_sdk
api = semantha_sdk.login(server_url="<semantha server URL>", key_file="<path to your key file (json format)>")
# end-points (resp. resources) can be used like objects
my_domain = api.domains("my_domain")
# they may have sub-resources, which can be retrieved as objects as well
reference_documents = my_domain.referencedocuments
# GET all reference documents
print("Library contains "+ len(reference_documents.get()) + " entries")

Example key file in json format:

{ "API_Key" : "<your key>" }

CRUD on End-points

# CRUD operations are functions
domain_settings = my_domain.settings.get()
#Warning: this deletes ALL reference documents/library entries
my_domain.referencedocuments.delete() 

Function Return Types & semantha Data Model

# some functions only return None, e.g.
my_domain.referencedocuments.delete() # returns NoneType

# others return built in types, e.g
roles_list = currentuser.roles.get() # returns List[str]

# but most return objects of the semantha Data Model
# (all returned objects are instances of frozen dataclasses)
settings = my_domain.settings.get() # returns instance of Settings
# attributes can be accessed as properties, e.g.
settings.enable_tagging # returns true or false
# Data Model objects may be complex
document = my_domain.references.post(file=a, referencedocument=b) # returns instance of Document
# the following returns the similarity value of the first references of the first sentence of the
# the first paragraph on the first page of the document (if a reference was found for this sentence)
similarity = pages[0].contents[0].paragraphs[0].references[0].similarity # returns float

State of Development

The following resources and end-points are fully functional and (partially) tested:

  • /bulk -> BulkEndpoint
  • /bulk/domains -> BulkDomainsEndpoint
  • /bulk/domains/{domainname} -> BulkdomainsDomainEndpoint
  • /bulk/domains/{domainname}/documentclasses -> BulkdomainsDocumentclassesEndpoint
    • GET -> List[DocumentClassBulk]
    • POST -> None
  • /bulk/domains/{domainname}/documenttypes -> BulkdomainsDocumenttypesEndpoint
    • GET -> List[DocumentType]
    • POST -> None
  • /bulk/domains/{domainname}/referencedocuments -> BulkdomainsReferencedocumentsEndpoint
    • GET -> List[Document]
    • POST -> None
    • DELETE -> None
  • /bulk/domains/{domainname}/references -> BulkdomainsReferencesEndpoint
    • POST -> List[Document]
  • /bulk/model -> BulkModelEndpoint
  • /bulk/model/domains -> BulkmodelDomainsEndpoint
  • /bulk/model/domains/{domainname} -> BulkmodelDomainEndpoint
  • /bulk/model/domains/{domainname}/boostwords -> BulkmodelBoostwordsEndpoint
    • POST -> None
  • /bulk/model/domains/{domainname}/classes -> BulkmodelClassesEndpoint
    • GET -> List[ClassBulk]
    • POST -> None
  • /bulk/model/domains/{domainname}/classes/{classid} -> BulkmodelClassEndpoint
  • /bulk/model/domains/{domainname}/classes/{classid}/instances -> BulkmodelclassInstancesEndpoint
    • GET -> List[Instance]
  • /bulk/model/domains/{domainname}/dataproperties -> BulkmodelDatapropertiesEndpoint
    • GET -> List[DataProperty]
    • POST -> None
  • /bulk/model/domains/{domainname}/instances -> BulkmodelInstancesEndpoint
    • GET -> List[Instance]
    • POST -> None
  • /bulk/model/domains/{domainname}/metadata -> BulkmodelMetadataEndpoint
    • GET -> List[Metadata]
    • POST -> None
  • /bulk/model/domains/{domainname}/namedentities -> BulkmodelNamedentitiesEndpoint
    • POST -> None
  • /bulk/model/domains/{domainname}/rules -> BulkmodelRulesEndpoint
    • GET -> List[Rule]
    • POST -> None
  • /bulk/model/domains/{domainname}/stopwords -> BulkmodelStopwordsEndpoint
    • POST -> None
  • /bulk/model/domains/{domainname}/synonyms -> BulkmodelSynonymsEndpoint
    • POST -> None
  • /celltypes -> CelltypesEndpoint
    • GET -> List[CellType]
  • /currentuser -> CurrentuserEndpoint
    • GET -> CurrentUser
  • /currentuser/roles -> RolesEndpoint
    • GET -> List[str]
  • /diff -> DiffEndpoint
    • POST -> List[Difference]
  • /domains -> DomainsEndpoint
    • GET -> List[Domain]
  • /domains/{domainname} -> DomainEndpoint
    • GET -> Domain
  • /domains/{domainname}/answers -> AnswersEndpoint
    • POST -> Answer
  • /domains/{domainname}/documentannotations -> DocumentannotationsEndpoint
    • POST (Accept: docx) -> IOBase
    • POST (Accept: pdf) -> IOBase
  • /domains/{domainname}/documentclasses -> DocumentclassesEndpoint
    • GET -> List[DocumentClass]
    • POST -> DocumentClass
    • DELETE -> None
  • /domains/{domainname}/documentclasses/{id} -> DocumentclassEndpoint
    • GET -> DocumentClass
    • DELETE -> None
    • PUT -> DocumentClass
  • /domains/{domainname}/documentclasses/{id}/customfields -> DocclassCustomfieldsEndpoint
    • DELETE -> None
    • PUT -> None
  • /domains/{domainname}/documentclasses/{id}/documentclasses -> DocclassDocumentclassesEndpoint
    • GET -> List[DocumentClass]
    • POST -> DocumentClass
    • DELETE -> List[DocumentClass]
    • PATCH -> List[DocumentClass]
  • /domains/{domainname}/documentclasses/{id}/referencedocuments -> DocclassReferencedocumentsEndpoint
    • GET -> List[DocumentInformation]
    • DELETE -> None
    • PATCH -> None
  • /domains/{domainname}/documentcomparisons -> DocumentcomparisonsEndpoint
    • POST (Accept: xlsx) -> IOBase
  • /domains/{domainname}/documents -> DocumentsEndpoint
    • POST -> List[Document]
    • POST (Accept: xlsx) -> IOBase
    • POST (Accept: docx) -> IOBase
  • /domains/{domainname}/documenttypes -> DocumenttypesEndpoint
    • GET -> List[DocumentType]
    • POST -> DocumentType
    • DELETE -> None
  • /domains/{domainname}/documenttypes/{id} -> DocumenttypeEndpoint
    • GET -> DocumentType
    • DELETE -> None
    • PATCH -> DocumentType
  • /domains/{domainname}/documenttypes/{id}/clone -> CloneEndpoint
    • POST -> DocumentType
  • /domains/{domainname}/modelclasses -> ModelclassesEndpoint
    • GET -> List[ModelClass]
  • /domains/{domainname}/modelinstances -> ModelinstancesEndpoint
    • POST -> SemanticModel
    • POST (Accept: xlsx) -> IOBase
  • /domains/{domainname}/referencedocuments -> ReferencedocumentsEndpoint
    • GET -> ReferenceDocumentsResponseContainer
    • GET (Accept: xlsx) -> IOBase
    • POST -> List[DocumentInformation]
    • DELETE -> None
  • /domains/{domainname}/referencedocuments/clusters -> ClustersEndpoint
    • GET -> SmartClusterResponseContainer
    • PUT -> SmartClusterResponseContainer
  • /domains/{domainname}/referencedocuments/namedentities -> NamedentitiesEndpoint
    • GET -> List[DocumentNamedEntity]
  • /domains/{domainname}/referencedocuments/statistic -> StatisticEndpoint
    • GET -> Statistic
  • /domains/{domainname}/referencedocuments/{documentid} -> ReferencedocumentEndpoint
    • GET -> Document
    • DELETE -> None
    • PATCH -> DocumentInformation
  • /domains/{domainname}/referencedocuments/{documentid}/paragraphs -> ParagraphsEndpoint
  • /domains/{domainname}/referencedocuments/{documentid}/paragraphs/{id} -> ParagraphEndpoint
    • GET -> Paragraph
    • DELETE -> None
    • PATCH -> Paragraph
  • /domains/{domainname}/referencedocuments/{documentid}/paragraphs/{id}/links -> LinksEndpoint
    • GET -> List[Link]
  • /domains/{domainname}/referencedocuments/{documentid}/sentences -> SentencesEndpoint
  • /domains/{domainname}/referencedocuments/{documentid}/sentences/{id} -> SentenceEndpoint
    • GET -> Sentence
  • /domains/{domainname}/references -> ReferencesEndpoint
    • POST -> Document
    • POST (Accept: xlsx) -> IOBase
    • POST (Accept: docx) -> IOBase
    • POST (Accept: pdf) -> IOBase
  • /domains/{domainname}/settings -> SettingsEndpoint
    • GET -> Settings
    • PATCH -> Settings
  • /domains/{domainname}/similaritymatrix -> SimilaritymatrixEndpoint
    • POST -> List[MatrixRow]
  • /domains/{domainname}/similaritymatrix/cluster -> SimilaritymatrixClusterEndpoint
    • POST -> List[MatrixRow]
  • /domains/{domainname}/summarizations -> SummarizationsEndpoint
    • POST -> str
  • /domains/{domainname}/tags -> TagsEndpoint
    • GET -> List[str]
  • /domains/{domainname}/tags/{tagname} -> TagEndpoint
  • /domains/{domainname}/tags/{tagname}/referencedocuments -> TagReferencedocumentsEndpoint
    • GET -> List[DocumentInformation]
    • DELETE -> None
  • /domains/{domainname}/validation -> ValidationEndpoint
    • POST -> SemanticModel
  • /info -> InfoEndpoint
    • GET -> Info
  • /languages -> LanguagesEndpoint
    • POST -> LanguageDetection
  • /model -> ModelEndpoint
  • /model/datatypes -> ModelDatatypesEndpoint
    • GET -> List[str]
  • /model/domains -> ModelDomainsEndpoint
  • /model/domains/{domainname} -> ModelDomainEndpoint
    • GET (Accept: xlsx) -> IOBase
    • PATCH -> IOBase
  • /model/domains/{domainname}/attributes -> ModelAttributesEndpoint
    • GET -> List[AttributeOverview]
  • /model/domains/{domainname}/backups -> ModelBackupsEndpoint
    • POST -> None
  • /model/domains/{domainname}/boostwords -> ModelBoostwordsEndpoint
    • GET -> List[BoostWord]
    • POST -> BoostWord
    • DELETE -> None
  • /model/domains/{domainname}/boostwords/{id} -> ModelBoostwordEndpoint
    • GET -> BoostWord
    • DELETE -> None
    • PUT -> BoostWord
  • /model/domains/{domainname}/classes -> ModelontClassesEndpoint
    • GET -> List[ClassesOverview]
    • POST -> Clazz
    • DELETE -> None
  • /model/domains/{domainname}/classes/{classid} -> ModelontClassEndpoint
    • GET -> Clazz
    • DELETE -> None
    • PUT -> Clazz
  • /model/domains/{domainname}/classes/{classid}/attributes -> ModelontAttributesEndpoint
    • GET -> List[Attribute]
    • POST -> Attribute
    • DELETE -> None
  • /model/domains/{domainname}/classes/{classid}/attributes/{id} -> ModelontAttributeEndpoint
    • GET -> Attribute
    • DELETE -> None
    • PUT -> Attribute
  • /model/domains/{domainname}/classes/{classid}/instances -> ModelontclassInstancesEndpoint
    • GET -> List[Instance]
    • DELETE -> None
  • /model/domains/{domainname}/dataproperties -> ModelDatapropertiesEndpoint
    • GET -> List[Overview]
    • POST -> DataProperty
    • DELETE -> None
  • /model/domains/{domainname}/dataproperties/{id} -> ModelDatapropertyEndpoint
    • GET -> DataProperty
    • DELETE -> None
    • PUT -> DataProperty
  • /model/domains/{domainname}/extractorclasses -> ModelExtractorclassesEndpoint
    • GET -> List[ExtractorClassOverview]
    • POST -> ExtractorClass
    • DELETE -> None
    • PUT -> None
  • /model/domains/{domainname}/extractorclasses/{id} -> ModelExtractorclassEndpoint
    • GET -> ExtractorClass
    • DELETE -> None
    • PUT -> ExtractorClass
  • /model/domains/{domainname}/extractorclasses/{id}/extractorclasses -> ChildExtractorclassesEndpoint
    • POST -> ExtractorClass
  • /model/domains/{domainname}/extractors -> ModelExtractorsEndpoint
    • GET -> List[Entity]
  • /model/domains/{domainname}/extractortables -> ModelExtractortablesEndpoint
    • GET -> List[Table]
    • POST -> ExtractorTable
    • DELETE -> None
  • /model/domains/{domainname}/extractortables/{id} -> ModelExtractortableEndpoint
    • GET -> ExtractorTable
    • DELETE -> None
    • PUT -> ExtractorTable
  • /model/domains/{domainname}/formatters -> ModelFormattersEndpoint
    • GET -> List[Formatter]
  • /model/domains/{domainname}/instances -> ModelontInstancesEndpoint
    • GET -> List[InstanceOverview]
    • GET (Accept: xlsx) -> IOBase
    • POST -> Instance
    • DELETE -> None
    • PATCH -> None
  • /model/domains/{domainname}/instances/{id} -> ModelontInstanceEndpoint
    • GET -> Instance
    • DELETE -> None
    • PUT -> Instance
  • /model/domains/{domainname}/metadata -> ModelMetadataEndpoint
    • GET -> List[Metadata]
    • POST -> Metadata
    • DELETE -> None
  • /model/domains/{domainname}/metadata/{id} -> ModelOnemetadataEndpoint
    • GET -> Metadata
    • DELETE -> None
    • PUT -> Metadata
  • /model/domains/{domainname}/namedentities -> ModelNamedentitiesEndpoint
    • GET -> List[NamedEntity]
    • POST -> NamedEntity
    • DELETE -> None
  • /model/domains/{domainname}/namedentities/{id} -> ModelNamedentityEndpoint
    • GET -> NamedEntity
    • DELETE -> None
    • PUT -> NamedEntity
  • /model/domains/{domainname}/objectproperties -> ModelObjectpropertiesEndpoint
    • GET -> List[Overview]
  • /model/domains/{domainname}/regexes -> ModelRegexesEndpoint
    • GET -> List[Regex]
    • POST -> Regex
    • DELETE -> None
  • /model/domains/{domainname}/regexes/{id} -> ModelRegexEndpoint
    • GET -> Regex
    • DELETE -> None
    • PUT -> Regex
  • /model/domains/{domainname}/relations -> ModelRelationsEndpoint
    • GET -> List[Relation]
    • POST -> Relation
    • DELETE -> None
  • /model/domains/{domainname}/relations/{id} -> ModelRelationEndpoint
    • GET -> Relation
    • DELETE -> None
    • PUT -> Relation
  • /model/domains/{domainname}/rulefunctions -> ModelRulefunctionsEndpoint
    • GET -> List[RuleFunction]
  • /model/domains/{domainname}/rules -> ModelRulesEndpoint
    • GET -> List[RuleOverview]
    • POST -> Rule
    • DELETE -> None
  • /model/domains/{domainname}/rules/{id} -> ModelRuleEndpoint
    • GET -> Rule
    • DELETE -> None
    • PUT -> Rule
  • /model/domains/{domainname}/stopwords -> ModelStopwordsEndpoint
    • GET -> List[StopWord]
    • POST -> StopWord
    • DELETE -> None
  • /model/domains/{domainname}/stopwords/{id} -> ModelStopwordEndpoint
    • GET -> StopWord
    • DELETE -> None
    • PUT -> StopWord
  • /model/domains/{domainname}/synonyms -> ModelSynonymsEndpoint
    • GET -> List[Synonym]
    • POST -> Synonym
    • DELETE -> None
  • /model/domains/{domainname}/synonyms/{id} -> ModelSynonymEndpoint
    • GET -> Synonym
    • DELETE -> None
    • PUT -> Synonym
  • /model/extractortypes -> ModelExtractortypesEndpoint
    • GET -> List[str]
  • /model/metadatatypes -> ModelMetadatatypesEndpoint
    • GET -> List[str]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semantha_sdk-5.8.0.tar.gz (60.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semantha_sdk-5.8.0-py3-none-any.whl (163.6 kB view details)

Uploaded Python 3

File details

Details for the file semantha_sdk-5.8.0.tar.gz.

File metadata

  • Download URL: semantha_sdk-5.8.0.tar.gz
  • Upload date:
  • Size: 60.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.8 Windows/10

File hashes

Hashes for semantha_sdk-5.8.0.tar.gz
Algorithm Hash digest
SHA256 c78ff220429994d3fd78ae616b25279191da6ed643417a21187965e785c1c76a
MD5 d296a32f3485b0605311ec3fb31dc4db
BLAKE2b-256 4aed4d7e7a92fabde755308fee25bb2b2bbfaa449f1e4342d8f385ac666edc1c

See more details on using hashes here.

File details

Details for the file semantha_sdk-5.8.0-py3-none-any.whl.

File metadata

  • Download URL: semantha_sdk-5.8.0-py3-none-any.whl
  • Upload date:
  • Size: 163.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.8 Windows/10

File hashes

Hashes for semantha_sdk-5.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 049574780e29df49e3bcbcad9b1a9183174c994a8dade7ea766935bdecc9cda4
MD5 0c723d1b93d529fee4c0209eaf7eade9
BLAKE2b-256 75cf9222c910795642793102ff15d0eb004b4584e0f6380e5a01c4c4713394cf

See more details on using hashes here.

Release history Release notifications | RSS feed

11.10.0

2 files

11.9.0

2 files

11.8.0

2 files

11.7.0

2 files

11.6.0

2 files

11.5.0

2 files

11.4.0

2 files

11.3.0

2 files

11.2.1

2 files

11.2.0

2 files

11.1.0

2 files

10.10.0

2 files

10.9.0

2 files

10.6.0

2 files

10.5.0

2 files

10.4.0

2 files

10.1.0

2 files

10.0.0

2 files

9.1.0

2 files

9.0.0

2 files

8.12.0

2 files

8.10.0

2 files

8.9.0

2 files

8.8.2

2 files

8.8.1

2 files

8.8.0

2 files

8.6.0

2 files

8.5.1

2 files

8.5.0

2 files

8.3.0

2 files

8.2.0

2 files

8.1.0

2 files

7.13.0

2 files

7.11.0

2 files

7.10.0

2 files

7.9.0

2 files

7.8.0

2 files

7.5.0

2 files

7.3.0

2 files

7.1.1

2 files

7.1.0

2 files

7.0.0

2 files

6.11.2

2 files

6.11.1

2 files

6.11.0

2 files

6.10.0

2 files

6.9.0

2 files

6.8.0

2 files

6.7.0

2 files

6.6.0

2 files

6.5.0

2 files

6.4.0

2 files

6.3.0

2 files

6.2.1

2 files

6.2.0

2 files

6.1.0

2 files

6.0.1

2 files

6.0.0

2 files

5.11.1

2 files

5.11.0

2 files

5.10.0

2 files

5.9.0

2 files

This release

5.8.0 This release

2 files

5.7.2

2 files

5.7.1

2 files

5.7.0

2 files

5.6.2

2 files

5.6.1

2 files

5.6.0

2 files

5.5.0

2 files

5.4.1

2 files

5.4.0

2 files

5.3.2

2 files

5.3.1

2 files

5.3.0

2 files

5.2.0

2 files

4.8.1

2 files

4.8.0

2 files

4.7.0

2 files

4.6.0

2 files

4.5.3

2 files

4.5.2

2 files

4.5.1

2 files

4.5.0

2 files

4.3.1

2 files

4.3.0

2 files

4.2.1

2 files

4.2.0

2 files

4.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page