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

Support for Request Body containing Reference : OpenAPI functions #19751

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

anujmehta
Copy link

@anujmehta anujmehta commented Mar 29, 2024

Thank you for contributing to LangChain!

  • PR title: "package: description"

    • Where "package" is whichever of langchain, community, core, experimental, etc. is being modified. Use "docs: ..." for purely docs changes, "templates: ..." for template changes, "infra: ..." for CI changes.
    • Example: "community: add foobar LLM"
  • PR message: Delete this entire checklist and replace with

    • Description: In OpenAPI spec for a POST method if the request body contains a Reference to another object then the schema of the Reference object is not sent to LLM and it leads to LLM creating incorrect payload. Additionally for a complex payload the schema was not sent to LLM. The PR tries resolves such issues.
      -In below screenshot we have a complex payload and this PR tries to handle schema of "address" and "hobbies" attributes as shown below

Screenshot 2024-03-31 at 7 38 21 PM

.

Additional guidelines:

  • Make sure optional dependencies are imported within a function.
  • Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests.
  • Most PRs should not touch more than one package.
  • Changes should be backwards compatible.
  • If you are adding something to community, do not re-import it in langchain.

If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, hwchase17.

Copy link

vercel bot commented Mar 29, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Apr 30, 2024 9:09am

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. 🔌: openai Primarily related to OpenAI integrations 🤖:improvement Medium size change to existing code to handle new use-cases labels Mar 29, 2024
@anujmehta
Copy link
Author

@baskaryan @efriis Can you please review this PR?

Copy link
Collaborator

@baskaryan baskaryan left a comment

Choose a reason for hiding this comment

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

could we add a unit test for this change?

@baskaryan baskaryan added the needs test PR needs to be updated with tests label Mar 29, 2024
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 31, 2024
@anujmehta
Copy link
Author

@baskaryan I had updated the PR with unit tests cases. Also I have tried to add more description here in PR, will add details in linked issue also. Request you to kindly review the PR.

@anujmehta anujmehta requested a review from baskaryan April 1, 2024 09:38
@anujmehta
Copy link
Author

@baskaryan @efriis Please review this PR

@anujmehta
Copy link
Author

anujmehta commented Apr 5, 2024

@baskaryan @dosubot I need small help with this PR. Looks like build was failing due to lint and test failure. I had pushed changes for lint but I am unable to identify solution for test failure which is failing due to module missing. Please let me know whom can I reach out for help?

Looks like my build is failing due to module not found "openapi-pydantic" in following test class https://github.com/anujmehta/langchain/blob/request-body-reference/libs/community/tests/unit_tests/utilities/test_openapi.py. I am unable to find solution for it as the dependency is already present at https://github.com/anujmehta/langchain/blob/request-body-reference/libs/community/pyproject.toml#L22 and is added to extended_testing https://github.com/anujmehta/langchain/blob/request-body-reference/libs/community/pyproject.toml#L244.

@anujmehta
Copy link
Author

@baskaryan @efriis @hwchase17 Gentle reminder. Can you please help me with above query?

@anujmehta
Copy link
Author

@baskaryan @dosubot I need small help with this PR. Looks like build was failing due to lint and test failure. I had pushed changes for lint but I am unable to identify solution for test failure which is failing due to module missing. Please let me know whom can I reach out for help?

Looks like my build is failing due to module not found "openapi-pydantic" in following test class https://github.com/anujmehta/langchain/blob/request-body-reference/libs/community/tests/unit_tests/utilities/test_openapi.py. I am unable to find solution for it as the dependency is already present at https://github.com/anujmehta/langchain/blob/request-body-reference/libs/community/pyproject.toml#L22 and is added to extended_testing https://github.com/anujmehta/langchain/blob/request-body-reference/libs/community/pyproject.toml#L244.

@olgavrou @agola11 @3coins @sjwhitmore I see your valuable contribution to Langchain. Can you please help me in resolving this minor issue so that I can merge the PR?

@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Apr 16, 2024
@baskaryan baskaryan enabled auto-merge (squash) April 25, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:improvement Medium size change to existing code to handle new use-cases lgtm PR looks good. Use to confirm that a PR is ready for merging. needs test PR needs to be updated with tests 🔌: openai Primarily related to OpenAI integrations size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants