huggingface,box[patch]: Add missing default None (#26323)

This PR was autogenerated using gritql

```
engine marzano(0.1)
language python

class_definition(name=$C, $body, superclasses=$S) where {    
    $C <: ! "Config", // Does not work in this scope, but works after class_definition
    $body <: block($statements),
    $statements <: some bubble assignment(left=$x, right=$y, type=$t) as $A where {
        or {
            $y <: `Field($z)`,
            $x <: "model_config"
        }
    },
    // And has either Any or Optional fields without a default
    $statements <: some bubble assignment(left=$x, right=$y, type=$t) as $A where {
        $t <: or {
            r"Optional.*",
            r"Any",
            r"Union[None, .*]",
            r"Union[.*, None, .*]",
            r"Union[.*, None]",
        },
        $y <: ., // Match empty node        
        $t => `$t = None`,
    },    
}
```


```shell

grit apply 'class_definition(name=$C, $body, superclasses=$S) where {    
    $C <: ! "Config", // Does not work in this scope, but works after class_definition
    $body <: block($statements),
    $statements <: some bubble assignment(left=$x, right=$y, type=$t) as $A where {
        or {
            $y <: `Field($z)`,
            $x <: "model_config"
        }
    },
    // And has either Any or Optional fields without a default
    $statements <: some bubble assignment(left=$x, right=$y, type=$t) as $A where {
        $t <: or {
            r"Optional.*",
            r"Any",
            r"Union[None, .*]",
            r"Union[.*, None, .*]",
            r"Union[.*, None]",
        },
        $y <: ., // Match empty node        
        $t => `$t = None`,
    },    
}
' --language python .

```
This commit is contained in:
Eugene Yurtsev
2024-09-11 11:07:31 -04:00
committed by GitHub
parent d3499cc90b
commit edcd348ce7
4 changed files with 4 additions and 4 deletions

View File

@@ -173,7 +173,7 @@ class BoxLoader(BaseLoader, BaseModel):
"""character_limit is an int that caps the number of characters to
return per document."""
_box: Optional[_BoxAPIWrapper]
_box: Optional[_BoxAPIWrapper] = None
model_config = ConfigDict(
arbitrary_types_allowed=True,

View File

@@ -128,7 +128,7 @@ class BoxRetriever(BaseRetriever):
"""character_limit is an int that caps the number of characters to
return per document."""
_box: Optional[_BoxAPIWrapper]
_box: Optional[_BoxAPIWrapper] = None
model_config = ConfigDict(
arbitrary_types_allowed=True,

View File

@@ -485,7 +485,7 @@ class _BoxAPIWrapper(BaseModel):
"""character_limit is an int that caps the number of characters to
return per document."""
_box: Optional[box_sdk_gen.BoxClient]
_box: Optional[box_sdk_gen.BoxClient] = None
model_config = ConfigDict(
arbitrary_types_allowed=True,

View File

@@ -54,7 +54,7 @@ class HuggingFacePipeline(BaseLLM):
hf = HuggingFacePipeline(pipeline=pipe)
"""
pipeline: Any #: :meta private:
pipeline: Any = None #: :meta private:
model_id: str = DEFAULT_MODEL_ID
"""Model name to use."""
model_kwargs: Optional[dict] = None