code: def build_llm_params(args: dict, update=False) -> Dict:
      """build llm params from args"""
  
      if args["llm_type"] == "writer":
          llm_config_class = WriterLLMParameters
      elif args["llm_type"] == "openai":
          llm_config_class = OpenAIParameters
      else:
          raise UnsupportedLLM(
              f"'llm_type' must be one of {SUPPORTED_LLMS}, got {args['llm_type']}"
          )
  
      if not args.get("llm_params"):
          # for create method only
          llm_params = on_create_build_llm_params(
              args, llm_config_class
          )
      else:
          # for predict method only
          llm_params = args.pop("llm_params")
      if update:
          # for update method only
          args["llm_params"] = llm_params
          return args
  
      args["llm_params"] = llm_config_class(**llm_params)
  
      return args
  
imports: import json
  from dataclasses import dataclass
  from functools import lru_cache, partial
  from typing import Any, Dict, List, Union
  import html2text
  import openai
  import pandas
  import requests
  import writer
  from langchain import Writer
  from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
  from langchain.docstore.document import Document
  from langchain.document_loaders import DataFrameLoader
  from langchain.embeddings.base import Embeddings
  from langchain.embeddings.huggingface import HuggingFaceEmbeddings
  from langchain.vectorstores import FAISS, Chroma, VectorStore
  from pydantic import BaseModel, Extra, Field, validator
  from mindsdb.integrations.handlers.chromadb_handler.chromadb_handler import get_chromadb
  from mindsdb.integrations.handlers.rag_handler.exceptions import InvalidOpenAIModel, InvalidPromptTemplate, InvalidWriterModel, UnsupportedLLM, UnsupportedVectorStore
label_desc: Use image node_id 9 for calling a global function with example usage: build_llm_params(args, update) and returns: args, args