Use term keyword according to the official python doc glossary (#11338)

- **Description:** use term keyword according to the official python doc
glossary, see https://docs.python.org/3/glossary.html
  - **Issue:** not applicable
  - **Dependencies:** not applicable
  - **Tag maintainer:** @hwchase17
  - **Twitter handle:** vreyespue
This commit is contained in:
Vicente Reyes
2023-10-03 21:56:08 +02:00
committed by GitHub
parent 39316314fa
commit f3e13e7e5a
29 changed files with 37 additions and 37 deletions

View File

@@ -30,9 +30,9 @@ def initialize_agent(
callback_manager: CallbackManager to use. Global callback manager is used if
not provided. Defaults to None.
agent_path: Path to serialized agent to use.
agent_kwargs: Additional key word arguments to pass to the underlying agent
agent_kwargs: Additional keyword arguments to pass to the underlying agent
tags: Tags to apply to the traced runs.
**kwargs: Additional key word arguments passed to the agent executor
**kwargs: Additional keyword arguments passed to the agent executor
Returns:
An agent executor

View File

@@ -42,7 +42,7 @@ def load_agent_from_config(
config: Config dict to load agent from.
llm: Language model to use as the agent.
tools: List of tools this agent has access to.
**kwargs: Additional key word arguments passed to the agent executor.
**kwargs: Additional keyword arguments passed to the agent executor.
Returns:
An agent executor.
@@ -92,7 +92,7 @@ def load_agent(
Args:
path: Path to the agent file.
**kwargs: Additional key word arguments passed to the agent executor.
**kwargs: Additional keyword arguments passed to the agent executor.
Returns:
An agent executor.

View File

@@ -93,7 +93,7 @@ class AzureMLChatOnlineEndpoint(SimpleChatModel):
the endpoint"""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
@validator("http_client", always=True, allow_reuse=True)
@classmethod

View File

@@ -59,7 +59,7 @@ class BedrockEmbeddings(BaseModel, Embeddings):
equivalent to the modelId property in the list-foundation-models api"""
model_kwargs: Optional[Dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
endpoint_url: Optional[str] = None
"""Needed if you don't want to default to us-east-1 endpoint"""

View File

@@ -45,9 +45,9 @@ class HuggingFaceEmbeddings(BaseModel, Embeddings):
"""Path to store models.
Can be also set by SENTENCE_TRANSFORMERS_HOME environment variable."""
model_kwargs: Dict[str, Any] = Field(default_factory=dict)
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
encode_kwargs: Dict[str, Any] = Field(default_factory=dict)
"""Key word arguments to pass when calling the `encode` method of the model."""
"""Keyword arguments to pass when calling the `encode` method of the model."""
multi_process: bool = False
"""Run encode() on multiple GPUs."""
@@ -133,9 +133,9 @@ class HuggingFaceInstructEmbeddings(BaseModel, Embeddings):
"""Path to store models.
Can be also set by SENTENCE_TRANSFORMERS_HOME environment variable."""
model_kwargs: Dict[str, Any] = Field(default_factory=dict)
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
encode_kwargs: Dict[str, Any] = Field(default_factory=dict)
"""Key word arguments to pass when calling the `encode` method of the model."""
"""Keyword arguments to pass when calling the `encode` method of the model."""
embed_instruction: str = DEFAULT_EMBED_INSTRUCTION
"""Instruction to use for embedding documents."""
query_instruction: str = DEFAULT_QUERY_INSTRUCTION
@@ -212,9 +212,9 @@ class HuggingFaceBgeEmbeddings(BaseModel, Embeddings):
"""Path to store models.
Can be also set by SENTENCE_TRANSFORMERS_HOME environment variable."""
model_kwargs: Dict[str, Any] = Field(default_factory=dict)
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
encode_kwargs: Dict[str, Any] = Field(default_factory=dict)
"""Key word arguments to pass when calling the `encode` method of the model."""
"""Keyword arguments to pass when calling the `encode` method of the model."""
query_instruction: str = DEFAULT_QUERY_BGE_INSTRUCTION_EN
"""Instruction to use for embedding query."""

View File

@@ -33,7 +33,7 @@ class HuggingFaceHubEmbeddings(BaseModel, Embeddings):
task: Optional[str] = "feature-extraction"
"""Task to call the model with."""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
huggingfacehub_api_token: Optional[str] = None

View File

@@ -90,7 +90,7 @@ class SagemakerEndpointEmbeddings(BaseModel, Embeddings):
""" # noqa: E501
model_kwargs: Optional[Dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
endpoint_kwargs: Optional[Dict] = None
"""Optional attributes passed to the invoke_endpoint

View File

@@ -86,7 +86,7 @@ class SelfHostedHuggingFaceEmbeddings(SelfHostedEmbeddings):
model_load_fn: Callable = load_embedding_model
"""Function to load the model remotely on the server."""
load_fn_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model load function."""
"""Keyword arguments to pass to the model load function."""
inference_fn: Callable = _embed_documents
"""Inference function to extract the embeddings."""

View File

@@ -36,7 +36,7 @@ class AmazonAPIGateway(LLM):
"""API Gateway HTTP Headers to send, e.g. for authentication"""
model_kwargs: Optional[Dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
content_handler: ContentHandlerAmazonAPIGateway = ContentHandlerAmazonAPIGateway()
"""The content handler class that provides an input and

View File

@@ -36,7 +36,7 @@ class Anyscale(LLM):
"""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model. Reserved for future use"""
"""Keyword arguments to pass to the model. Reserved for future use"""
anyscale_service_url: Optional[str] = None
anyscale_service_route: Optional[str] = None

View File

@@ -230,7 +230,7 @@ class AzureMLOnlineEndpoint(LLM, BaseModel):
the endpoint"""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
@validator("http_client", always=True, allow_reuse=True)
@classmethod

View File

@@ -147,7 +147,7 @@ class BedrockBase(BaseModel, ABC):
equivalent to the modelId property in the list-foundation-models api"""
model_kwargs: Optional[Dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
endpoint_url: Optional[str] = None
"""Needed if you don't want to default to us-east-1 endpoint"""

View File

@@ -28,7 +28,7 @@ class ChatGLM(LLM):
endpoint_url: str = "http://127.0.0.1:8000/"
"""Endpoint URL to use."""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
max_token: int = 20000
"""Max token allowed to pass to the model."""
temperature: float = 0.1

View File

@@ -28,7 +28,7 @@ class DeepSparse(LLM):
"""The path to a model file or directory or the name of a SparseZoo model stub."""
model_config: Optional[Dict[str, Any]] = None
"""Key word arguments passed to the pipeline construction.
"""Keyword arguments passed to the pipeline construction.
Common parameters are sequence_length, prompt_sequence_length"""
generation_config: Union[None, str, Dict] = None

View File

@@ -54,7 +54,7 @@ class GradientLLM(LLM):
"""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
gradient_api_url: str = "https://api.gradient.ai/api"
"""Endpoint URL to use."""

View File

@@ -39,7 +39,7 @@ class HuggingFaceEndpoint(LLM):
"""Task to call the model with.
Should be a task that returns `generated_text` or `summary_text`."""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
huggingfacehub_api_token: Optional[str] = None

View File

@@ -33,7 +33,7 @@ class HuggingFaceHub(LLM):
"""Task to call the model with.
Should be a task that returns `generated_text` or `summary_text`."""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
huggingfacehub_api_token: Optional[str] = None

View File

@@ -53,9 +53,9 @@ class HuggingFacePipeline(BaseLLM):
model_id: str = DEFAULT_MODEL_ID
"""Model name to use."""
model_kwargs: Optional[dict] = None
"""Key word arguments passed to the model."""
"""Keyword arguments passed to the model."""
pipeline_kwargs: Optional[dict] = None
"""Key word arguments passed to the pipeline."""
"""Keyword arguments passed to the pipeline."""
batch_size: int = DEFAULT_BATCH_SIZE
"""Batch size to use when passing multiple documents to generate."""

View File

@@ -53,7 +53,7 @@ class MosaicML(LLM):
inject_instruction_format: bool = False
"""Whether to inject the instruction format into the prompt."""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
retry_sleep: float = 1.0
"""How long to try sleeping for if a rate limit is encountered"""

View File

@@ -40,7 +40,7 @@ class OctoAIEndpoint(LLM):
"""Endpoint URL to use."""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
octoai_api_token: Optional[str] = None
"""OCTOAI API Token"""

View File

@@ -88,7 +88,7 @@ class OpenLLM(LLM):
"""Initialize this LLM instance in current process by default. Should
only set to False when using in conjunction with BentoML Service."""
llm_kwargs: Dict[str, Any]
"""Key word arguments to be passed to openllm.LLM"""
"""Keyword arguments to be passed to openllm.LLM"""
_runner: Optional[openllm.LLMRunner] = PrivateAttr(default=None)
_client: Union[

View File

@@ -171,7 +171,7 @@ class SagemakerEndpoint(LLM):
"""
model_kwargs: Optional[Dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
endpoint_kwargs: Optional[Dict] = None
"""Optional attributes passed to the invoke_endpoint

View File

@@ -132,7 +132,7 @@ class SelfHostedPipeline(LLM):
model_load_fn: Callable
"""Function to load the model remotely on the server."""
load_fn_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model load function."""
"""Keyword arguments to pass to the model load function."""
model_reqs: List[str] = ["./", "torch"]
"""Requirements to install on hardware to inference the model."""

View File

@@ -158,7 +158,7 @@ class SelfHostedHuggingFaceLLM(SelfHostedPipeline):
device: int = 0
"""Device to use for inference. -1 for CPU, 0 for GPU, 1 for second GPU, etc."""
model_kwargs: Optional[dict] = None
"""Key word arguments to pass to the model."""
"""Keyword arguments to pass to the model."""
hardware: Any
"""Remote hardware to send the inference function to."""
model_reqs: List[str] = ["./", "transformers", "torch"]

View File

@@ -80,7 +80,7 @@ class Xinference(LLM):
model_uid: Optional[str]
"""UID of the launched model"""
model_kwargs: Dict[str, Any]
"""Key word arguments to be passed to xinference.LLM"""
"""Keyword arguments to be passed to xinference.LLM"""
def __init__(
self,

View File

@@ -53,7 +53,7 @@ Dates are also represented as str.
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
class Highlight(BaseModel, extra=Extra.allow): # type: ignore[call-arg]
"""Information that highlights the key words in the excerpt."""
"""Information that highlights the keywords in the excerpt."""
BeginOffset: int
"""The zero-based location in the excerpt where the highlight starts."""

View File

@@ -20,7 +20,7 @@ def test_does_not_allow_args() -> None:
def test_does_not_allow_extra_kwargs() -> None:
"""Test formatting does not allow extra key word arguments."""
"""Test formatting does not allow extra keyword arguments."""
template = "This is a {foo} test."
with pytest.raises(KeyError):
formatter.format(template, foo="good", bar="oops")