Repository: ollama
Issue: Tools and properties.type Not Supporting Arrays
Labels: bug

### What is the issue?

**Title:** Issue with `DynamicStructuredTool` and `properties.type` Not Supporting Arrays in LangchainJS

**Description:**

I am encountering an issue when using `DynamicStructuredTool` in LangchainJS. Specifically, the `type` property within `properties` does not currently support arrays. This results in an error when I try to use a nullable argument specified as `["string", "null"]`. The error message is as follows:

```
LLM run errored with error: "HTTP error! status: 400 Response: 
{\"error\":{\"message\":\"json: cannot unmarshal array into Go struct field .tools.function.parameters.properties.type of type string\",\"type\":\"invalid_request_error\",\"param\":null,\"code\":null}}\n
\nMistralAPIError: HTTP error! status: 400 Response: 
{\"error\":{\"message\":\"json: cannot unmarshal array into Go struct field .tools.function.parameters.properties.type of type string\",\"type\":\"invalid_request_error\",\"param\":null,\"code\":null}}\n
 at MistralClient._request (file:///Users/xonlly/projects/devana.ai/serveur/node_modules/@mistralai/mistralai/src/client.js:162:17)\n
 at processTicksAndRejections (node:internal/process/task_queues:95:5)\n
 at MistralClient.chat (file:///Users/xonlly/projects/devana.ai/serveur/node_modules/@mistralai/mistralai/src/client.js:338:22)\n
 at /Users/xonlly/projects/devana.ai/serveur/node_modules/@langchain/mistralai/dist/chat_models.cjs:366:27\n
 at RetryOperation._fn (/Users/xonlly/projects/devana.ai/serveur/node_modules/p-retry/index.js:50:12)"
```

**JSON Configuration:**

```json
{
  "model": "mistral-nemo",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "search-files",
        "description": "Search all files in the collection",
        "parameters": {
          "type": "object",
          "properties": {
            "query": {
              "type": ["string", "null"]
            }
          },
          "required": ["query"],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    }
  ],
  "temperature": 0.7,
  "top_p": 1,
  "stream": false,
  "tool_choice": "required"
}
```

**Steps to Reproduce:**

1. Use LangchainJS with `DynamicStructuredTool`.
2. Define a nullable argument with `["string", "null"]` in the `type` property.
3. Observe the error upon execution.

**Expected Behavior:**

The `type` property should accept arrays to support nullable arguments without causing an error.

**Actual Behavior:**

An error occurs because the `type` property does not support arrays, resulting in a failure to unmarshal the array into a Go struct field.

**Proposed Solution:**

Update the `type` property within `properties` to support arrays, allowing for nullable arguments to be correctly processed.

**Environment:**

- Ollama version: 0.3.0
- Operating System: Ubuntu 22.04

**Additional Context:**

Any guidance or updates to address this limitation would be greatly appreciated. Thank you!

### OS

Linux

### GPU

Nvidia

### CPU

Intel

### Ollama version

0.3.0