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.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from langchain_nomic import NomicEmbeddings
|
||||
@ -66,16 +67,16 @@ class NomicEmbeddings(Embeddings):
|
||||
|
||||
Args:
|
||||
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.
|
||||
dimensionality: The embedding dimension, for use with Matryoshka-capable
|
||||
models. Defaults to full-size.
|
||||
inference_mode: How to generate embeddings. One of `remote`, `local`
|
||||
(Embed4All), or `dynamic` (automatic). Defaults to `remote`.
|
||||
inference_mode: How to generate embeddings. One of ``'remote'``, ``'local'``
|
||||
(Embed4All), or ``'dynamic'`` (automatic). Defaults to ``'remote'``.
|
||||
device: The device to use for local embeddings. Choices include
|
||||
`cpu`, `gpu`, `nvidia`, `amd`, or a specific device name. See
|
||||
the docstring for `GPT4All.__init__` for more info. Typically
|
||||
defaults to CPU. Do not use on macOS.
|
||||
``'cpu'``, ``'gpu'``, ``'nvidia'``, ``'amd'``, or a specific device
|
||||
name. See the docstring for ``GPT4All.__init__`` for more info.
|
||||
Typically defaults to ``'cpu'``. Do not use on macOS.
|
||||
"""
|
||||
_api_key = nomic_api_key or os.environ.get("NOMIC_API_KEY")
|
||||
if _api_key:
|
||||
@ -91,8 +92,8 @@ class NomicEmbeddings(Embeddings):
|
||||
|
||||
Args:
|
||||
texts: list of texts to embed
|
||||
task_type: the task type to use when embedding. One of `search_query`,
|
||||
`search_document`, `classification`, `clustering`
|
||||
task_type: the task type to use when embedding. One of ``'search_query'``,
|
||||
``'search_document'``, ``'classification'``, ``'clustering'``
|
||||
"""
|
||||
|
||||
output = embed.text(
|
||||
|
@ -50,6 +50,7 @@ select = [
|
||||
"I", # isort
|
||||
"T201", # print
|
||||
"UP", # pyupgrade
|
||||
"S", # security
|
||||
]
|
||||
ignore = [ "UP007", ]
|
||||
|
||||
@ -77,3 +78,9 @@ markers = [
|
||||
"compile: mark placeholder test used to compile integration tests without running them",
|
||||
]
|
||||
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