I created Langchain GPT which interacts with third party API and answers everything about Langchain.

This post is about learning & nuances discovered while creating.

• If you want to do RAG and interact with third-party data, you need to write instructions around the following lines.

“I will give you a query. You will take this query, and pass this as “query” param in the api. API will return response from which you will extract the contexts key from the result and just display it to the user.”

• Next is configuring an action. When you start, you will have to write OpenAPI spec for the api. You can use GPT 3.5 or 4 itself to convert a curl call to the OpenAPI spec. I used the following prompt.

"I am giving you a curl call and a sample OpenAPI spec. You need to give me the correct OpenAPI spec for the curl call.

Curl: <curl_call_here>
Sample OpenAPI Spec: <sample_spec>
Output OpenAPI Spec:
"

• Make sure that the Output OpenAPI spec has following:
• Proper schema for request parameters
• Proper schema for response object. This is necessary & you will have to define which key from the response you want to use in your prompt. In my case, I have specified context key in the results key.

• If you are using API Token based auth and you are sending auth token as “Auth Token <token_here>”, then use the following config

2 Likes

I am not a developer by default. Would this method work as a copy/paste with code?

Hey, yes it should.
Feel free to tweak the instructions as per usecase.