subquery


Namesubquery JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryA package to generate subqueries and follow-up questions
upload_time2024-08-16 22:26:59
maintainerNone
docs_urlNone
authorandthattoo
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Subquery

`Subquery` generates subqueries and follow-up questions for a given input question.
Using the EXTREMELY SMOLL LLM [subquery-SmolLM](https://huggingface.co/andthattoo/subquery-SmolLM)
It's a finetuned model based on [nisten/Biggie-SmoLlm-0.15B-Base](https://huggingface.co/nisten/Biggie-SmoLlm-0.15B-Base)

tiny as 150M (or 180M) parameters and thanks to wonderful work by Nisten and Huggingface's [SmolLM-135M](https://huggingface.co/HuggingFaceTB/SmolLM-135M)

It can run both with `transformers` and `ollama` backends.
Ollama based GGUF model runs at 160 tps for 1 CPU. 

yes.

It can do two things:

1. Generate subqueries for a given question.
![q1](misc/ss1.jpg)
2. Generate follow-up questions for a vague question.
![q2](misc/ss2.jpg)

This package wraps the model and provides a simple interface to generate subqueries and follow-up questions.

## Installation

You can install the package with

```
pip install subquery
```

## Usage
For Transformers
```python
from subquery import TransformersSubqueryGenerator

# Using the Transformers backend
generator = TransformersSubqueryGenerator()
result = generator.generate("What is this?")

print("Follow-up questions:", result.follow_up)
print("Subqueries:", result.subquery)
```
For Ollama
```python
from subquery import OllamaSubqueryGenerator
# Using the Ollama backend
generator = OllamaSubqueryGenerator()
result = generator.generate("Are the Indiana Harbor and Ship Canal and the Folsom South Canal in the same state?")

print("Follow-up questions:", result.follow_up)
print("Subqueries:", result.subquery)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "subquery",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "andthattoo",
    "author_email": "omer@firstbatch.xyz",
    "download_url": "https://files.pythonhosted.org/packages/16/51/af2aaf6b4754a1e173248206863f0bb63c739bde37940ea1e32ae2a10c79/subquery-0.1.2.tar.gz",
    "platform": null,
    "description": "# Subquery\n\n`Subquery` generates subqueries and follow-up questions for a given input question.\nUsing the EXTREMELY SMOLL LLM [subquery-SmolLM](https://huggingface.co/andthattoo/subquery-SmolLM)\nIt's a finetuned model based on [nisten/Biggie-SmoLlm-0.15B-Base](https://huggingface.co/nisten/Biggie-SmoLlm-0.15B-Base)\n\ntiny as 150M (or 180M) parameters and thanks to wonderful work by Nisten and Huggingface's [SmolLM-135M](https://huggingface.co/HuggingFaceTB/SmolLM-135M)\n\nIt can run both with `transformers` and `ollama` backends.\nOllama based GGUF model runs at 160 tps for 1 CPU. \n\nyes.\n\nIt can do two things:\n\n1. Generate subqueries for a given question.\n![q1](misc/ss1.jpg)\n2. Generate follow-up questions for a vague question.\n![q2](misc/ss2.jpg)\n\nThis package wraps the model and provides a simple interface to generate subqueries and follow-up questions.\n\n## Installation\n\nYou can install the package with\n\n```\npip install subquery\n```\n\n## Usage\nFor Transformers\n```python\nfrom subquery import TransformersSubqueryGenerator\n\n# Using the Transformers backend\ngenerator = TransformersSubqueryGenerator()\nresult = generator.generate(\"What is this?\")\n\nprint(\"Follow-up questions:\", result.follow_up)\nprint(\"Subqueries:\", result.subquery)\n```\nFor Ollama\n```python\nfrom subquery import OllamaSubqueryGenerator\n# Using the Ollama backend\ngenerator = OllamaSubqueryGenerator()\nresult = generator.generate(\"Are the Indiana Harbor and Ship Canal and the Folsom South Canal in the same state?\")\n\nprint(\"Follow-up questions:\", result.follow_up)\nprint(\"Subqueries:\", result.subquery)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package to generate subqueries and follow-up questions",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f61225501d59fc5b0816b6be2a8bb01ce7c10e821503387de627d6db6e55bd0",
                "md5": "85dcc4a4dc2988d9186e20c20ae21a5b",
                "sha256": "fa5145bdc89cf9b3f4a5d50809753bf2a118ca648f29362c4e9062f4de2f8d56"
            },
            "downloads": -1,
            "filename": "subquery-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "85dcc4a4dc2988d9186e20c20ae21a5b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 4265,
            "upload_time": "2024-08-16T22:26:58",
            "upload_time_iso_8601": "2024-08-16T22:26:58.497854Z",
            "url": "https://files.pythonhosted.org/packages/7f/61/225501d59fc5b0816b6be2a8bb01ce7c10e821503387de627d6db6e55bd0/subquery-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1651af2aaf6b4754a1e173248206863f0bb63c739bde37940ea1e32ae2a10c79",
                "md5": "c6cb61c6b6f54093fbedf608472ac80e",
                "sha256": "5b89fc5bb4e76003734be9eed1847a34a39edc35317af2a3cff548d820e9f54c"
            },
            "downloads": -1,
            "filename": "subquery-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c6cb61c6b6f54093fbedf608472ac80e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 2895,
            "upload_time": "2024-08-16T22:26:59",
            "upload_time_iso_8601": "2024-08-16T22:26:59.895640Z",
            "url": "https://files.pythonhosted.org/packages/16/51/af2aaf6b4754a1e173248206863f0bb63c739bde37940ea1e32ae2a10c79/subquery-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-16 22:26:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "subquery"
}
        
Elapsed time: 0.36216s