motleycrew.common.llms

Helper functions to initialize Language Models (LLMs) from different frameworks.

Functions

init_llm(llm_framework[, llm_provider, ...])

Initialize an LLM client for use with the specified framework and family.

langchain_anthropic_llm([llm_name, ...])

Initialize an Anthropic LLM client for use with Langchain.

langchain_azure_openai_llm([llm_name, ...])

Initialize an Azure OpenAI LLM client for use with Langchain.

langchain_groq_llm([llm_name, llm_temperature])

Initialize a Groq LLM client for use with Langchain.

langchain_ollama_llm([llm_name, llm_temperature])

Initialize an Ollama LLM client for use with Langchain.

langchain_openai_llm([llm_name, llm_temperature])

Initialize an OpenAI LLM client for use with Langchain.

langchain_replicate_llm([llm_name, ...])

Initialize a Replicate LLM client for use with Langchain.

langchain_together_llm([llm_name, ...])

Initialize a Together LLM client for use with Langchain.

llama_index_anthropic_llm([llm_name, ...])

Initialize an Anthropic LLM client for use with LlamaIndex.

llama_index_azure_openai_llm([llm_name, ...])

Initialize an Azure OpenAI LLM client for use with LlamaIndex.

llama_index_groq_llm([llm_name, llm_temperature])

Initialize a Groq LLM client for use with LlamaIndex.

llama_index_ollama_llm([llm_name, ...])

Initialize an Ollama LLM client for use with LlamaIndex.

llama_index_openai_llm([llm_name, ...])

Initialize an OpenAI LLM client for use with LlamaIndex.

llama_index_replicate_llm([llm_name, ...])

Initialize a Replicate LLM client for use with LlamaIndex.

llama_index_together_llm([llm_name, ...])

Initialize a Together LLM client for use with LlamaIndex.

motleycrew.common.llms.langchain_openai_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize an OpenAI LLM client for use with Langchain.

Parameters:
  • llm_name – Name of the LLM in OpenAI API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.llama_index_openai_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize an OpenAI LLM client for use with LlamaIndex.

Parameters:
  • llm_name – Name of the LLM in OpenAI API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.langchain_anthropic_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize an Anthropic LLM client for use with Langchain.

Parameters:
  • llm_name – Name of the LLM in Anthropic API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.llama_index_anthropic_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize an Anthropic LLM client for use with LlamaIndex.

Parameters:
  • llm_name – Name of the LLM in Anthropic API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.langchain_replicate_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize a Replicate LLM client for use with Langchain.

Parameters:
  • llm_name – Name of the LLM in Replicate API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.llama_index_replicate_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize a Replicate LLM client for use with LlamaIndex.

Parameters:
  • llm_name – Name of the LLM in Replicate API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.langchain_together_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize a Together LLM client for use with Langchain.

Parameters:
  • llm_name – Name of the LLM in Together API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.llama_index_together_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize a Together LLM client for use with LlamaIndex.

Parameters:
  • llm_name – Name of the LLM in Together API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.langchain_groq_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize a Groq LLM client for use with Langchain.

Parameters:
  • llm_name – Name of the LLM in Groq API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.llama_index_groq_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize a Groq LLM client for use with LlamaIndex.

Parameters:
  • llm_name – Name of the LLM in Groq API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.langchain_ollama_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize an Ollama LLM client for use with Langchain.

Parameters:
  • llm_name – Name of the LLM in Ollama API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.llama_index_ollama_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize an Ollama LLM client for use with LlamaIndex.

Parameters:
  • llm_name – Name of the LLM in Ollama API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.langchain_azure_openai_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize an Azure OpenAI LLM client for use with Langchain.

Parameters:
  • llm_name – Name of the LLM in Azure OpenAI API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.llama_index_azure_openai_llm(llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize an Azure OpenAI LLM client for use with LlamaIndex.

Parameters:
  • llm_name – Name of the LLM in Azure OpenAI API.

  • llm_temperature – Temperature for the LLM.

motleycrew.common.llms.init_llm(llm_framework: str, llm_provider: str = 'openai', llm_name: str = 'gpt-4o', llm_temperature: float = 0.0, **kwargs)

Initialize an LLM client for use with the specified framework and family.

Parameters:
  • llm_framework – Framework of the LLM client.

  • llm_provider – Provider of the LLM.

  • llm_name – Name of the LLM.

  • llm_temperature – Temperature for the LLM.