Code Monkey home page Code Monkey logo

Comments (3)

CharlieJCJ avatar CharlieJCJ commented on June 12, 2024

Hi @ChristianWeyer! Thanks for your interest~

We provide GGUF quantized model and example inference walkthrough on https://huggingface.co/gorilla-llm/gorilla-openfunctions-v2-gguf if you are looking for doing inference on compressed model. We've tested them on consumer laptop!

We also provide example inference code for the original model, which you can check out this section in github repo https://github.com/ShishirPatil/gorilla/tree/main/openfunctions#end-to-end-example-1

Let us know if you encounter further issues! We're happy to provide support!

from gorilla.

ChristianWeyer avatar ChristianWeyer commented on June 12, 2024

I am trying the Q6_K quant together with Ollama and LiteLLM @ShishirPatil.
litellm --model ollama/adrienbrault/gorilla-openfunctions-v2:Q6_K

It does look to work OK... but the devil is in the details 😉.

This is the curl command:

curl $TARGET_URL \
-H "Content-Type: application/json" \
-d '{
  "model": $MODEL:NAME,
  "messages": [
    {
      "role": "user",
      "content": "What is the weather like in Boston?"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_current_weather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            },
            "unit": {
              "type": "string",
              "enum": ["celsius", "fahrenheit"]
            }
          },
          "required": ["location"]
        }
      }
    }
  ],
  "tool_choice": "auto"
}'

Running this against OpenAI gpt.3.5.turbo, we get this result:

{
   "choices" : [
      {
         "finish_reason" : "tool_calls",
         "index" : 0,
         "logprobs" : null,
         "message" : {
            "content" : null,
            "role" : "assistant",
            "tool_calls" : [
               {
                  "function" : {
                     "arguments" : "{\"location\":\"Boston\"}",
                     "name" : "get_current_weather"
                  },
                  "id" : "call_regvlJdOsVla1XbVBnWWvduA",
                  "type" : "function"
               }
            ]
         }
      }
   ],
   "created" : 1710859864,
   "id" : "chatcmpl-94V5sy20kdgIReFCKiID6rUDrVAyF",
   "model" : "gpt-3.5-turbo-0125",
   "object" : "chat.completion",
   "system_fingerprint" : "fp_4f2ebda25a",
   "usage" : {
      "completion_tokens" : 15,
      "prompt_tokens" : 82,
      "total_tokens" : 97
   }
}

However, when run against the local OpenFunctions endpoint, we get:

{
   "choices" : [
      {
         "finish_reason" : "stop",
         "index" : 0,
         "message" : {
            "content" : null,
            "role" : "assistant",
            "tool_calls" : [
               {
                  **"function" : {
                     "arguments" : "{\n    \"name\": \"get_current_weather\", \n    \"arguments\": {\"location\": \"Boston, MA\"}\n}\n",
                     "name" : ""
                  },**
                  "id" : "call_7e88f79b-b4d7-4f42-8c0d-363414ff6e08",
                  "type" : "function"
               }
            ]
         }
      }
   ],
   "created" : 1710859673,
   "id" : "chatcmpl-db75896e-8236-47ee-8cf5-14f94811fab2",
   "model" : "ollama/adrienbrault/gorilla-openfunctions-v2:Q6_K",
   "object" : "chat.completion",
   "system_fingerprint" : null,
   "usage" : {
      "completion_tokens" : 31,
      "prompt_tokens" : 167,
      "total_tokens" : 198
   }
}

This means the OpenFunctions answer is not really OAI Tool Calling spec-compliant.

Any idea what we can do here?
Thanks!

from gorilla.

ChristianWeyer avatar ChristianWeyer commented on June 12, 2024

Maybe, this is actually an issue with LiteLLM (BerriAI/litellm#2209)

from gorilla.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.