Git Product home page Git Product logo

Comments (1)

yitianlian avatar yitianlian commented on June 12, 2024

I think using Function_call to satisfy with this feature, and I show a brief example about using json as a output format.
the user should input:

input_info = [
    "Determines the answer based on their beliefs, desires, intention",
    {
        "Belief": "The belief factor.", 
        "Desire": "The desire factor.",
        "Intention": "The intention factor.",
    },
]

the first element in the input is the description when should the model struct output and the second dict is the detail about the information the user need in the response.
To fit with the function call function already in camel. We should transfer the user input to a function:

def generate_text(Believe, Desire, Intention):
    """
    Determines the answer based on their beliefs, desires, intention
    Args:
        Believe (any): The belief factor.
        Desire (any): The desire factor.
        Intention (any): The intention factor.
    Returns:
        Dict[str, Any]: A dictionary containing the model's answer with keys for Believe, Desire, Intention
    """
    model_answer = {
        "Believe": Believe,
        "Desire": Desire,
        "Intention": Intention,
    }
    return model_answer

The reason why it can structure the model output is the return of the function is an output the user want. To achieve this transfomation. I already design a function to transfer from the user input to this type function.
Finally we can generate the OpenAIFunction class using

func_call = OpenAIFunction(
    func=generate_text,
)

So I will test if this way can fit with nowaday's code, and I'm also concern about which part in repo should I put my code in.
Thanks for any comment~

from camel.

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.