yocto-gl icon indicating copy to clipboard operation
yocto-gl copied to clipboard

[FR] Support function calling for openai in gateway

Open XinEDprob opened this issue 1 year ago • 6 comments

Willingness to contribute

No. I cannot contribute this feature at this time.

Proposal Summary

I am new to MLflow, so please let me know if this feature actually exists. I did spend some time exploring the docs and code to see if I can use the function calling like the following in openai API with MLflow gateway (note the attribute functions and function_call). However, I did not find this feature so far. It seems currently we do not support it. Considering the usefulness of this feature, it may be beneficial for MLflow to support the two inputs functions and function_call.

The below is copied from https://platform.openai.com/docs/guides/gpt/function-calling

def run_conversation():
    # Step 1: send the conversation and available functions to GPT
    messages = [{"role": "user", "content": "What's the weather like in Boston?"}]
    functions = [
        {
            "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"],
            },
        }
    ]
    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo-0613",
        messages=messages,
        functions=functions,
        function_call="auto",  # auto is default, but we'll be explicit
    )
    response_message = response["choices"][0]["message"]

Motivation

What is the use case for this feature?

people who uses LLM may need this feature for their application development with MLflow

Why is this use case valuable to support for MLflow users in general?

Why is this use case valuable to support for your project(s) or organization?

Why is it currently difficult to achieve this use case?

Details

No response

What component(s) does this bug affect?

  • [ ] area/artifacts: Artifact stores and artifact logging
  • [ ] area/build: Build and test infrastructure for MLflow
  • [ ] area/docs: MLflow documentation pages
  • [ ] area/examples: Example code
  • [ ] area/gateway: AI Gateway service, Gateway client APIs, third-party Gateway integrations
  • [ ] area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • [ ] area/models: MLmodel format, model serialization/deserialization, flavors
  • [ ] area/recipes: Recipes, Recipe APIs, Recipe configs, Recipe Templates
  • [ ] area/projects: MLproject format, project running backends
  • [ ] area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • [ ] area/server-infra: MLflow Tracking server backend
  • [ ] area/tracking: Tracking Service, tracking client APIs, autologging

What interface(s) does this bug affect?

  • [ ] area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • [ ] area/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
  • [ ] area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • [ ] area/windows: Windows support

What language(s) does this bug affect?

  • [ ] language/r: R APIs and clients
  • [ ] language/java: Java APIs and clients
  • [ ] language/new: Proposals for new client languages

What integration(s) does this bug affect?

  • [ ] integrations/azure: Azure and Azure ML integrations
  • [ ] integrations/sagemaker: SageMaker integrations
  • [ ] integrations/databricks: Databricks integrations

XinEDprob avatar Oct 06 '23 02:10 XinEDprob

@XinEDprob Thanks for the FR. This feature doesn't exist yet.

harupy avatar Oct 06 '23 05:10 harupy

@mlflow/mlflow-team Please assign a maintainer and start triaging this issue.

github-actions[bot] avatar Oct 14 '23 00:10 github-actions[bot]

Hi @harupy, I would like to use this feature as well. If no one has been assigned yet, can I work on this instead?

Gekko0114 avatar Oct 14 '23 14:10 Gekko0114

@XinEDprob Thanks for the FR. This feature doesn't exist yet.

thanks for letting me know!

XinEDprob avatar Nov 09 '23 02:11 XinEDprob

It would be great to have this Feature.

RuddiRodriguez avatar Apr 28 '24 08:04 RuddiRodriguez

This is a very important feature, without it, having scalable agents would be very difficulty, who would be the hero to see this and implement it!

gariciodaro avatar May 16 '24 21:05 gariciodaro