endoc 0.1.0__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.
endoc-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Endoc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
endoc-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.1
2
+ Name: endoc
3
+ Version: 0.1.0
4
+ Summary: Endoc SDK: A note-taking app SDK powered by LLMs
5
+ Home-page: https://github.com/science-editor/endoc-python-sdk
6
+ Author: Grigor Dochev
7
+ Author-email: Grigor Dochev <gdochev@ethz.ch>, Andreas Giannoutsos <agiannoutsos@ethz.ch>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/science-editor/endoc-python-sdk
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # Endoc SDK
18
+
19
+ The Endoc software development kit (SDK) is for developers, researchers and other academic groups who want to programmatically access the NLP features developed for the Endoc platform.
20
+
21
+ It provides an interface agnostic approach allowing you to bypass the Endoc platform website and, directly integrate select NLP research-derived state of the art APIs into your own standalone applications.
22
+
23
+ # Motivation
24
+
25
+ LLMs are increasingly used as tools in academia, providing ways to access information, alternative views in reasoning, paraphraasing of content or summarisation of papers.
26
+
27
+ The intent of the Endoc SDK is to act as a scientific guard, providing an interface to Endoc LLM technologies programmatically that layer ETH in-house curated filters for scientific language accuracy.
28
+
29
+ ## Get started
30
+
31
+ 1. Install the Endoc SDK using pip:
32
+
33
+ ```bash
34
+ pip install endoc-sdk
35
+ ```
36
+
37
+ 2. Get a free API key from the Endoc platform, under your Swiss affiliated account page or request one from the developers (if outside of Switzerland).
38
+
39
+ 3. Initalize the Endoc SDK with your API key:
40
+
41
+ ```python
42
+ # Import Endoc from endoc-sdk
43
+ from endoc-sdk import Endoc
44
+
45
+ # API Key available on the account page
46
+ client = Endoc("your_api_key");
47
+ ```
48
+
49
+ ## Contributing
50
+
51
+ We welcome contributions to the Endoc SDK. Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
endoc-0.1.0/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Endoc SDK
2
+
3
+ The Endoc software development kit (SDK) is for developers, researchers and other academic groups who want to programmatically access the NLP features developed for the Endoc platform.
4
+
5
+ It provides an interface agnostic approach allowing you to bypass the Endoc platform website and, directly integrate select NLP research-derived state of the art APIs into your own standalone applications.
6
+
7
+ # Motivation
8
+
9
+ LLMs are increasingly used as tools in academia, providing ways to access information, alternative views in reasoning, paraphraasing of content or summarisation of papers.
10
+
11
+ The intent of the Endoc SDK is to act as a scientific guard, providing an interface to Endoc LLM technologies programmatically that layer ETH in-house curated filters for scientific language accuracy.
12
+
13
+ ## Get started
14
+
15
+ 1. Install the Endoc SDK using pip:
16
+
17
+ ```bash
18
+ pip install endoc-sdk
19
+ ```
20
+
21
+ 2. Get a free API key from the Endoc platform, under your Swiss affiliated account page or request one from the developers (if outside of Switzerland).
22
+
23
+ 3. Initalize the Endoc SDK with your API key:
24
+
25
+ ```python
26
+ # Import Endoc from endoc-sdk
27
+ from endoc-sdk import Endoc
28
+
29
+ # API Key available on the account page
30
+ client = Endoc("your_api_key");
31
+ ```
32
+
33
+ ## Contributing
34
+
35
+ We welcome contributions to the Endoc SDK. Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
@@ -0,0 +1,15 @@
1
+ from .document_search import DocumentSearchService
2
+ from .paginated_search import PaginatedSearchService
3
+ from .memsum_summary import SummarizationService
4
+
5
+ def summarize(api_key, collection, id_field, id_type, id_value):
6
+ service = SummarizationService(api_key)
7
+ return service.summarize_paper(collection, id_field, id_type, id_value)
8
+
9
+ def document_search(api_key, ranking_variable, **kwargs):
10
+ service = DocumentSearchService(api_key)
11
+ return service.search_documents(ranking_variable, **kwargs)
12
+
13
+ def paginated_search(api_key, paper_list, keywords=None):
14
+ service = PaginatedSearchService(api_key)
15
+ return service.paginated_search(paper_list, keywords)
@@ -0,0 +1,16 @@
1
+ from gql import Client
2
+ from gql.transport.requests import RequestsHTTPTransport
3
+
4
+ class APIClient:
5
+ def __init__(self, api_key):
6
+ url = "https://endoc.ethz.ch/graphql"
7
+ self.client = Client(
8
+ transport = RequestsHTTPTransport(
9
+ url=url,
10
+ headers={'x-api-key': api_key}
11
+ ),
12
+ fetch_schema_from_transport=True,
13
+ )
14
+
15
+ def execute_query(self, query, variable_values=None):
16
+ return self.client.execute(query, variable_values or {})
@@ -0,0 +1,18 @@
1
+ from .client import APIClient
2
+ from .queries import DOCUMENT_SEARCH_QUERY
3
+
4
+ class DocumentSearchService:
5
+ def __init__(self, api_key):
6
+ self.client = APIClient(api_key)
7
+
8
+ def search_documents(
9
+ self,
10
+ ranking_variable,
11
+ keywords=None
12
+ ):
13
+ variable_values = {
14
+ "ranking_variable": ranking_variable,
15
+ "keywords": keywords or []
16
+ }
17
+ result = self.client.execute_query(DOCUMENT_SEARCH_QUERY, variable_values)
18
+ return result
@@ -0,0 +1,24 @@
1
+ from .client import APIClient
2
+ from .queries import MEMSUM_SUMMARY_QUERY
3
+
4
+ class SummarizationService:
5
+ def __init__(self, api_key):
6
+ self.client = APIClient(api_key)
7
+
8
+ def summarize_paper(
9
+ self,
10
+ collection,
11
+ id_field,
12
+ id_type,
13
+ id_value
14
+ ):
15
+ variable_values = {
16
+ "paper_id" : {
17
+ "collection": collection,
18
+ "id_field": id_field,
19
+ "id_type": id_type,
20
+ "id_value": id_value,
21
+ }
22
+ }
23
+ result = self.client.execute_query(MEMSUM_SUMMARY_QUERY, variable_values)
24
+ return result
@@ -0,0 +1,14 @@
1
+ from .client import APIClient
2
+ from .queries import PAGINATED_SEARCH_QUERY
3
+
4
+ class PaginatedSearchService:
5
+ def __init__(self, api_key):
6
+ self.client = APIClient(api_key)
7
+
8
+ def paginated_search(self, paper_list, keywords=None):
9
+ variable_values = {
10
+ "paper_list": paper_list,
11
+ "keywords": keywords or [],
12
+ }
13
+ result = self.client.execute_query(PAGINATED_SEARCH_QUERY, variable_values)
14
+ return result
@@ -0,0 +1,104 @@
1
+ from gql import gql
2
+
3
+ DOCUMENT_SEARCH_QUERY = gql("""
4
+ query documentSearch(
5
+ $ranking_variable: String
6
+ $keywords: [String]
7
+ $paper_list: [MetadataInput]
8
+ $ranking_collection: String
9
+ $ranking_id_field: String
10
+ $ranking_id_value: String
11
+ $ranking_id_type: String
12
+ ) {
13
+ documentSearch(
14
+ ranking_variable: $ranking_variable
15
+ keywords: $keywords
16
+ paper_list: $paper_list
17
+ ranking_collection: $ranking_collection
18
+ ranking_id_field: $ranking_id_field
19
+ ranking_id_value: $ranking_id_value
20
+ ranking_id_type: $ranking_id_type
21
+ ) {
22
+ status
23
+ message
24
+ response {
25
+ search_stats {
26
+ DurationTotalSearch
27
+ nMatchingDocuments
28
+ }
29
+ paper_list {
30
+ collection
31
+ id_field
32
+ id_type
33
+ id_value
34
+ }
35
+ reranking_scores
36
+ prefetching_scores
37
+ }
38
+ }
39
+ }
40
+ """)
41
+
42
+ PAGINATED_SEARCH_QUERY = gql("""
43
+ query paginatedSearch($paper_list: [MetadataInput]!, $keywords: [String]) {
44
+ paginatedSearch(paper_list: $paper_list, keywords: $keywords) {
45
+ status
46
+ message
47
+ response {
48
+ _id
49
+ DOI
50
+ Title
51
+ Content {
52
+ Abstract
53
+ Abstract_Parsed {
54
+ section_id
55
+ section_title
56
+ section_text {
57
+ paragraph_id
58
+ paragraph_text {
59
+ sentence_id
60
+ sentence_text
61
+ sentence_similarity
62
+ cite_spans {
63
+ start
64
+ end
65
+ text
66
+ ref_id
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ Author {
73
+ FamilyName
74
+ GivenName
75
+ }
76
+ Venue
77
+ PublicationDate {
78
+ Year
79
+ Month
80
+ Day
81
+ Name
82
+ }
83
+ id_int
84
+ relevant_sentences
85
+ }
86
+ }
87
+ }
88
+ """)
89
+
90
+ MEMSUM_SUMMARY_QUERY = gql("""
91
+ query summarizePaper($paper_id: MetadataInput!) {
92
+ summarizePaper(paper_id: $paper_id) {
93
+ status
94
+ message
95
+ response {
96
+ paragraph_id
97
+ section_id
98
+ sentence_id
99
+ sentence_text
100
+ tag
101
+ }
102
+ }
103
+ }
104
+ """)
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.1
2
+ Name: endoc
3
+ Version: 0.1.0
4
+ Summary: Endoc SDK: A note-taking app SDK powered by LLMs
5
+ Home-page: https://github.com/science-editor/endoc-python-sdk
6
+ Author: Grigor Dochev
7
+ Author-email: Grigor Dochev <gdochev@ethz.ch>, Andreas Giannoutsos <agiannoutsos@ethz.ch>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/science-editor/endoc-python-sdk
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # Endoc SDK
18
+
19
+ The Endoc software development kit (SDK) is for developers, researchers and other academic groups who want to programmatically access the NLP features developed for the Endoc platform.
20
+
21
+ It provides an interface agnostic approach allowing you to bypass the Endoc platform website and, directly integrate select NLP research-derived state of the art APIs into your own standalone applications.
22
+
23
+ # Motivation
24
+
25
+ LLMs are increasingly used as tools in academia, providing ways to access information, alternative views in reasoning, paraphraasing of content or summarisation of papers.
26
+
27
+ The intent of the Endoc SDK is to act as a scientific guard, providing an interface to Endoc LLM technologies programmatically that layer ETH in-house curated filters for scientific language accuracy.
28
+
29
+ ## Get started
30
+
31
+ 1. Install the Endoc SDK using pip:
32
+
33
+ ```bash
34
+ pip install endoc-sdk
35
+ ```
36
+
37
+ 2. Get a free API key from the Endoc platform, under your Swiss affiliated account page or request one from the developers (if outside of Switzerland).
38
+
39
+ 3. Initalize the Endoc SDK with your API key:
40
+
41
+ ```python
42
+ # Import Endoc from endoc-sdk
43
+ from endoc-sdk import Endoc
44
+
45
+ # API Key available on the account page
46
+ client = Endoc("your_api_key");
47
+ ```
48
+
49
+ ## Contributing
50
+
51
+ We welcome contributions to the Endoc SDK. Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ endoc/__init__.py
6
+ endoc/client.py
7
+ endoc/document_search.py
8
+ endoc/memsum_summary.py
9
+ endoc/paginated_search.py
10
+ endoc/queries.py
11
+ endoc.egg-info/PKG-INFO
12
+ endoc.egg-info/SOURCES.txt
13
+ endoc.egg-info/dependency_links.txt
14
+ endoc.egg-info/requires.txt
15
+ endoc.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ gql[requests]>=3.5.0
@@ -0,0 +1 @@
1
+ endoc
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "endoc"
7
+ version = "0.1.0"
8
+ description = "Endoc SDK: A note-taking app SDK powered by LLMs"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "Grigor Dochev", email = "gdochev@ethz.ch"},
13
+ {name = "Andreas Giannoutsos", email = "agiannoutsos@ethz.ch"}
14
+ ]
15
+ urls = {Homepage = "https://github.com/science-editor/endoc-python-sdk"}
16
+ requires-python = ">=3.7"
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent"
21
+ ]
22
+
23
+ dependencies = [
24
+ "gql[requests]>=3.5.0"
25
+ ]
endoc-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
endoc-0.1.0/setup.py ADDED
@@ -0,0 +1,21 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="endoc-sdk",
5
+ version="1.0.0",
6
+ packages=find_packages(),
7
+ install_requires=[
8
+ "gql[requests]==3.5.0",
9
+ ],
10
+ description="Endoc SDK: A note-taking app SDK powered by LLMs",
11
+ long_description=open("README.md").read(),
12
+ long_description_content_type="text/markdown",
13
+ author="Grigor Dochev",
14
+ url="https://github.com/science-editor/endoc-python-sdk",
15
+ classifiers=[
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ ],
20
+ python_requires='>=3.7',
21
+ )