langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
94.74k stars 15.33k forks source link

Add support for Assembly AI Lemur #16496

Closed Lord-Haji closed 6 months ago

Lord-Haji commented 9 months ago

Feature request

https://www.assemblyai.com/products/lemur Adding support for lemur endpoints as we already do have AAI integration

Motivation

Helpful for folks with a paid AAI plan and are using lemur to migrate the codebase to langchain

Your contribution

Perhaps.

dosubot[bot] commented 9 months ago

🤖

Hey @Lord-Haji, good to see you again! Hope you've been coding up a storm 🌪️

Thank you for your feature request. Adding support for Assembly AI Lemur endpoints to the LangChain framework is indeed possible. This can be achieved by creating a new tool for Assembly AI Lemur in a similar way as the existing tools in the LangChain framework.

Here is a simplified example of how you might add a new tool for Assembly AI Lemur:

from langchain_community.utilities import AssemblyAILemurAPIWrapper

def _get_assembly_ai_lemur(**kwargs: Any) -> BaseTool:
    return AssemblyAILemurQueryRun(api_wrapper=AssemblyAILemurAPIWrapper(**kwargs))

_EXTRA_OPTIONAL_TOOLS: Dict[str, Tuple[Callable[[KwArg(Any)], BaseTool], List[str]]] = {
    "assembly-ai-lemur": (_get_assembly_ai_lemur, ["assembly_ai_lemur_api_key"]),
    ...
}

In this example, _get_assembly_ai_lemur is a function that creates a new instance of the AssemblyAILemurQueryRun tool, which uses the AssemblyAILemurAPIWrapper to interact with the Assembly AI Lemur API. The assembly-ai-lemur tool is then added to the _EXTRA_OPTIONAL_TOOLS dictionary, which is used by the load_tools function to load the requested tools.

Please note that you would need to implement the AssemblyAILemurAPIWrapper and AssemblyAILemurQueryRun classes, and these classes should handle the interaction with the Assembly AI Lemur API.

This is a simplified example and might need adjustments based on the specific requirements and the structure of the Assembly AI Lemur API. You can refer to the load_tools.py file in the LangChain repository for more details on how tools are integrated into the LangChain framework.

Regarding the structure and functionality of the AssemblyAILemurAPIWrapper and AssemblyAILemurQueryRun classes, I'm afraid I couldn't find specific information within the repository. However, these classes would typically be responsible for interacting with the Assembly AI Lemur API and processing the responses, respectively.

I hope this helps! If you have any further questions or need more clarification, please don't hesitate to ask.

Sources


This 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.