Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Response returns JSON and complies with the openapi: 3.0.0 standard
#1
I am configuring an AI robot that can call LA's HTTP service, but the response needs to be returned in JSON and comply with the openapi: 3.0.0 standard.

I tried the following code, but the robot is unable to retrieve the response. What do I need to do?
 
Code:
Copy      Help
// class "Functions2.cs"
using Newtonsoft.Json.Linq;

static partial class Functions
{
    public static string GetFilePath(string FileName)
    {

        JObject jsonObject = JObject.Parse(FileName); 
        
        string fileName = (string)jsonObject["FileName"]; 
        
        string jsonPath = $$"""
{
    "Path": "D:\
{{fileName}}.pdf"
}
"""
;
        //print.it(jsonPath);
        return jsonPath;
    }
}


Schema:
Code:
Copy      Help
openapi: 3.0.0
info:
  title: File Path API
  version: 1.0.0
  description: API to retrieve file paths based on file names.
servers:
  - url: http://www.xxxxx.xyz:4455/
paths:
  /GetFilePath:
    get:
      summary: Get file path
      operationId: GetFilepath
      parameters:
        - name: FileName
          in: query
          schema:
            type: string
            example: 'cookbook'
      responses:
        '200':
          description: Successful response with file path.
          content:
            application/json:
              schema:
                type: object
                properties:
                  filePath:
                    type: string
                    description: The path of the file.
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string

I'm using the feature to create agents available at the following link. It's free and accessible to users worldwide.
https://chatglm.cn/main/alltoolsdetail

The created agent can use an API, similar to ChatGPT's GPTS. I successfully called the HTTP service in LA, but it failed to retrieve the return value.
Has anyone attempted something similar in GPTS?


Messages In This Thread
Response returns JSON and complies with the openapi: 3.0.0 standard - by Davider - 05-07-2024, 12:51 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)