# InternVL3

**InternVL3** is an advanced multimodal large language model (MLLM) with capabilities to encompass tool usage, GUI agents, industrial image analysis, 3D vision perception, and more.

## Model details

| Category | Details |
|----------|----------|
| **Model Name** | InternVL3 |
| **Version** | Instruct 1B |
| **Model Category** | VLM |
| **Size** | 1B parameters |
| **HuggingFace Model** | [opengvlab-internvl3-1b-instruct](https://huggingface.co/OpenGVLab/InternVL3-1B-Instruct) |
| **OpenAI Compatible Endpoint** | [Chat API Overview](https://developers.openai.com/api/reference/overview) |
| **License** | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |

## Capabilities 

| Feature | Details |
|---------|--------|
| Tool Calling | ❌ |
| Context Length | 16k tokens |
| Supports LoRA | ❌ |
| Input data | Text + Image |

## Usage 

### Basic Chat Completion

This is a basic chat completion example using this model:

```ts
const modelResponse = await Azion.AI.run("opengvlab-internvl3-1b-instruct", {
  "stream": true,
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Name the european capitals"
    }
  ]
})
```

| Property      | Type  | Description                                                     |
| ------------- | ----- | --------------------------------------------------------------- |
| `stream`      | `boolean` | Indicates whether to stream the response.                            |
| `messages[]`  | `array`   | Array of message objects. |
| `messages[].role` | `string` | The role of the message sender.                            |
| `messages[].content` | `string` | The content of the message.                                |

### Multimodal (text + image) example

This is a multimodal example using this model:

```ts
const modelResponse = await Azion.AI.run("opengvlab-internvl3-1b-instruct", {
  "stream": true,
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What is in this image?"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/image.jpg"
          }
        }
      ]
    }
  ]
})
```

| Property                       | Type | Description                                                     |
| -------------------------------------- | --------- | ------------------------------------------------------------------- |
| `messages[]`                           | array    | Array containing the messages sent.      |
| `messages[].role`                     | string   | The role of the message sender.                            |
| `messages[].content`                  | string   | The content of the message.                                |
| `messages[].content[].type`          | string   | The type of the content item.        |
| `messages[].content[].text`          | string   | Content of the message (only if `type` is `"text"`).                 |
| `messages[].content[].image_url`          | string   | Content of the message (only if `type` is `"image_url"`).  |
| `messages[].content[].image_url.url` | string   | The actual URL of the image.          |

## JSON Schema

```json
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "required": [
        "messages"
    ],
    "properties": {
        "messages": {
            "type": "array",
            "items": {
                "$ref": "#/components/schemas/Message"
            }
        },
        "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
        },
        "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 1
        },
        "n": {
            "type": "integer",
            "minimum": 1,
            "default": 1
        },
        "stream": {
            "type": "boolean",
            "default": false
        },
        "max_tokens": {
            "type": "integer",
            "minimum": 1
        },
        "presence_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "default": 0
        },
        "frequency_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "default": 0
        },
        "tools": {
            "type": "array",
            "items": {
                "$ref": "#/components/schemas/ToolDefinition"
            }
        }
    },
    "components": {
        "schemas": {
            "Message": {
                "oneOf": [
                    {
                        "$ref": "#/components/schemas/SystemMessage"
                    },
                    {
                        "$ref": "#/components/schemas/UserMessage"
                    },
                    {
                        "$ref": "#/components/schemas/AssistantMessage"
                    }
                ]
            },
            "SystemMessage": {
                "type": "object",
                "required": [
                    "role",
                    "content"
                ],
                "properties": {
                    "role": {
                        "type": "string",
                        "enum": [
                            "system"
                        ]
                    },
                    "content": {
                        "$ref": "#/components/schemas/TextContent"
                    }
                }
            },
            "UserMessage": {
                "type": "object",
                "required": [
                    "role",
                    "content"
                ],
                "properties": {
                    "role": {
                        "type": "string",
                        "enum": [
                            "user"
                        ]
                    },
                    "content": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "array",
                                "items": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/TextContentItem"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ImageContentItem"
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            },
            "AssistantMessage": {
                "oneOf": [
                    {
                        "$ref": "#/components/schemas/AssistantMessageWithoutToolCalls"
                    }
                ]
            },
            "AssistantMessageWithoutToolCalls": {
                "type": "object",
                "required": [
                    "role",
                    "content"
                ],
                "properties": {
                    "role": {
                        "type": "string",
                        "enum": [
                            "assistant"
                        ]
                    },
                    "content": {
                        "$ref": "#/components/schemas/TextContent"
                    }
                },
                "not": {
                    "required": [
                        "tool_calls"
                    ]
                }
            },
            "TextContent": {
                "oneOf": [
                    {
                        "type": "string"
                    },
                    {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/TextContentItem"
                        }
                    }
                ],
                "description": "Text content that can be provided either as a simple string or as an array of TextContentItem objects"
            },
            "ImageContent": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/ImageContentItem"
                }
            },
            "TextContentItem": {
                "type": "object",
                "required": [
                    "type",
                    "text"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "text"
                        ]
                    },
                    "text": {
                        "type": "string"
                    }
                }
            },
            "ImageContentItem": {
                "type": "object",
                "required": [
                    "type",
                    "image_url"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "image_url"
                        ]
                    },
                    "image_url": {
                        "type": "object",
                        "required": [
                            "url"
                        ],
                        "properties": {
                            "url": {
                                "type": "string",
                                "format": "uri"
                            }
                        }
                    }
                }
            }
        }
    }
}
```