mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-03 03:38:06 +00:00
langchain-nomic[patch]: Add ruff bandit rules to linter (#31805)
- Add ruff bandit rules - Some formatting
This commit is contained in:
parent
0279af60b5
commit
404d8408f4
@ -10,6 +10,7 @@ class NomicEmbeddings(Embeddings):
|
|||||||
"""NomicEmbeddings embedding model.
|
"""NomicEmbeddings embedding model.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain_nomic import NomicEmbeddings
|
from langchain_nomic import NomicEmbeddings
|
||||||
@ -66,16 +67,16 @@ class NomicEmbeddings(Embeddings):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
model: model name
|
model: model name
|
||||||
nomic_api_key: optionally, set the Nomic API key. Uses the NOMIC_API_KEY
|
nomic_api_key: optionally, set the Nomic API key. Uses the ``NOMIC_API_KEY``
|
||||||
environment variable by default.
|
environment variable by default.
|
||||||
dimensionality: The embedding dimension, for use with Matryoshka-capable
|
dimensionality: The embedding dimension, for use with Matryoshka-capable
|
||||||
models. Defaults to full-size.
|
models. Defaults to full-size.
|
||||||
inference_mode: How to generate embeddings. One of `remote`, `local`
|
inference_mode: How to generate embeddings. One of ``'remote'``, ``'local'``
|
||||||
(Embed4All), or `dynamic` (automatic). Defaults to `remote`.
|
(Embed4All), or ``'dynamic'`` (automatic). Defaults to ``'remote'``.
|
||||||
device: The device to use for local embeddings. Choices include
|
device: The device to use for local embeddings. Choices include
|
||||||
`cpu`, `gpu`, `nvidia`, `amd`, or a specific device name. See
|
``'cpu'``, ``'gpu'``, ``'nvidia'``, ``'amd'``, or a specific device
|
||||||
the docstring for `GPT4All.__init__` for more info. Typically
|
name. See the docstring for ``GPT4All.__init__`` for more info.
|
||||||
defaults to CPU. Do not use on macOS.
|
Typically defaults to ``'cpu'``. Do not use on macOS.
|
||||||
"""
|
"""
|
||||||
_api_key = nomic_api_key or os.environ.get("NOMIC_API_KEY")
|
_api_key = nomic_api_key or os.environ.get("NOMIC_API_KEY")
|
||||||
if _api_key:
|
if _api_key:
|
||||||
@ -91,8 +92,8 @@ class NomicEmbeddings(Embeddings):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
texts: list of texts to embed
|
texts: list of texts to embed
|
||||||
task_type: the task type to use when embedding. One of `search_query`,
|
task_type: the task type to use when embedding. One of ``'search_query'``,
|
||||||
`search_document`, `classification`, `clustering`
|
``'search_document'``, ``'classification'``, ``'clustering'``
|
||||||
"""
|
"""
|
||||||
|
|
||||||
output = embed.text(
|
output = embed.text(
|
||||||
|
@ -50,6 +50,7 @@ select = [
|
|||||||
"I", # isort
|
"I", # isort
|
||||||
"T201", # print
|
"T201", # print
|
||||||
"UP", # pyupgrade
|
"UP", # pyupgrade
|
||||||
|
"S", # security
|
||||||
]
|
]
|
||||||
ignore = [ "UP007", ]
|
ignore = [ "UP007", ]
|
||||||
|
|
||||||
@ -77,3 +78,9 @@ markers = [
|
|||||||
"compile: mark placeholder test used to compile integration tests without running them",
|
"compile: mark placeholder test used to compile integration tests without running them",
|
||||||
]
|
]
|
||||||
asyncio_mode = "auto"
|
asyncio_mode = "auto"
|
||||||
|
|
||||||
|
[tool.ruff.lint.extend-per-file-ignores]
|
||||||
|
"tests/**/*.py" = [
|
||||||
|
"S101", # Tests need assertions
|
||||||
|
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
|
||||||
|
]
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user