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?
#2
This is a really cool feature! I can execute functions from LA through an intelligent agent similar to GPT, even get GPT to generate code, execute it through csscript in LA, and thus control my computer.  Smile
#3
Thanks for sharing that, looks interesting. I was unable to get the website to send me a code on my mobile phone, though. Maybe the server is too busy.
#4
The website is currently undergoing a major redesign. I noticed there's an English version now, so I believe it will be back soon. You can try again later. Good luck!
#5
Thank you, Davider, I've been able to login with a code sent to my mobile phone. In case this may help someone else, the code sent is prepended with '$', which I needed to remove. I asked it for a list of programming languages that it code in, it came back with about 35.
Great find!


Forum Jump:


Users browsing this thread: 1 Guest(s)