web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps/GPT-4 Integ...
Power Apps
Unanswered

Power Apps/GPT-4 Integration

(0) ShareShare
ReportReport
Posted on by 6

Along the same lines, hoping someone can help.  I am getting an error when trying to use the code below.  Says the number of arguments is wrong, received 2, expecte 0-1.  
Set(
varResponse,
'GPT_Test'.ChatAPI("gpt-4-32k",Collect(colChat,
{
role:"user",
content:TextInput2
}
))
);
Reset(TextInput2)

 

This code is for the OnSelect button that takes the inputted text from TextInput2, calls gpt-4 via api, then i collect the response to display colChat.  GPT_Test is my custom connector which i have tested and works fine.  Also as a note, the customer connector is using our enterprise internal AzureOpenAI tenant so we do have a gpt-4 deployment.

Can someone help me?

Categories:
I have the same question (0)
  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi 

    @mark_fleet 

    Plz try this function if it'z works or not

    Set(varResponse, 'GPT_Test'.ChatAPI(
    Collect(colChat,
    { role:"user", content:TextInput2 })));
    Reset(TextInput2)

     

    Thanks! 

  • mark_fleet Profile Picture
    6 on at

    when trying that code i get:
    Issue: invalid argument type(Table).  Expecting a Record value instead.

     

    I am not using a power automate flow but a custom connector in power apps.  Here is the request and response of the connector as an example:

     

    REQUEST

    URLhttps://msmanaged-na.azure-apim.net/apim/gpt-5ftest-5fe5e1fd276b03232e-5f58172779bbf487ab/7f961c90734b4b88820150f998d16cbd/openai/deployments/gpt-4-32k/chat/completions?api-version=2023-05-15

    Method: post

    Header: {
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyIsImtpZCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyJ9.eyJhdWQiOiJodHRwczovL2FwaWh1Yi5henVyZS5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC8wZTE2MDli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saxiQPlQ1gZg4alpPFpw1rq8oIOF1D2S4vpZFrPB7r5gA3MUGHjCz9q3UIysnep0PYSWOnOhaO1HCWcLwa_Bl-QBhxtghXmMyYHsjp-ONM7rGhsindZpaRHJfNPNq-JPAuC-8wNSwXxrEi672vS0UMndJjYcNGOwuZ45KBTZoR_TXhoZAsNff7Yoj-KVElscNov63OHW1GoJTal6EGFYPX9bbC-o4LpmPZLsOkNdF33OpViDBGzyvg_k2WPzeRUS0Uo7yLnsSCd9jyRrlkZ7uR0TbrfQE_h5sPp-IRi78DHx7SpYtsmg4lhrRpzqx7OA",
    "Content-Type": "application/json",
    "api-key": "(removed for security)"
    }

     

    Body:

    {
    "messages": [
    {
    "role": "user",
    "content": "How are you?"
    }
    ]
    }

    Schema validation:

    Validation succeeded

     

    RESPONSE

    Status: (200)

    Headers:

    {
    "apim-request-id": "2ee9abb3-cbb4-4940-afef-ef0f614c85b0",
    "azureml-model-group": "online",
    "azureml-model-session": "aoai-gpt4-05222023-2",
    "cache-control": "no-cache, must-revalidate",
    "content-length": "398",
    "content-type": "application/json",
    "date": "Tue, 06 Jun 2023 14:57:34 GMT",
    "openai-model": "gpt-4-32k",
    "openai-processing-ms": "3893.9762",
    "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
    "vary": "Origin",
    "x-accel-buffering": "no",
    "x-content-type-options": "nosniff",
    "x-ms-apihub-cached-response": "false",
    "x-ms-apihub-obo": "false",
    "x-ms-client-request-id": "2ee9abb3-cbb4-4940-afef-ef0f614c85b0",
    "x-ms-region": "South Central US",
    "x-request-id": "a7e5ded4-54d7-4eda-a0d6-98e0464341b4"
    }

    Body:

    {
    "id": "chatcmpl-7OSPiRKmIb8ZNz0FId2WgxBIpyBPM",
    "object": "chat.completion",
    "created": 1686063450,
    "model": "gpt-4-32k",
    "choices": [
    {
    "index": 0,
    "finish_reason": "stop",
    "message": {
    "role": "assistant",
    "content": "As an AI, I do not have emotions or feelings, but I am here and ready to assist you with any questions or tasks you have!"
    }
    }
    ],
    "usage": {
    "completion_tokens": 29,
    "prompt_tokens": 11,
    "total_tokens": 40
    }
    }

    Schema validation:

    Validation succeeded

  • sathyav Profile Picture
    18 on at

    Basically your custom connector - is expecting a different input

    Looking at the error : send only table as an in input 🙂

    Collect(colChat,
    {
    role:"user",
    content:TextInput2
    }
    ));

    'GPT_Test'.ChatAPI(colChat)

    Dont think the customer connector is able to understand the model - able to take the model as a parameter

  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @mark_fleet 

     

    this is just a try:

    Set(
     varResponse,
     'GPT_Test'.ChatAPI({
     model: "gpt-4-32k",
     data: Collect(colChat, {role: "user", content: TextInput2})
     })
    );
    Reset(TextInput2);
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard