Skip to content
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

anthropic[minor]: fix nested object fixArrayXMLParameters #4778

Merged
merged 3 commits into from
Mar 16, 2024

Conversation

alvarosevilla95
Copy link
Contributor

When parsing a nested object in fixArrayXMLParameters, the base schema is passed on the recursive call. This causes a mismatch between the xml object (the nested type) and the schema (still the base type)

I'm not very happy with type assertion for the schema, not sure what's the correct check to make here though.

When parsing a nested object in fixArrayXMLParameters, the base schema
is passed on the recursive call. This causes a mismatch between the xml
object (the nested type) and the schema (still the base type)

I'm not very happy with type assertion for the schema, not sure what's
the correct check to make here though.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 15, 2024
Copy link

vercel bot commented Mar 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 15, 2024 11:49pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview Mar 15, 2024 11:49pm

@jacoblee93
Copy link
Collaborator

@davidfant I think you had this in your PR initially too?

@jacoblee93
Copy link
Collaborator

jacoblee93 commented Mar 15, 2024

Thank you! Seems to work for me!

@@ -100,7 +100,10 @@ export function fixArrayXMLParameters(
typeof xmlParameters[key] === "object" &&
xmlParameters[key] !== null
) {
fixedParameters[key] = fixArrayXMLParameters(schema, xmlParameters[key]);
fixedParameters[key] = fixArrayXMLParameters(
schema.properties[key] as JsonSchema7ObjectType,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidfant had:

{
        ...schema.properties[key],
        definitions: schema.definitions,
}

for the first arg - does that make sense here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break JSON schema definitions. TBH I'm not sure how well this XML situation would even work with JSON schema definitions though, so it might not practically matter, but I'd still prefer adding in definitions

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change it to yours

@jacoblee93 jacoblee93 added question Further information is requested lgtm PRs that are ready to be merged as-is labels Mar 15, 2024
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Mar 15, 2024
@jacoblee93 jacoblee93 merged commit d7cdbfd into langchain-ai:main Mar 16, 2024
17 checks passed
@jacoblee93
Copy link
Collaborator

Thank you both!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature lgtm PRs that are ready to be merged as-is question Further information is requested size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants