If an API response is not json, but an image or stream, Will Langchain support storing them into a file object? #9598
Replies: 2 comments 1 reply
-
🤖 Hello, Based on the current implementation of the LangChain framework, it appears that it only supports JSON media types. This is indicated by the line of code in the _SUPPORTED_MEDIA_TYPES = ("application/json",) This means that the framework does not currently support handling non-JSON responses from APIs, such as images or streams. As for your question about storing the response into a File Object, the current version of LangChain does not seem to have this functionality built-in. However, it's possible to extend the framework to handle this, although it would require a good understanding of the codebase and potentially significant changes. Regarding token limitations, it would depend on the specifics of the API you're using. If the API has a limit on the size of the response or the number of requests, then it could potentially be a problem. However, this is not a limitation of the LangChain framework itself, but rather the API. I hope this answers your questions. If you have any more questions or need further clarification, feel free to ask. Best regards, 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. |
Beta Was this translation helpful? Give feedback.
-
The file provided here-libs/langchain/langchain/tools/openapi/utils/api_models.py indicates media type is getting checked only for request and not response. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using OpenAPI chain, I have an API, which I want to request using the chain.The response of the API is not json but an image.
Questions:
Beta Was this translation helpful? Give feedback.
All reactions