mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 12:05:54 +00:00
Compare commits
1 Commits
feat/multi
...
fix/utils-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa4d46fd87 |
@@ -83,7 +83,7 @@ def get_func_schema(function: typing.Callable) -> dict:
|
|||||||
|
|
||||||
parameters['properties'][param.name] = {
|
parameters['properties'][param.name] = {
|
||||||
'type': param_type,
|
'type': param_type,
|
||||||
'description': args_doc[param.name],
|
'description': args_doc.get(param.name, ''),
|
||||||
}
|
}
|
||||||
|
|
||||||
# add schema for array
|
# add schema for array
|
||||||
|
|||||||
15
tests/unit_tests/utils/test_funcschema.py
Normal file
15
tests/unit_tests/utils/test_funcschema.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
from langbot.pkg.utils.funcschema import get_func_schema
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_func_schema_uses_empty_description_for_undocumented_parameter():
|
||||||
|
def sample_function(documented: str, undocumented: int):
|
||||||
|
"""Sample function.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
documented(str): documented parameter description
|
||||||
|
"""
|
||||||
|
|
||||||
|
schema = get_func_schema(sample_function)
|
||||||
|
|
||||||
|
assert schema['parameters']['properties']['documented']['description'] == 'documented parameter description'
|
||||||
|
assert schema['parameters']['properties']['undocumented']['description'] == ''
|
||||||
Reference in New Issue
Block a user