voyageai 0.1.0__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.

Potentially problematic release.


This version of voyageai might be problematic. Click here for more details.

voyageai-0.1.0/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2023 OpenAI (https://openai.com)
4
+
5
+ Copyright (c) 2023 VoyageAI (https://voyageai.com)
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.1
2
+ Name: voyageai
3
+ Version: 0.1.0
4
+ Summary:
5
+ Author: Yujie Qian
6
+ Author-email: yujieq@voyageai.com
7
+ Requires-Python: >=3.7.1,<4.0.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Requires-Dist: aiohttp (>=3.5,<4.0)
14
+ Requires-Dist: pandas (>=1.2.3)
15
+ Requires-Dist: plotly (>=5.0.0)
16
+ Requires-Dist: requests (>=2.20,<3.0)
17
+ Requires-Dist: scikit-learn (>=1.0.2)
18
+ Requires-Dist: tenacity (>=8.0.1)
19
+ Description-Content-Type: text/markdown
20
+
21
+ # VoyageAI Python Library
22
+ The VoyageAI Python library provides convenient access to the VoyageAI API.
23
+
24
+ ## Installation
25
+ Use `pip` to install the package:
26
+ ```bash
27
+ pip install voyageai
28
+ ```
29
+
30
+ ## Usage
31
+ First, import the libary at the top of a file:
32
+ ```python
33
+ import voyageai
34
+ ```
35
+ The library needs to be configured with your VoyageAI API key. Either set it as the `VOYAGEAI_API_KEY` environment variable before using the library:
36
+ ```bash
37
+ export VOYAGEAI_API_KEY="[ Your VoyageAI API key ]"
38
+ ```
39
+ Or set voyageai.api_key to its value:
40
+ ```python
41
+ voyageai.api_key = "[ Your VoyageAI API key ]"
42
+ ```
43
+
44
+ ### Embedding
45
+ The VoyageAI embedding is accessible through our API (see documentation at ...). This library provides Python SDKs for calling the embedding API.
46
+ ```python
47
+ text = "This is a sample text."
48
+ model = "voyage-api-v0"
49
+ embedding = voyageai.Embedding.create(input=text, model=model)["data"][0]["embedding"]
50
+ ```
51
+
@@ -0,0 +1,30 @@
1
+ # VoyageAI Python Library
2
+ The VoyageAI Python library provides convenient access to the VoyageAI API.
3
+
4
+ ## Installation
5
+ Use `pip` to install the package:
6
+ ```bash
7
+ pip install voyageai
8
+ ```
9
+
10
+ ## Usage
11
+ First, import the libary at the top of a file:
12
+ ```python
13
+ import voyageai
14
+ ```
15
+ The library needs to be configured with your VoyageAI API key. Either set it as the `VOYAGEAI_API_KEY` environment variable before using the library:
16
+ ```bash
17
+ export VOYAGEAI_API_KEY="[ Your VoyageAI API key ]"
18
+ ```
19
+ Or set voyageai.api_key to its value:
20
+ ```python
21
+ voyageai.api_key = "[ Your VoyageAI API key ]"
22
+ ```
23
+
24
+ ### Embedding
25
+ The VoyageAI embedding is accessible through our API (see documentation at ...). This library provides Python SDKs for calling the embedding API.
26
+ ```python
27
+ text = "This is a sample text."
28
+ model = "voyage-api-v0"
29
+ embedding = voyageai.Embedding.create(input=text, model=model)["data"][0]["embedding"]
30
+ ```
@@ -0,0 +1,23 @@
1
+ [tool.poetry]
2
+ name = "voyageai"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["Yujie Qian <yujieq@voyageai.com>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.dependencies]
9
+ python = "^3.7.1"
10
+ requests = "^2.20"
11
+ aiohttp = "^3.5"
12
+ scikit-learn = ">=1.0.2"
13
+ tenacity = ">=8.0.1"
14
+ plotly = ">=5.0.0"
15
+ pandas = ">=1.2.3"
16
+
17
+ [tool.poetry.group.test.dependencies]
18
+ pytest = "^7.4.2"
19
+ pytest-asyncio = "^0.21.1"
20
+
21
+ [build-system]
22
+ requires = ["poetry-core"]
23
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,55 @@
1
+ # VoyageAI Python bindings.
2
+ #
3
+ # Originally forked from the MIT-licensed Stripe Python bindings.
4
+
5
+ import os
6
+ import sys
7
+ from typing import TYPE_CHECKING, Optional, Union, Callable
8
+
9
+ from contextvars import ContextVar
10
+
11
+ if "pkg_resources" not in sys.modules:
12
+ # workaround for the following:
13
+ # https://github.com/benoitc/gunicorn/pull/2539
14
+ sys.modules["pkg_resources"] = object() # type: ignore[assignment]
15
+ import aiohttp
16
+
17
+ del sys.modules["pkg_resources"]
18
+
19
+ from voyageai.api_resources import Embedding
20
+ from voyageai.error import APIError, InvalidRequestError, VoyageAIError
21
+ from voyageai.version import VERSION
22
+ from voyageai.embeddings_utils import get_embedding, get_embeddings, aget_embedding, aget_embeddings
23
+
24
+ if TYPE_CHECKING:
25
+ import requests
26
+ from aiohttp import ClientSession
27
+
28
+ api_key = os.environ.get("VOYAGEAI_API_KEY")
29
+ # Path of a file with an API key, whose contents can change. Supercedes
30
+ # `api_key` if set. The main use case is volume-mounted Kubernetes secrets,
31
+ # which are updated automatically.
32
+ api_key_path: Optional[str] = os.environ.get("VOYAGEAI_API_KEY_PATH")
33
+
34
+ organization = os.environ.get("VOYAGEAI_ORGANIZATION")
35
+ api_base = os.environ.get("VOYAGEAI_API_BASE", "http://api.voyageai.com/stage/api/v0")
36
+ api_type = os.environ.get("VOYAGEAI_API_TYPE", "voyageai")
37
+ api_version = os.environ.get("VOYAGEAI_API_VERSION", None)
38
+ verify_ssl_certs = True # No effect. Certificates are always verified.
39
+ proxy = None
40
+ app_info = None
41
+ enable_telemetry = False # Ignored; the telemetry feature was removed.
42
+ ca_bundle_path = None # No longer used, feature was removed
43
+ debug = False
44
+ log = None # Set to either 'debug' or 'info', controls console logging
45
+
46
+ requestssession: Optional[
47
+ Union["requests.Session", Callable[[], "requests.Session"]]
48
+ ] = None # Provide a requests.Session or Session factory.
49
+
50
+ aiosession: ContextVar[Optional["ClientSession"]] = ContextVar(
51
+ "aiohttp-session", default=None
52
+ ) # Acts as a global aiohttp ClientSession that reuses connections.
53
+ # This is user-supplied; otherwise, a session is remade for each request.
54
+
55
+ __version__ = VERSION