-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
OpenAPI Spec - reduce_openapi_spec - maximum recursion depth exceeded #12163
Comments
🤖 Hello, Thank you for reaching out and providing detailed information about the issue you're facing. The To handle large OpenAPI Specs in LangChain without exceeding the maximum recursion depth, you can modify the def recursive_function(node):
if base_case(node):
return some_value
else:
return recursive_function(next_node(node))
# can be converted to:
def iterative_function(start_node):
stack = [start_node]
while stack:
node = stack.pop()
if base_case(node):
return some_value
else:
stack.append(next_node(node)) In this case, you would need to apply a similar transformation to the I hope this helps! If you have any other questions or need further clarification, please don't hesitate to ask. Best, SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
I guess just to test the other capabilities under msgraph_api_spec = reduce_openapi_spec(raw_msgraph_api_spec, dereference=False) However, I believe now I have this massive spec with over 9K endpoints :) . Any help on how to handle those massive OpenAPI specs? |
Hi, @Cyb3rWard0g, I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, you encountered a "maximum recursion depth exceeded" error when using the Is this issue still relevant to the latest version of the LangChain repository? If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or the issue will be automatically closed in 7 days. Thank you for your understanding and contributions to LangChain! If you have any further questions or need assistance, feel free to reach out. |
Hey @Cyb3rWard0g were you able to resolve this or try out the solution by the bot? I am facing the same issue. |
@dosubot
Here is the implementation of the dereference_refs in the /langchain_core/utils/json_schema.py file
|
I noticed the same issue for my open api spec. I think this was an issue of circular dependency. With proposed changes here I was also able to run MS Graph openapi specs. |
**Description:** Circular dependencies when parsing references leading to `RecursionError: maximum recursion depth exceeded` issue. This PR address the issue by handling previously seen refs as in any typical DFS to avoid infinite depths. **Issue:** #12163 **Twitter handle:** https://twitter.com/theBhulawat - [x] **Add tests and docs**: If you're adding a new integration, please include 1. a test for the integration, preferably unit tests that do not rely on network access, 2. an example notebook showing its use. It lives in `docs/docs/integrations` directory. - [x] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ --------- Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
…#18657) **Description:** Circular dependencies when parsing references leading to `RecursionError: maximum recursion depth exceeded` issue. This PR address the issue by handling previously seen refs as in any typical DFS to avoid infinite depths. **Issue:** langchain-ai#12163 **Twitter handle:** https://twitter.com/theBhulawat - [x] **Add tests and docs**: If you're adding a new integration, please include 1. a test for the integration, preferably unit tests that do not rely on network access, 2. an example notebook showing its use. It lives in `docs/docs/integrations` directory. - [x] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ --------- Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
…#18657) **Description:** Circular dependencies when parsing references leading to `RecursionError: maximum recursion depth exceeded` issue. This PR address the issue by handling previously seen refs as in any typical DFS to avoid infinite depths. **Issue:** langchain-ai#12163 **Twitter handle:** https://twitter.com/theBhulawat - [x] **Add tests and docs**: If you're adding a new integration, please include 1. a test for the integration, preferably unit tests that do not rely on network access, 2. an example notebook showing its use. It lives in `docs/docs/integrations` directory. - [x] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ --------- Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
**Description:** Circular dependencies when parsing references leading to `RecursionError: maximum recursion depth exceeded` issue. This PR address the issue by handling previously seen refs as in any typical DFS to avoid infinite depths. **Issue:** #12163 **Twitter handle:** https://twitter.com/theBhulawat - [x] **Add tests and docs**: If you're adding a new integration, please include 1. a test for the integration, preferably unit tests that do not rely on network access, 2. an example notebook showing its use. It lives in `docs/docs/integrations` directory. - [x] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ --------- Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Issue you'd like to raise.
Hello team!
I am new to the OpenAPI Specs Toolkit. I am trying to build an OpenAPI Agent Planner for the Microsoft Graph API. The OpenAPI specs can be found here: https://github.com/microsoftgraph/msgraph-metadata/blob/master/openapi/v1.0/openapi.yaml . I downloaded the YAML file and followed this notebook: https://python.langchain.com/docs/integrations/toolkits/openapi#1st-example-hierarchical-planning-agent .
Does anyone know how to handle large OpenAPI Specs? I ran the following to read my OpenAPI YAML spec and when using the
reduce_openapi_spec
module, I get the following error below:RecursionError: maximum recursion depth exceeded while calling a Python object
Is there a setting I need to change in LangChain? Please and thank you for your help in advance. I believe this issue is before I run into the following token limit, right? #2786
Suggestion:
No response
The text was updated successfully, but these errors were encountered: