Supported Models

  • GPT-4o
  • GPT-4-Turbo
  • GPT-4
  • GPT-3.5-Turbo
  • Claude 3 Opus
  • Claude 3 Sonnet
  • Claude 3 Haiku
  • Command R Plus
  • Command R
  • Mistral Large
  • Mistral Small
  • Mixtral 8x22B Instruct
  • Llama 3 70B Instruct
  • Llama 3 8B Instruct

Example

from openai import OpenAI

tools = [
  {
    "type": "function",
    "function": {
      "name": "get_current_weather",
      "description": "Get the current weather",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "description": "The property address the lead would like more information about.",
            "properties": {
              "street_address": {
                "type": "string",
                "description": "The street component of the address."
              },
              "city": {
                "type": "string",
                "description": "The city component of the address."
              },
              "state": {
                "type": "string",
                "description": "The state component of the address.",
                "maxLength": 2
              },
              "postal_code": {
                "type": "string",
                "description": "The postal/zip code component of the address."
              }
            },
            "required": [
              "city",
              "state"
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ],
            "description": "The temperature unit to use. Infer this from the users location."
          }
        },
        "required": [
          "location",
          "format"
        ]
      }
    }
  },
]

client = OpenAI(
    base_url="https://router.neutrinoapp.com/api/engines",
    api_key="<Neutrino-API-key>"
)

response = client.chat.completions.create(
    # You can set this to a single model, or a list of models
    model=["claude-3-sonnet", "command-r-plus", "gpt-4o"],
    messages = [
        {"role": "user", "content": "What is the current weather like in San Francisco?"},
    ]
)

for choice in response.choices:
    model = choice.model
    content = choice.message.content
    print(f"{model}:\n{content}")
    print(f"tools:\n{choice.message.tool_calls}\n\n")

# Output:
# gpt-4o:

# tools:
# [ChatCompletionMessageToolCall(id='call_n3GqdCgyjElcLK6uMjHXWAik', function=Function(arguments={'location': {'city': 'San Francisco', 'state': 'CA'}, 'format': 'celsius'}, name='get_current_weather'), type='function')]

# claude-3-sonnet:
# Okay, let me get the current weather for San Francisco:
# tools:
# [ChatCompletionMessageToolCall(id='toolu_01VTeqqa5jeBnpNJfi13rBUC', function=Function(arguments={'location': {'city': 'San Francisco', 'state': 'CA'}, 'format': 'fahrenheit'}, name='get_current_weather'), type='function')]

# command-r-plus:

# tools:
# [ChatCompletionMessageToolCall(id='1dc48f6f-d682-4023-b73c-34b388d662b6', function=Function(arguments={'format': 'fahrenheit', 'location': 'San Francisco'}, name='get_current_weather'), type='function')]