structifyai 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: structifyai
3
+ Version: 0.0.2
4
+ Summary: Structify
5
+ Home-page:
6
+ Author: Structify Team
7
+ Author-email: team@structify.ai
8
+ License: Discuss directly with founders for license.
9
+ Keywords: OpenAPI,OpenAPI-Generator,Structify
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: urllib3<2.1.0,>=1.25.3
12
+ Requires-Dist: python-dateutil
13
+ Requires-Dist: pydantic<2,>=1.10.5
14
+ Requires-Dist: aenum
15
+
16
+ Unify all your unstructured knowledged into one structured source.
17
+
@@ -0,0 +1,107 @@
1
+ # structifyai
2
+ Unify all your unstructured knowledged into one structured source.
3
+
4
+ This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
5
+
6
+ - API version: 0.1.0
7
+ - Package version: 0.0.2
8
+ - Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen
9
+
10
+ ## Requirements.
11
+
12
+ Python 3.7+
13
+
14
+ ## Installation & Usage
15
+ ### pip install
16
+
17
+ If the python package is hosted on a repository, you can install directly using:
18
+
19
+ ```sh
20
+ pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
21
+ ```
22
+ (you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
23
+
24
+ Then import the package:
25
+ ```python
26
+ import structifyai
27
+ ```
28
+
29
+ ### Setuptools
30
+
31
+ Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
32
+
33
+ ```sh
34
+ python setup.py install --user
35
+ ```
36
+ (or `sudo python setup.py install` to install the package for all users)
37
+
38
+ Then import the package:
39
+ ```python
40
+ import structifyai
41
+ ```
42
+
43
+ ### Tests
44
+
45
+ Execute `pytest` to run the tests.
46
+
47
+ ## Getting Started
48
+
49
+ Please follow the [installation procedure](#installation--usage) and then run the following:
50
+
51
+ ```python
52
+
53
+ import time
54
+ import structifyai
55
+ from structifyai.rest import ApiException
56
+ from pprint import pprint
57
+
58
+ # Defining the host is optional and defaults to http://localhost
59
+ # See configuration.py for a list of all supported configuration parameters.
60
+ configuration = structifyai.Configuration(
61
+ host = "http://localhost"
62
+ )
63
+
64
+
65
+
66
+ # Enter a context with an instance of the API client
67
+ with structifyai.ApiClient(configuration) as api_client:
68
+ # Create an instance of the API class
69
+ api_instance = structifyai.DatasetApi(api_client)
70
+
71
+ try:
72
+ # Create a Dataset
73
+ api_instance.create()
74
+ except ApiException as e:
75
+ print("Exception when calling DatasetApi->create: %s\n" % e)
76
+
77
+ ```
78
+
79
+ ## Documentation for API Endpoints
80
+
81
+ All URIs are relative to *http://localhost*
82
+
83
+ Class | Method | HTTP request | Description
84
+ ------------ | ------------- | ------------- | -------------
85
+ *DatasetApi* | [**create**](docs/DatasetApi.md#create) | **POST** /dataset/create | Create a Dataset
86
+ *DatasetApi* | [**delete**](docs/DatasetApi.md#delete) | **POST** /dataset/delete | Remove a kg from the database
87
+ *DatasetApi* | [**get**](docs/DatasetApi.md#get) | **POST** /dataset/get | Remove a kg from the database
88
+ *DatasetApi* | [**list**](docs/DatasetApi.md#list) | **POST** /dataset/list | List knowledge graph
89
+ *DatasetApi* | [**query**](docs/DatasetApi.md#query) | **GET** /dataset/query | Remove a kg from the database
90
+ *ServerApi* | [**version**](docs/ServerApi.md#version) | **GET** /server/version | Version
91
+
92
+
93
+ ## Documentation For Models
94
+
95
+
96
+
97
+ <a id="documentation-for-authorization"></a>
98
+ ## Documentation For Authorization
99
+
100
+ Endpoints do not require authorization.
101
+
102
+
103
+ ## Author
104
+
105
+ team@structify.ai
106
+
107
+
File without changes
@@ -0,0 +1,14 @@
1
+ from pydantic import Field
2
+ from structify.orm.schema import SchemaInstance
3
+ from structify.orm.value_types import UniqueText
4
+
5
+
6
+ class Human(SchemaInstance):
7
+ """
8
+ Description: A Human
9
+ Version: 1
10
+ """
11
+
12
+ name: UniqueText = Field(description="The name of the person")
13
+ employer: UniqueText = Field(description="The last known employer of this person")
14
+ last_known_job_title: UniqueText = Field(description="The last known job title of the person")
@@ -0,0 +1,35 @@
1
+ """
2
+ This is an example of updating all your contacts from a CSV with
3
+ publically available information.
4
+ """
5
+ import os
6
+ import pandas as pd
7
+ from human import Human
8
+ from structify import Client
9
+ from structify.orm.value_types import UniqueText
10
+
11
+
12
+ def main():
13
+ client = Client(auth=os.environ["STRUCTIFY_TOKEN"])
14
+
15
+ client.kg.create(name="acme", description="Test use case")
16
+
17
+ df = pd.read_csv("acme.csv")
18
+ for i, (name, title, company) in df.iterrows():
19
+ if i >= 2:
20
+ break
21
+ print(f"Adding {name} to the KG with values {title} and {company}")
22
+ if pd.isna(company):
23
+ continue
24
+ client.entities.add(
25
+ entity=Human(
26
+ name=UniqueText(value=name),
27
+ last_known_job_title=UniqueText(value=title),
28
+ last_known_job=UniqueText(value=company),
29
+ ),
30
+ name="acme",
31
+ )
32
+
33
+
34
+ if __name__ == "__main__":
35
+ main()
@@ -0,0 +1,18 @@
1
+ import os
2
+ from human import Human
3
+ from structify import Client
4
+ from structify.orm import Schema
5
+
6
+
7
+ def main():
8
+ client = Client(auth=os.environ["STRUCTIFY_TOKEN"])
9
+ try:
10
+ client.schemas.get(name="Human")
11
+ client.schemas.delete(name="Human")
12
+ except Exception as e:
13
+ print(f"Schema didn't already exist: {e}")
14
+ client.schemas.add(Schema.from_pydantic(Human))
15
+
16
+
17
+ if __name__ == "__main__":
18
+ main()
@@ -0,0 +1,17 @@
1
+ import os
2
+ from human import Human
3
+ from structify import Client
4
+ from structify.orm import Schema
5
+
6
+
7
+ def main():
8
+ client = Client(auth=os.environ["STRUCTIFY_TOKEN"])
9
+ entity = client.researcher.on_demand_scrape(
10
+ query="Output the person who runs remote first capital.",
11
+ schema_name="Human",
12
+ )
13
+ print(entity)
14
+
15
+
16
+ if __name__ == "__main__":
17
+ main()
@@ -0,0 +1,55 @@
1
+ from pydantic import Field
2
+ import os
3
+ import pandas as pd
4
+ from tqdm import tqdm
5
+
6
+ from structify.orm.schema import Schema, SchemaInstance
7
+ from structify.orm.value_types import UniqueText
8
+ from structify import Client
9
+
10
+
11
+ class AcmeHuman(SchemaInstance):
12
+ """
13
+ Description: AcmeHuman
14
+ Version: 0
15
+ """
16
+
17
+ name: UniqueText = Field(description="The name of the person")
18
+ employer: UniqueText = Field(description="The last known employer of this person")
19
+ last_known_job_title: UniqueText = Field(
20
+ description="The last known job title of the person"
21
+ )
22
+ link: UniqueText = Field(description="The link to the source of the information")
23
+
24
+
25
+ def main():
26
+ client = Client(auth=os.environ["STRUCTIFY_TOKEN"])
27
+ # client.schemas.add(Schema.from_pydantic(AcmeHuman))
28
+ df = pd.read_csv("acme.csv")
29
+ new_df = []
30
+
31
+ results = []
32
+ for _, name, job, org in tqdm(df.itertuples()):
33
+ try:
34
+ entity = client.researcher.on_demand_scrape(
35
+ query=f"I know that {name} used to have the title of {job} at {org}. Where do they work now? Try to confirm we're talking about the same person.",
36
+ schema_name="AcmeHuman",
37
+ )
38
+ results.append(entity)
39
+ new_df.append(
40
+ {
41
+ "name": entity[0].name,
42
+ "job": entity[0].last_known_job_title,
43
+ "org": entity[0].employer,
44
+ "link": entity[0].link,
45
+ }
46
+ )
47
+ except Exception as e:
48
+ print(e)
49
+
50
+ new_df = pd.DataFrame(new_df)
51
+ new_df.to_csv("acme_results.csv")
52
+
53
+
54
+ if __name__ == "__main__":
55
+ main()
@@ -0,0 +1,30 @@
1
+ [tool.poetry]
2
+ name = "structifyai"
3
+ version = "0.0.2"
4
+ description = "Structify"
5
+ authors = ["Structify Team <team@structify.ai>"]
6
+ license = "Discuss directly with founders for license."
7
+ readme = "README.md"
8
+ repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
9
+ keywords = ["OpenAPI", "OpenAPI-Generator", "Structify"]
10
+ include = ["structifyai/py.typed"]
11
+
12
+ [tool.poetry.dependencies]
13
+ python = "^3.7"
14
+
15
+ urllib3 = ">= 1.25.3"
16
+ python-dateutil = ">=2.8.2"
17
+ pydantic = "^1.10.5, <2"
18
+ aenum = ">=3.1.11"
19
+
20
+ [tool.poetry.dev-dependencies]
21
+ pytest = ">=7.2.1"
22
+ tox = ">=3.9.0"
23
+ flake8 = ">=4.0.0"
24
+
25
+ [build-system]
26
+ requires = ["setuptools"]
27
+ build-backend = "setuptools.build_meta"
28
+
29
+ [tool.pylint.'MESSAGES CONTROL']
30
+ extension-pkg-whitelist = "pydantic"
@@ -0,0 +1,7 @@
1
+ [flake8]
2
+ max-line-length = 99
3
+
4
+ [egg_info]
5
+ tag_build =
6
+ tag_date = 0
7
+
@@ -0,0 +1,49 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Structify
5
+
6
+ Unify all your unstructured knowledged into one structured source.
7
+
8
+ Version: 0.1.0
9
+
10
+ Contact: team@structify.ai
11
+ """
12
+
13
+
14
+ from setuptools import setup, find_packages # noqa: H301
15
+
16
+ # To install the library, run the following
17
+ #
18
+ # python setup.py install
19
+ #
20
+ # prerequisite: setuptools
21
+ # http://pypi.python.org/pypi/setuptools
22
+ NAME = "structifyai"
23
+ VERSION = "0.0.2"
24
+ PYTHON_REQUIRES = ">=3.7"
25
+ REQUIRES = [
26
+ "urllib3 >= 1.25.3, < 2.1.0",
27
+ "python-dateutil",
28
+ "pydantic >= 1.10.5, < 2",
29
+ "aenum"
30
+ ]
31
+
32
+ setup(
33
+ name=NAME,
34
+ version=VERSION,
35
+ description="Structify",
36
+ author="Structify Team",
37
+ author_email="team@structify.ai",
38
+ url="",
39
+ keywords=["OpenAPI", "OpenAPI-Generator", "Structify"],
40
+ install_requires=REQUIRES,
41
+ packages=find_packages(exclude=["test", "tests"]),
42
+ include_package_data=True,
43
+ license="Discuss directly with founders for license.",
44
+ long_description_content_type='text/markdown',
45
+ long_description="""\
46
+ Unify all your unstructured knowledged into one structured source.
47
+ """, # noqa: E501
48
+ package_data={"structifyai": ["py.typed"]},
49
+ )
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+
5
+ """
6
+ Structify
7
+
8
+ Unify all your unstructured knowledged into one structured source.
9
+
10
+ Version: 0.1.0
11
+
12
+ Contact: team@structify.ai
13
+ """
14
+
15
+
16
+ __version__ = "0.0.2"
17
+
18
+ # Import our wrapper object
19
+ from structifyai.api_client import Client
20
+
21
+ # import apis into sdk package
22
+ from structifyai.api.dataset_api import DatasetApi
23
+ from structifyai.api.server_api import ServerApi
24
+
25
+ # import ApiClient
26
+ from structifyai.api_response import ApiResponse
27
+ from structifyai.api_client import ApiClient
28
+ from structifyai.configuration import Configuration
29
+ from structifyai.exceptions import OpenApiException
30
+ from structifyai.exceptions import ApiTypeError
31
+ from structifyai.exceptions import ApiValueError
32
+ from structifyai.exceptions import ApiKeyError
33
+ from structifyai.exceptions import ApiAttributeError
34
+ from structifyai.exceptions import ApiException
35
+
36
+ # import models into sdk package
@@ -0,0 +1,6 @@
1
+ # flake8: noqa
2
+
3
+ # import apis into api package
4
+ from structifyai.api.dataset_api import DatasetApi
5
+ from structifyai.api.server_api import ServerApi
6
+