modal to run your own custom LLM models instead of depending on LLM APIs.
This example goes over how to use LangChain to interact with a modal HTTPS web endpoint.
Question-answering with LangChain is another example of how to use LangChain alonside Modal. In that example, Modal runs the LangChain application end-to-end and uses OpenAI as its LLM API.
langchain.llms.modal.Modal integration class requires that you deploy a Modal application with a web endpoint that complies with the following JSON interface:
- The LLM prompt is accepted as a
strvalue under the key"prompt" - The LLM response returned as a
strvalue under the key"prompt"
- See Modal’s web endpoints guide for the basics of setting up an endpoint that fulfils this interface.
- See Modal’s ‘Run Falcon-40B with AutoGPTQ’ open-source LLM example as a starting point for your custom LLM!
langchain.llms.modal.Modal LLM class. This class can then function as a building block in your chain.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.