Fine Tuning - Funcion Calling

Hello community!

I’m having some problems, when I activate function calling, I send 3 functions to chat completions. Some of the times it has selected the incorrect function.

Is there any way to do a fine tune to select the correct function?

1 Like

Share your functions json definitions. It is using NLU, no need to fine tune. Show me I’ll fix quickly I am pretty sure.:slight_smile:

    const response = await openai.chat.completions.create({
        model: "gpt-4-0125-preview",
        messages: messages,
        functions: [getPairDataJson, getTokenDataJson],
        temperature: 0.0,
    });

const getPairDataJson = {
“name”: “getPairData”,
“description”: “always call to this function doesn’t matter what the user asks.”,
“parameters”: {
“type”: “object”,
“properties”: {
“query”: {
“type”: “string”,
“description”: “pass here the symbol of the token the user is interested in or the name, nothing more, never send here a dollar sign.”
},
“note”: {
“type”: “string”,
“description”: “Note: ATH, ATL, ROI, MC, FDV, holders, MCAP, contract address, token address, and other comum metrics from crypto are not part of the symbol.”
}
},
“required”: [“query”]
}
};

const getTokenDataJson = {
“name”: “getTokenData”,
“description”: “Just call to this function when the user provides a token addres or pair address.”,
“parameters”: {
“type”: “object”,
“properties”: {
“address”: {
“type”: “string”,
“description”: “Pass here the contract address of the token the user is interested in. Ensure the address is valid and corresponds to a token on the blockchain being queried.”
},
“note”: {
“type”: “string”,
“description”: “Note: Ensure the address format is correct for the specific blockchain (e.g., Ethereum, Binance Smart Chain).”
}
},
“required”: [“address”]
}
};

one function would be to get the cryptocurrency contract and the other function would be to get the name of the currency.

They get confused from time to time…

hey @lucasabreu
Ok you are trying to monitor crypto currency for the blockchain transactions and you want to parse blocks using gpt? I guess you are trying to build a monitoring bot.
try:

const getPairDataJson = {
“name”: “getPairData”,
“description”: “Retrieves data for a specified cryptocurrency pair based on the user’s query. This function should be invoked for any user inquiries related to cryptocurrency information, regardless of the nature of the request.”,
“parameters”: {
“type”: “object”,
“properties”: {
“query”: {
“type”: “string”,
“description”: “The symbol or name of the cryptocurrency of interest. Ensure to provide only the symbol or name without any additional characters (e.g., ‘$’).”,
“example”: “BTC for Bitcoin or ETH for Ethereum.”
},
“note”: {
“type”: “string”,
“description”: “Additional information clarifying that common metrics associated with cryptocurrencies, such as All-Time High (ATH), All-Time Low (ATL), Return on Investment (ROI), Market Cap (MC), Fully Diluted Valuation (FDV), number of holders, market capitalization (MCAP), contract address, and token address, are not considered part of the cryptocurrency symbol or name.”,
“example”: “Do not include terms like ‘ATH’, ‘ROI’, or addresses in the query.”
}
},
“required”: [“query”]
}
};

and

const getTokenDataJson = {
“name”: “getTokenData”,
“description”: “Invoke this function exclusively when the user supplies a token address or a pair address. It’s designed to fetch detailed information about a specific token based on its contract address.”,
“parameters”: {
“type”: “object”,
“properties”: {
“address”: {
“type”: “string”,
“description”: “The contract address of the token of interest. Ensure the address is accurately provided and corresponds to an existing token on the blockchain you are inquiring about.”,
“example”: “0x… for Ethereum or bnb… for Binance Smart Chain tokens.”
},
“note”: {
“type”: “string”,
“description”: “It’s crucial to verify the address format matches the standards of the targeted blockchain. Incorrect or malformed addresses will lead to unsuccessful queries.”,
“example”: “Ethereum addresses start with ‘0x’ followed by 40 hexadecimal characters. Binance Smart Chain addresses also start with ‘0x’ but are part of the BSC network.”
}
},
“required”: [“address”]
}
};

Let me know if it worked. :slight_smile:

However, I’m not sure what you are doing, but it seems you try to use LLM like a programming tool rather then using it’s understanding. I’m pretty sure there is a more natural and simple way to acheive your goal. Let me know if you want to know more.

I created one called Nalli. Is that what you are trying to create?


I have a bot… that helps the crypto community find quick information about currencies…
So many people use the bot to get quick information such as:

  • btc price
  • pancake ath
  • venus holders and atl
  • 0x7dd817f81cf9d8c55315495d2ccfae8de60f136f metrics

and many times the functions are called incorrectly…

The idea would always be for pairdatajson to be called when the user provides the name of the currency and gettokendata when the user sends its cotract address.

So using the example I gave you, the answer would be:

  • query = btc
  • query = pancake
  • query = venus
  • address = 0x7dd817f81cf9d8c55315495d2ccfae8de60f136f

Did you understand?

Ok I think I understand. Does you user do complete sentences like a discussion or it is more command oriented? For example:

Discussion

  • Give me the btc price.
  • What is the smart contract address of pancake ath currency?

Commands

  • price btc
  • contract ath

most of cases is a command oriented!!

Do u think there is anything else I can improve?

@lucasabreu

Let me share something I learned and is a game changer. I stopped to treat LLM like machines and communicate with them as they are persons. It is phenomenal how they understand and they become MUCH more useful.

I observed in all bots I have created that by discussion, they get the intention and it’s easy to produce predictable behavior and outcome.

Do you understand what I mean?

Mart

Yes, I got it!

The problem is that users use a command-oriented way of asking the bot…

Hey @lucasabreu

Well it’s not a problem in it self. However, as you experimented, you will notice the benefit of using natural language understanding rather then commands.

Let me know if I can help you, I’ll be glad.

Regards,
Mart

1 Like