Giter Club home page Giter Club logo

Comments (4)

sloganking avatar sloganking commented on August 19, 2024 1

Okay thanks, I will continue using the deprecated option for now and maybe come back to this when it has been tested further. or test it some on my own later.

from async-openai.

SpaghettiFibonacci avatar SpaghettiFibonacci commented on August 19, 2024

Here is an example of how to use it meanwhile:

let tool = ChatCompletionToolArgs::default()
        .r#type(async_openai::types::ChatCompletionToolType::Function)
        .function(ChatCompletionFunctions { 
                name: "get_current_weather".to_string(), 
                description: Some("Get weather in location".to_string()), 
                parameters: json!({
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "The city and state, e.g. San Francisco, CA",
                        },
                        "format": {
                            "type": "string",
                            "enum": ["celsius", "fahrenheit"],
                            "description": "The temperature unit to use. Infer this from the users location.",
                        },
                    },
                    "required": ["location", "format"],
                    
                }) 
            }).build()?;

and for the tool choice

        .tool_choice(ChatCompletionToolChoiceOption::Auto)

Though I am not sure it is working right now!

Error: ApiError(ApiError { message: "'$.tool_choice' is invalid. Please check the API reference: https://platform.openai.com/docs/api-reference.", type: Some("invalid_request_error"), param: None, code: None })

from async-openai.

SpaghettiFibonacci avatar SpaghettiFibonacci commented on August 19, 2024

When leaving out

        .tool_choice(ChatCompletionToolChoiceOption::Auto)

it should work

from async-openai.

64bit avatar 64bit commented on August 19, 2024

An example was added in #153. And the bug was fixed in #158

Seems like everything is resolved, hence closing the issue.

from async-openai.

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.