-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model features : json mode #108
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raspawar it is great that users can bind() to use json mode. in addition, the structured output needs to support this, see https://python.langchain.com/docs/how_to/structured_output/#advanced-specifying-the-method-for-structuring-outputs and https://github.com/langchain-ai/langchain-nvidia/blob/main/libs/ai-endpoints/langchain_nvidia_ai_endpoints/chat_models.py#L776
@@ -647,8 +672,11 @@ def bind_functions( | |||
# as a result need to type ignore for the schema parameter and return type. | |||
def with_structured_output( # type: ignore | |||
self, | |||
schema: Union[Dict, Type], | |||
schema: Optional[Union[Dict, Type]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the base class' signature does not let schema=None. why make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. consider removing the function_calling option since it's ignored and default to json_schema.
Json Mode:
Validated the json mode support models.
~18 models from API catalogue support json mode.
Example usage in Notebook and test cases for json mode support.
cc: @sumitkbh