exa-py


Nameexa-py JSON
Version 1.8.3 PyPI version JSON
download
home_pageNone
SummaryPython SDK for Exa API.
upload_time2025-01-22 06:51:13
maintainerNone
docs_urlNone
authorExa AI
requires_python<4.0,>=3.9
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(["urls"])

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

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

  # basic answer
  response = exa.answer("This is a query to answer a question")

  # answer with expanded queries and full text
  response = exa.answer("This is a query to answer a question", expanded_queries_limit=3, include_text=True)

  # answer with streaming
  response = exa.answer("This is a query to answer with streaming:", stream=True)

  # Print each chunk as it arrives when answer streaming is enabled
  for chunk in response:
    print(chunk)
```



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "exa-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Exa AI",
    "author_email": "hello@exa.ai",
    "download_url": "https://files.pythonhosted.org/packages/ab/ce/03bc2d0c6709a28fd69bba56ec84cc353092e20829ef3711aff874e49735/exa_py-1.8.3.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([\"urls\"])\n\n  # get highlights\n  results = exa.get_contents([\"urls\"], highlights=True)\n\n  # get contents with contents options\n  results = exa.get_contents([\"urls\"], \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  # basic answer\n  response = exa.answer(\"This is a query to answer a question\")\n\n  # answer with expanded queries and full text\n  response = exa.answer(\"This is a query to answer a question\", expanded_queries_limit=3, include_text=True)\n\n  # answer with streaming\n  response = exa.answer(\"This is a query to answer with streaming:\", stream=True)\n\n  # Print each chunk as it arrives when answer streaming is enabled\n  for chunk in response:\n    print(chunk)\n```\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python SDK for Exa API.",
    "version": "1.8.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bca15ec2c4da851849e8859c015a8dba180dfc6ab52bce27a0c1ba9bd123b11d",
                "md5": "044979a5c4c819e20805061e5ce8984c",
                "sha256": "e948afcf578cda946bf85c95d9977d32126b597209a0c10085cfaaf670b8c1bf"
            },
            "downloads": -1,
            "filename": "exa_py-1.8.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "044979a5c4c819e20805061e5ce8984c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 10656,
            "upload_time": "2025-01-22T06:51:12",
            "upload_time_iso_8601": "2025-01-22T06:51:12.546308Z",
            "url": "https://files.pythonhosted.org/packages/bc/a1/5ec2c4da851849e8859c015a8dba180dfc6ab52bce27a0c1ba9bd123b11d/exa_py-1.8.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "abce03bc2d0c6709a28fd69bba56ec84cc353092e20829ef3711aff874e49735",
                "md5": "520cd7e4583c82f56c59b6cf49f3a49d",
                "sha256": "a5fd0cb38d792105f85ddf3f00863c812c51e7e0e87f9698ec721d79489f0700"
            },
            "downloads": -1,
            "filename": "exa_py-1.8.3.tar.gz",
            "has_sig": false,
            "md5_digest": "520cd7e4583c82f56c59b6cf49f3a49d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 10275,
            "upload_time": "2025-01-22T06:51:13",
            "upload_time_iso_8601": "2025-01-22T06:51:13.562767Z",
            "url": "https://files.pythonhosted.org/packages/ab/ce/03bc2d0c6709a28fd69bba56ec84cc353092e20829ef3711aff874e49735/exa_py-1.8.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-22 06:51:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "exa-py"
}
        
Elapsed time: 0.70330s