sql_cmd Error: SQLDatabaseChain with ChatGLM2-6B
Labels: name: auto:bug, name: area: models

I wrote a ChatGLM class that inherits LLM class as below. 

```
class ChatGLM(LLM):
    def _call(self, prompt: str,
              stop: Optional[List[str]] = None) -> str:
        message = [{"role": "user", "content": prompt}]
        payload = {"model": "string", ...}
        headers = {"Content-Type": "application/json"}
        response = requests.post(url, json=payload, headers=headers)
        return response.json()['choices'][0]['message']['content']
```

And I hope to use the ChatGLM class I wrote to replace the previously used OpenAI class during sql querying with SQLDatabaseChain:

```
llm = ChatGLM(temperature=0, verbose=True)
db_chain = SQLDatabaseChain.from_llm(llm, db, verbose=True, use_query_checker=True, 
                                     return_intermediate_steps=False)
db_chain.run("What tables are in the database?")
```

This is the error reported by the code, does anyone know what caused it?

```
> Entering new SQLDatabaseChain chain...
What tables are in the database?
SQLQuery: Here
I'm sorry, but I don't see any SQLite query provided in your message. Could you please provide the SQLite query so I can review it for any common mistakes?

---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
File C:\Language\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py:1963, in Connection._exec_single_context(self, dialect, context, statement, parameters)
   1962     if not evt_handled:
-> 1963         self.dialect.do_execute(
   1964             cursor, str_statement, effective_parameters, context
   1965         )
   1967 if self._has_events or self.engine._has_events:

File C:\Language\Anaconda3\lib\site-packages\sqlalchemy\engine\default.py:920, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
    919 def do_execute(self, cursor, statement, parameters, context=None):
--> 920     cursor.execute(statement, parameters)

OperationalError: near "I": syntax error

......


```

I have located the error to `langchain/chains/sql_database/base.py` ln125, from here chatglm cannot output the correct `sql_cmd`, but I cannot further check what is causing this problem. Any help would be greatly appreciated, thank you.

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [X] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```
import langchain
from langchain.llms.base import LLM
from langchain import OpenAI, SQLDatabase, SQLDatabaseChain
db = SQLDatabase.from_uri('sqlite:///music.db')

class ChatGLM(LLM):
    url = "http://region-9.seetacloud.com:23361/v1/chat/completions"

    @property
    def _llm_type(self) -> str:
        return "chatglm2-6b"

    def _call(self, prompt: str,
              stop: Optional[List[str]] = None) -> str:
        message = [{
            "role": "user",
            "content": prompt
        }]
        url = "http://region-9.seetacloud.com:23361/v1/chat/completions"
        payload = {
            "model": "string",
            "messages": message,
            "temperature":1,
            "top_p": 0,
            "n": 1,
            "max_tokens": 0,
            "stream": False
        }
        headers = {
            "Content-Type": "application/json"
        }
        response = requests.post(url, json=payload, headers=headers)
        return response.json()['choices'][0]['message']['content']

    @property
    def _identifying_params(self) -> Mapping[str, Any]:
        """Get the identifying parameters.
        """
        _param_dict = {
            "url": self.url
        }
        return _param_dict

llm = ChatGLM(temperature=0, verbose=True)
db_chain = SQLDatabaseChain.from_llm(llm, db, verbose=True, use_query_checker=True, 
                                     return_intermediate_steps=False)
db_chain.run("What tables are in the database?")
```

### Expected behavior

return correct sql query