Should I study to understand fundamentals about TCP/IP model?

How Does it Work with OpenAI?

For your knowledge, Retrieval is priced at $0.20/GB per assistant per day.

How to traceback HTTP request and 3 rd. party request.

Anyone have the reference link.

Kindly pls share with us. Thank you.

Your question is quite unclear.

You can get more information about the API request and the return, including http headers returned, by using the python openai module, and a special method to get raw httpx results.

We can form an example request to the API, but specifying the additional method with_raw_response

from openai import OpenAI
client = OpenAI()
system = [{"role": "system",
           "content": "You are a helpful AI assistant."}]
user = [{"role": "user",
         "content": "Average number of bananas in a bunch?"}]
a =
  messages = system + user,

That then gives us facility to extract not just the response, and information like the token usage, but also information from the headers and the actual contents that were sent:

chat_completion = a.parse()
print("-- message content --")
print("-- usage --")
print("remaining-requests: "
print("-- API request --")

for a printout:

– message content –
The average number of bananas in a bunch can vary depending on the type of banana and how they are harvested. However, most bunches of bananas that you see in stores typically contain between 3 to 8 bananas. Commercially, a whole stalk of bananas known as a ‘hand’, which can be quite large, is divided into smaller bunches for sale.
– usage –
{‘completion_tokens’: 73, ‘prompt_tokens’: 26, ‘total_tokens’: 99}
remaining-requests: 9999
– API request –
b’{“messages”: [{“role”: “system”, “content”: “You are a helpful AI assistant.”}, {“role”: “user”, “content”: “Average number of bananas in a bunch?”}], “model”: “gpt-4-turbo-preview”, “max_tokens”: 200}’

You then edited and added some question about knowledge retrieval, which is a feature only available within the assistants API method, which is significantly more complex. You still don’t need to understand the raw mechanics of the network protocols going on behind the scenes though.

Here’s a guide to getting started with the OpenAI API, if you are unfamiliar and have yet to make your first request to an AI model.