llama-index-tools-shopify


Namellama-index-tools-shopify JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
Summaryllama-index tools shopify integration
upload_time2024-08-22 07:40:36
maintainerajhofmann
docs_urlNone
authorYour Name
requires_python<4.0,>=3.8.1
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Shopify Tool

This tool acts as a custom app for Shopify stores, allowing the Agent to execute GraphQL queries to gather information or perform mutations against the Shopify store.

## Usage

This tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-shopify/examples/shopify.ipynb)

In particular, the tool is very effective when combined with a method of retrieving data from the GraphQL schema definition.

```bash
pip install llama-index llama-index-readers-file llama-index-tools-shopify unstructured
```

```python
from llama_index.tools.shopify import ShopifyToolSpec
from llama_index.agent.openai import OpenAIAgent

from llama_index.readers.file import UnstructuredReader
from llama_index.core.tools.ondemand_loader_tool import OnDemandLoaderTool

documentation_tool = OnDemandLoaderTool.from_defaults(
    UnstructuredReader(),
    name="graphql_writer",
    description="""
        The GraphQL schema file is located at './data/shopify_graphql.txt', this is always the file argument.
        A tool for processing the Shopify GraphQL spec, and writing queries from the documentation.

        You should pass a query_str to this tool in the form of a request to write a GraphQL query.

        Examples:
            file: './data/shopify_graphql.txt', query_str='Write a graphql query to find unshipped orders'
            file: './data/shopify_graphql.txt', query_str='Write a graphql query to retrieve the stores products'
            file: './data/shopify_graphql.txt', query_str='What fields can you retrieve from the orders object'
        """,
)


shopify_tool = ShopifyToolSpec(
    "your-store.myshopify.com", "2023-04", "your-api-key"
)

agent = OpenAIAgent.from_tools(
    [*shopify_tool.to_tool_list(), documentation_tool],
    system_prompt=f"""
    You are a specialized Agent with access to the Shopify Admin GraphQL API for this Users online store.
    Your job is to chat with store owners and help them run GraphQL queries, interpreting the results for the user

    You can use graphql_writer to query the schema and assist in writing queries.

    If the GraphQL you execute returns an error, either directly fix the query, or directly ask the graphql_writer questions about the schema instead of writing graphql queries.
    Then use that information to write the correct graphql query
    """,
    verbose=True,
    max_function_calls=20,
)

agent.chat("What products are in my store?")
```

`run_graphql_query`: Executes a GraphQL query against the Shopify store

This loader is designed to be used as a way to load data as a Tool in a Agent.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-tools-shopify",
    "maintainer": "ajhofmann",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8.1",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/c9/5a/b702745c412cc2b1f81b178ce57c2a39bc0a3126608ed64762b80b1d8f2d/llama_index_tools_shopify-0.2.0.tar.gz",
    "platform": null,
    "description": "# Shopify Tool\n\nThis tool acts as a custom app for Shopify stores, allowing the Agent to execute GraphQL queries to gather information or perform mutations against the Shopify store.\n\n## Usage\n\nThis tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-shopify/examples/shopify.ipynb)\n\nIn particular, the tool is very effective when combined with a method of retrieving data from the GraphQL schema definition.\n\n```bash\npip install llama-index llama-index-readers-file llama-index-tools-shopify unstructured\n```\n\n```python\nfrom llama_index.tools.shopify import ShopifyToolSpec\nfrom llama_index.agent.openai import OpenAIAgent\n\nfrom llama_index.readers.file import UnstructuredReader\nfrom llama_index.core.tools.ondemand_loader_tool import OnDemandLoaderTool\n\ndocumentation_tool = OnDemandLoaderTool.from_defaults(\n    UnstructuredReader(),\n    name=\"graphql_writer\",\n    description=\"\"\"\n        The GraphQL schema file is located at './data/shopify_graphql.txt', this is always the file argument.\n        A tool for processing the Shopify GraphQL spec, and writing queries from the documentation.\n\n        You should pass a query_str to this tool in the form of a request to write a GraphQL query.\n\n        Examples:\n            file: './data/shopify_graphql.txt', query_str='Write a graphql query to find unshipped orders'\n            file: './data/shopify_graphql.txt', query_str='Write a graphql query to retrieve the stores products'\n            file: './data/shopify_graphql.txt', query_str='What fields can you retrieve from the orders object'\n        \"\"\",\n)\n\n\nshopify_tool = ShopifyToolSpec(\n    \"your-store.myshopify.com\", \"2023-04\", \"your-api-key\"\n)\n\nagent = OpenAIAgent.from_tools(\n    [*shopify_tool.to_tool_list(), documentation_tool],\n    system_prompt=f\"\"\"\n    You are a specialized Agent with access to the Shopify Admin GraphQL API for this Users online store.\n    Your job is to chat with store owners and help them run GraphQL queries, interpreting the results for the user\n\n    You can use graphql_writer to query the schema and assist in writing queries.\n\n    If the GraphQL you execute returns an error, either directly fix the query, or directly ask the graphql_writer questions about the schema instead of writing graphql queries.\n    Then use that information to write the correct graphql query\n    \"\"\",\n    verbose=True,\n    max_function_calls=20,\n)\n\nagent.chat(\"What products are in my store?\")\n```\n\n`run_graphql_query`: Executes a GraphQL query against the Shopify store\n\nThis loader is designed to be used as a way to load data as a Tool in a Agent.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index tools shopify integration",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "61b1bc31bb08358be683832996510f0fc43d5e4e88666737bd88d5bfcff6be2a",
                "md5": "f83b95c5d106627debe2b987999674ef",
                "sha256": "2c19ce0d3f359385819c7037920eb05236361d74083f73c7101199e731ea28cb"
            },
            "downloads": -1,
            "filename": "llama_index_tools_shopify-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f83b95c5d106627debe2b987999674ef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 3157,
            "upload_time": "2024-08-22T07:40:35",
            "upload_time_iso_8601": "2024-08-22T07:40:35.263526Z",
            "url": "https://files.pythonhosted.org/packages/61/b1/bc31bb08358be683832996510f0fc43d5e4e88666737bd88d5bfcff6be2a/llama_index_tools_shopify-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c95ab702745c412cc2b1f81b178ce57c2a39bc0a3126608ed64762b80b1d8f2d",
                "md5": "3141d5205c1188f854f949b8e6b09eee",
                "sha256": "70bbb0a7b2224cf8aa00ab8628d5b721113747fce0d6fa20114cdd10f7b51e98"
            },
            "downloads": -1,
            "filename": "llama_index_tools_shopify-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3141d5205c1188f854f949b8e6b09eee",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 2909,
            "upload_time": "2024-08-22T07:40:36",
            "upload_time_iso_8601": "2024-08-22T07:40:36.519406Z",
            "url": "https://files.pythonhosted.org/packages/c9/5a/b702745c412cc2b1f81b178ce57c2a39bc0a3126608ed64762b80b1d8f2d/llama_index_tools_shopify-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 07:40:36",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-tools-shopify"
}
        
Elapsed time: 0.71185s