exa-py


Nameexa-py JSON
Version 1.7.2 PyPI version JSON
download
home_pagehttps://github.com/exa-labs/exa-py
SummaryPython SDK for Exa API.
upload_time2025-01-14 15:55:51
maintainerNone
docs_urlNone
authorExa
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Exa

Exa (formerly Metaphor) API in Python

Note: This API is basically the same as `metaphor-python` but reflects new
features associated with Metaphor's rename to Exa. New site is https://exa.ai

## Installation

```bash
pip install exa_py
```

## Usage

Import the package and initialize the Exa client with your API key:

```python
from exa_py import Exa

exa = Exa(api_key="your-api-key")
```

## Common requests
```python

  # basic search
  results = exa.search("This is a Exa query:")

  # autoprompted search
  results = exa.search("autopromptable query", use_autoprompt=True)

  # keyword search (non-neural)
  results = exa.search("Google-style query", type="keyword")

  # search with date filters
  results = exa.search("This is a Exa query:", start_published_date="2019-01-01", end_published_date="2019-01-31")

  # search with domain filters
  results = exa.search("This is a Exa query:", include_domains=["www.cnn.com", "www.nytimes.com"])

  # search and get text contents
  results = exa.search_and_contents("This is a Exa query:")

  # search and get highlights
  results = exa.search_and_contents("This is a Exa query:", highlights=True)

  # search and get contents with contents options
  results = exa.search_and_contents("This is a Exa query:", 
                                    text={"include_html_tags": True, "max_characters": 1000}, 
                                    highlights={"highlights_per_url": 2, "num_sentences": 1, "query": "This is the highlight query:"})
                                    
  # find similar documents
  results = exa.find_similar("https://example.com")

  # find similar excluding source domain
  results = exa.find_similar("https://example.com", exclude_source_domain=True)

  # find similar with contents
  results = exa.find_similar_and_contents("https://example.com", text=True, highlights=True)

  # get text contents
  results = exa.get_contents(["ids"])

  # get highlights
  results = exa.get_contents(["ids"], highlights=True)

  # get contents with contents options
  results = exa.get_contents(["ids"], 
                             text={"include_html_tags": True, "max_characters": 1000}, 
                             highlights={"highlights_per_url": 2, "num_sentences": 1, "query": "This is the highlight query:"})
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/exa-labs/exa-py",
    "name": "exa-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Exa",
    "author_email": "hello@exa.ai",
    "download_url": "https://files.pythonhosted.org/packages/d3/44/04dc99245195cd155cfd8c5958c7778480a12908472d2f5ae32585f54448/exa_py-1.7.2.tar.gz",
    "platform": null,
    "description": "# Exa\n\nExa (formerly Metaphor) API in Python\n\nNote: This API is basically the same as `metaphor-python` but reflects new\nfeatures associated with Metaphor's rename to Exa. New site is https://exa.ai\n\n## Installation\n\n```bash\npip install exa_py\n```\n\n## Usage\n\nImport the package and initialize the Exa client with your API key:\n\n```python\nfrom exa_py import Exa\n\nexa = Exa(api_key=\"your-api-key\")\n```\n\n## Common requests\n```python\n\n  # basic search\n  results = exa.search(\"This is a Exa query:\")\n\n  # autoprompted search\n  results = exa.search(\"autopromptable query\", use_autoprompt=True)\n\n  # keyword search (non-neural)\n  results = exa.search(\"Google-style query\", type=\"keyword\")\n\n  # search with date filters\n  results = exa.search(\"This is a Exa query:\", start_published_date=\"2019-01-01\", end_published_date=\"2019-01-31\")\n\n  # search with domain filters\n  results = exa.search(\"This is a Exa query:\", include_domains=[\"www.cnn.com\", \"www.nytimes.com\"])\n\n  # search and get text contents\n  results = exa.search_and_contents(\"This is a Exa query:\")\n\n  # search and get highlights\n  results = exa.search_and_contents(\"This is a Exa query:\", highlights=True)\n\n  # search and get contents with contents options\n  results = exa.search_and_contents(\"This is a Exa query:\", \n                                    text={\"include_html_tags\": True, \"max_characters\": 1000}, \n                                    highlights={\"highlights_per_url\": 2, \"num_sentences\": 1, \"query\": \"This is the highlight query:\"})\n                                    \n  # find similar documents\n  results = exa.find_similar(\"https://example.com\")\n\n  # find similar excluding source domain\n  results = exa.find_similar(\"https://example.com\", exclude_source_domain=True)\n\n  # find similar with contents\n  results = exa.find_similar_and_contents(\"https://example.com\", text=True, highlights=True)\n\n  # get text contents\n  results = exa.get_contents([\"ids\"])\n\n  # get highlights\n  results = exa.get_contents([\"ids\"], highlights=True)\n\n  # get contents with contents options\n  results = exa.get_contents([\"ids\"], \n                             text={\"include_html_tags\": True, \"max_characters\": 1000}, \n                             highlights={\"highlights_per_url\": 2, \"num_sentences\": 1, \"query\": \"This is the highlight query:\"})\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python SDK for Exa API.",
    "version": "1.7.2",
    "project_urls": {
        "Homepage": "https://github.com/exa-labs/exa-py"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb77edd21ccf01b811c3603423ca6883a4b8e32ffee9f77fd796a65dc9caa46a",
                "md5": "6f5d564d07cd4fc4a7381fd71a3b459d",
                "sha256": "6fd6db235f6a84c9ddfe5b6108a6f897ea80fdf98b16021222e2b3712627af26"
            },
            "downloads": -1,
            "filename": "exa_py-1.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6f5d564d07cd4fc4a7381fd71a3b459d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10003,
            "upload_time": "2025-01-14T15:55:46",
            "upload_time_iso_8601": "2025-01-14T15:55:46.407222Z",
            "url": "https://files.pythonhosted.org/packages/cb/77/edd21ccf01b811c3603423ca6883a4b8e32ffee9f77fd796a65dc9caa46a/exa_py-1.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d34404dc99245195cd155cfd8c5958c7778480a12908472d2f5ae32585f54448",
                "md5": "a01db0f9b2c87f4439952dac90b07f6f",
                "sha256": "a8efaf2fa063be6c8c4576e098dc55d586e1827a5ec5ea14e9dec1e78cb8f0da"
            },
            "downloads": -1,
            "filename": "exa_py-1.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a01db0f9b2c87f4439952dac90b07f6f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10553,
            "upload_time": "2025-01-14T15:55:51",
            "upload_time_iso_8601": "2025-01-14T15:55:51.369768Z",
            "url": "https://files.pythonhosted.org/packages/d3/44/04dc99245195cd155cfd8c5958c7778480a12908472d2f5ae32585f54448/exa_py-1.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-14 15:55:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "exa-labs",
    "github_project": "exa-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "exa-py"
}
        
Exa
Elapsed time: 0.46651s