Issue when running a simple ChatOllama prompt in Next.js/TypeScript: "Error: Single '}' in template."
Labels: name: auto:bug, name: area: models

### System Info

"langchain": "^0.0.211",
MacOS Sonoma 14.2
Next.js 14.0.4

### Who can help?

@agola11 
@hwc

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [ ] Embedding Models
- [X] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

1. pnpm add langchain in a Next.js project
2. Create a Next.js Route handler
3. Create the following route:

```
import { NextResponse } from 'next/server';
import { ChatOllama } from 'langchain/chat_models/ollama';
import { ChatPromptTemplate, MessagesPlaceholder } from 'langchain/prompts';
import { BufferMemory, ChatMessageHistory } from 'langchain/memory';
import { ConversationChain } from 'langchain/chains';

export async function POST(req: Request) {
  const data = await req.json();

  const prompt = ChatPromptTemplate.fromMessages([
    [
      'system',
      `You are an AI Computer Science Data Structures teaching system that responds to all questions STRICTLY
      in JSON format. You will be given a question on DSA concepts. Contents of JSON made by you will be used
      to create elements within a node of a graph that displays
      explanations of topics, and a user interface that allows users to follow up if they need help or want
      more information. There are 4 elements, "Topic", "Description", "Subtopics", "Questions": an array of strings. You will also be given a number of nodes that already
      exist, to be able to assign unique ids. IDs MUST BE STRINGS. MAKE SURE YOU ARE ONLY REPLYING WITH JSON AND NOT MARKDOWN
      These are the only node types you are allowed to pick from:
      "promptNode": USE FOR ALL EXPLANATIONS
      "confusedNode": USED WHEN CONFUSED
      {
      "{DEFINE ID BUT IN "STRING" FORM! +1 HIGHER THAN NUMBER GIVEN}": {
        "THE ID AGAIN": {number},
        "type": "promptNode",
        "position": { "x": 0, "y": 0 },
        "data": {
          "topic": "{Short name of topic}",
          "description": "{The explanation of topic}",
          "subtopics": [an array of strings of 5 related topics],
          "questions": [an array of objects of 4 related questions and answers, eg: {'q': 'Question?', 'a': 'Ans'}],
          "im_confused": [array of concepts mentioned in the description that they could be confused about]
        }
      }`,
    ],
    new MessagesPlaceholder('history'),
    ['human', '{input}'],
  ]);
  //@ts-ignore
  const chatHistory = [];

  const llm = new ChatOllama({
    baseUrl: 'http://localhost:11434', // Default value
    model: 'mistral', // Default value
  });

  const memory = new BufferMemory({
    returnMessages: true,
    memoryKey: 'history',
    //@ts-ignore
    chatHistory: new ChatMessageHistory(chatHistory),
  });

  const chain = new ConversationChain({
    memory: memory,
    prompt: prompt,
    llm: llm,
    verbose: true,
  });

  const result = await chain.invoke({
    input: data.prompt,
  });

  console.log(result);

  return NextResponse.json(
    {
  
    },
    { status: 200 }
  );
}
```

### Expected behavior

Model output.