jaypyles / FreeAskInternet-API

Better engineered version of the FreeAskInternet (only the API) tool, empowering developers to build apps which integrate AI/SearXNG.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Completions end point doesn't show the content, it does show the links t

pmirla opened this issue · comments

Completions end point doesn't show the content, it does show the links though.
Do you see any issue? Thank you
What tests/changes do you suggest? Thx

import requests

url = "http://localhost:8000/v1/chat/completions"

body = {
    "model": "gpt3.5",
    "messages": [{"role": "user", "content": "Why does the moon create the tides"}]
}

response = requests.post(url, json=body, stream=True)

if response.status_code == 200:
    try:
        for line in response.iter_lines():
            if line:
                decoded_line = line.decode('utf-8')
                print(decoded_line)  # or process your line here
    except Exception as e:
        print(f"An error occurred: {e}")
else:
    print(f"Failed to get response, status code: {response.status_code}")



data: {"model":"gpt3.5","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
data: {"model":"gpt3.5","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"\n\n"},"finish_reason":null}]}
data: {"model":"gpt3.5","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"---\n"},"finish_reason":null}]}
data: {"model":"gpt3.5","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"Citations:\n"},"finish_reason":null}]}
data: {"model":"gpt3.5","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"*[1. https://www.timeanddate.com/astronomy/moon/tides.html](https://www.timeanddate.com/astronomy/moon/tides.html)*"},"finish_reason":null}]}
data: {"model":"gpt3.5","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]}
data: {"model":"gpt3.5","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"*[2. [https://scijinks.gov/tides/](htt](https://scijinks.gov/tides/](https://scijinks.gov/tides/)*)

docker ps

CONTAINER ID   IMAGE                                  COMMAND                  CREATED         STATUS              PORTS                    NAMES
a6134c8abf07   jpyles0524/freeaskinternetapi:latest   "pdm run python -m u…"   6 minutes ago   Up 45 seconds       0.0.0.0:8000->8000/tcp   searchbackend
edd2e63a5a76   searxng/searxng:latest                 "/sbin/tini -- /usr/…"   6 minutes ago   Up 45 seconds       8080/tcp                 freeaskinternet-api-searxng-1
e33c6697f75d   missuo/freegpt35:latest                "docker-entrypoint.s…"   6 minutes ago   Up 45 seconds       3040/tcp                 llm-freegpt35
8506bd3ed524   moby/buildkit:buildx-stable-1          "buildkitd"              12 hours ago    Up About a minute                            buildx_buildkit_mybuilder0

Looks like the FreeGPT3.5 service I was using, is not currently working. This is not my service, so I will not be debugging that any further.