llama-index-tools-shinapi 0.1.1__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.
- llama_index_tools_shinapi-0.1.1/.gitignore +3 -0
- llama_index_tools_shinapi-0.1.1/LICENSE +21 -0
- llama_index_tools_shinapi-0.1.1/PKG-INFO +42 -0
- llama_index_tools_shinapi-0.1.1/README.md +28 -0
- llama_index_tools_shinapi-0.1.1/llama_index/tools/shinapi/__init__.py +3 -0
- llama_index_tools_shinapi-0.1.1/llama_index/tools/shinapi/base.py +36 -0
- llama_index_tools_shinapi-0.1.1/llama_index/tools/shinapi/py.typed +0 -0
- llama_index_tools_shinapi-0.1.1/pyproject.toml +23 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ShinAPI
|
|
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.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: llama-index-tools-shinapi
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Search what high-authority Japanese sites say now, as a LlamaIndex tool. By ShinAPI.
|
|
5
|
+
Project-URL: Homepage, https://shinapi.com
|
|
6
|
+
Project-URL: Documentation, https://docs.shinapi.com
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: agents,japan,japanese,llama-index,llm,rag,search
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Requires-Dist: llama-index-core<0.15,>=0.14
|
|
12
|
+
Requires-Dist: shinapi>=0.1
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# llama-index-tools-shinapi
|
|
16
|
+
|
|
17
|
+
Search what high-authority Japanese sites say now, from LlamaIndex: a tool spec for agents. By
|
|
18
|
+
[ShinAPI](https://shinapi.com).
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
pip install llama-index-tools-shinapi
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Get a key in the [console](https://console.shinapi.com) and set `SHINAPI_KEY`, or pass `api_key`.
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from llama_index.core.agent.workflow import FunctionAgent
|
|
28
|
+
from llama_index.llms.anthropic import Anthropic
|
|
29
|
+
from llama_index.tools.shinapi import ShinAPIToolSpec
|
|
30
|
+
|
|
31
|
+
agent = FunctionAgent(
|
|
32
|
+
tools=ShinAPIToolSpec().to_tool_list(),
|
|
33
|
+
llm=Anthropic(model="claude-sonnet-5-5"),
|
|
34
|
+
)
|
|
35
|
+
await agent.run("2026年の年収の壁はいくらですか")
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The tool answers the model with the search's JSON: each passage as published, with its URL, publisher, dates, licence
|
|
39
|
+
and the credit line to show. Its description tells the model what is indexed and what to do with each outcome:
|
|
40
|
+
`answered`, `no_match_in_scope` or `out_of_scope`.
|
|
41
|
+
|
|
42
|
+
Read the [docs](https://docs.shinapi.com).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# llama-index-tools-shinapi
|
|
2
|
+
|
|
3
|
+
Search what high-authority Japanese sites say now, from LlamaIndex: a tool spec for agents. By
|
|
4
|
+
[ShinAPI](https://shinapi.com).
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
pip install llama-index-tools-shinapi
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Get a key in the [console](https://console.shinapi.com) and set `SHINAPI_KEY`, or pass `api_key`.
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from llama_index.core.agent.workflow import FunctionAgent
|
|
14
|
+
from llama_index.llms.anthropic import Anthropic
|
|
15
|
+
from llama_index.tools.shinapi import ShinAPIToolSpec
|
|
16
|
+
|
|
17
|
+
agent = FunctionAgent(
|
|
18
|
+
tools=ShinAPIToolSpec().to_tool_list(),
|
|
19
|
+
llm=Anthropic(model="claude-sonnet-5-5"),
|
|
20
|
+
)
|
|
21
|
+
await agent.run("2026年の年収の壁はいくらですか")
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The tool answers the model with the search's JSON: each passage as published, with its URL, publisher, dates, licence
|
|
25
|
+
and the credit line to show. Its description tells the model what is indexed and what to do with each outcome:
|
|
26
|
+
`answered`, `no_match_in_scope` or `out_of_scope`.
|
|
27
|
+
|
|
28
|
+
Read the [docs](https://docs.shinapi.com).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import Annotated, Any, Optional
|
|
3
|
+
|
|
4
|
+
from llama_index.core.tools.tool_spec.base import BaseToolSpec
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
from shinapi import SEARCH_DESCRIPTION, SEARCH_INPUT, ShinAPI
|
|
7
|
+
|
|
8
|
+
_FIELDS: dict[str, Any] = SEARCH_INPUT["properties"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _described(name: str) -> Any:
|
|
12
|
+
return Field(description=_FIELDS[name]["description"])
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ShinAPIToolSpec(BaseToolSpec):
|
|
16
|
+
spec_functions = ["search"]
|
|
17
|
+
|
|
18
|
+
def __init__(self, api_key: Optional[str] = None, client: Optional[ShinAPI] = None) -> None:
|
|
19
|
+
self.client = client or ShinAPI(api_key)
|
|
20
|
+
|
|
21
|
+
def search(
|
|
22
|
+
self,
|
|
23
|
+
query: Annotated[str, _described("query")],
|
|
24
|
+
max_results: Annotated[int, _described("max_results")] = _FIELDS["max_results"]["default"],
|
|
25
|
+
exclude_domains: Annotated[Optional[list[str]], _described("exclude_domains")] = None,
|
|
26
|
+
exclude_text: Annotated[Optional[list[str]], _described("exclude_text")] = None,
|
|
27
|
+
) -> str:
|
|
28
|
+
answer = self.client.search(
|
|
29
|
+
query,
|
|
30
|
+
max_results=max_results,
|
|
31
|
+
exclude_domains=exclude_domains,
|
|
32
|
+
exclude_text=exclude_text,
|
|
33
|
+
)
|
|
34
|
+
return json.dumps(answer, ensure_ascii=False)
|
|
35
|
+
|
|
36
|
+
search.__doc__ = SEARCH_DESCRIPTION
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "llama-index-tools-shinapi"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Search what high-authority Japanese sites say now, as a LlamaIndex tool. By ShinAPI."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
keywords = ["llama-index", "search", "japan", "japanese", "llm", "rag", "agents"]
|
|
13
|
+
dependencies = ["llama-index-core>=0.14,<0.15", "shinapi>=0.1"]
|
|
14
|
+
|
|
15
|
+
[project.urls]
|
|
16
|
+
Homepage = "https://shinapi.com"
|
|
17
|
+
Documentation = "https://docs.shinapi.com"
|
|
18
|
+
|
|
19
|
+
[tool.hatch.build.targets.wheel]
|
|
20
|
+
include = ["llama_index/"]
|
|
21
|
+
|
|
22
|
+
[tool.hatch.build.targets.sdist]
|
|
23
|
+
only-include = ["llama_index", "README.md", "LICENSE"]
|