class_docstr: This is a MindsDB integration for the LangChain library, which provides a unified interface for interacting with
  various large language models (LLMs).
  
  Currently, this integration supports exposing OpenAI and Anthrophic's LLMs with normal text completion support. They are then
  wrapped in a zero shot react description agent that offers a few third party tools out of the box, with support
  for additional ones if an API key is provided. Ongoing memory is also provided.
  
  Full tool support list:
      - wikipedia
      - python_repl
      - serper.dev search
class_docstr_tok: ["This","is","a","MindsDB","integration","for","the","LangChain","library",",","which","provides","a","unified","interface","for","interacting","with","various","large","language","models","(","LLMs",")",".","Currently",",","this","integration","supports","exposing","OpenAI","and","Anthrophic","'s","LLMs","with","normal","text","completion","support",".","They","are","then","wrapped","in","a","zero","shot","react","description","agent","that","offers","a","few","third","party","tools","out","of","the","box",",","with","support","for","additional","ones","if","an","API","key","is","provided",".","Ongoing","memory","is","also","provided",".","Full","tool","support","list",":","-","wikipedia","-","python_repl","-","serper.dev","search"]
code: def _get_chat_model_params(self, args, pred_args):
      model_name = args.get("model_name", self.default_model)
      # Params shared by all models.
      temperature = min(1.0, max(0.0, args.get("temperature", 0.0)))
      max_tokens = pred_args.get(
          "max_tokens", args.get("max_tokens", self.default_max_tokens)
      )
      top_p = pred_args.get("top_p", None)
      timeout = pred_args.get("request_timeout", None)
      serper_api_key = self._get_serper_api_key(args, strict=False)
      model_kwargs = {}
      if model_name in _ANTHROPIC_CHAT_MODELS:
          model_kwargs["model"] = model_name
          model_kwargs["temperature"] = temperature
          model_kwargs["max_tokens_to_sample"] = max_tokens
          model_kwargs["top_p"] = top_p
          model_kwargs["timeout"] = timeout
          model_kwargs["stop_sequences"] = pred_args.get(
              "stop_sequences", None
          )
          model_kwargs["serper_api_key"] = serper_api_key
          model_kwargs["anthropic_api_key"] = get_api_key(
              "anthropic", args, self.engine_storage
          )
      else:
          # OpenAI
          model_kwargs["model_name"] = model_name
          model_kwargs["temperature"] = temperature
          model_kwargs["max_tokens"] = max_tokens
          model_kwargs["top_p"] = top_p
          model_kwargs["request_timeout"] = timeout
          model_kwargs["serper_api_key"] = serper_api_key
          model_kwargs["frequency_penalty"] = pred_args.get(
              "frequency_penalty", None
          )
          model_kwargs["presence_penalty"] = pred_args.get(
              "presence_penalty", None
          )
          model_kwargs["n"] = pred_args.get("n", None)
          model_kwargs["best_of"] = pred_args.get("best_of", None)
          model_kwargs["logit_bias"] = pred_args.get("logit_bias", None)
          model_kwargs["openai_api_key"] = get_api_key(
              "openai", args, self.engine_storage
          )
          model_kwargs["openai_organization"] = args.get(
              "api_organization", None
          )
  
      model_kwargs = {
          k: v for k, v in model_kwargs.items() if v is not None
      }  # filter out None values
      return model_kwargs
  
imports: import re
  import os
  from typing import Optional, Dict
  from concurrent.futures import as_completed, TimeoutError
  import numpy
  import pandas
  from langchain.schema import SystemMessage
  from langchain.agents import AgentType
  from langchain.llms import OpenAI
  from langchain.chat_models import ChatAnthropic, ChatOpenAI
  from langchain.agents import initialize_agent, create_sql_agent
  from langchain.prompts import PromptTemplate
  from langchain.agents.agent_toolkits import SQLDatabaseToolkit
  from langchain.chains.conversation.memory import ConversationSummaryBufferMemory
  from mindsdb.integrations.handlers.openai_handler.constants import CHAT_MODELS
  from mindsdb.integrations.handlers.langchain_handler.mindsdb_database_agent import MindsDBSQL
  from mindsdb.integrations.handlers.langchain_handler.tools import setup_tools
  from mindsdb.integrations.libs.base import BaseMLEngine
  from mindsdb.integrations.utilities.handler_utils import get_api_key
  from mindsdb.utilities import log
  from mindsdb.utilities.context_executor import ContextThreadPoolExecutor
label_desc: Use image node_id 6 for calling the LangChainHandler obj's underlying member method code with example usage: obj._get_chat_model_params(args, pred_args) and returns: model_kwargs