LostRuins / koboldcpp

A simple one-file way to run various GGML and GGUF models with KoboldAI's UI
https://github.com/lostruins/koboldcpp
GNU Affero General Public License v3.0
4.36k stars 312 forks source link

problem with kobold api requests from python #784

Closed blenderman94 closed 2 months ago

blenderman94 commented 2 months ago

hey im trying to get soke stuff on python with kobold api. basic things like get works nice from python request but im unable to post anything. even if i 1:1 mirror it from the api'gudie its not working in kobold im keep getting an error body err b i think its pythons stuff like usual ^^ also api/v1/generate fails even from the documents page (the offical gudie page)

api/extra/generate/stream works from the gudie page but fails from python request with body error

so basicaly here is a sample code to reproduce my error

import request url='https://localhost:5001/api/extra/generate/stream'

data={ "prompt":"the api is doing wierd stuff", "temperature":0.5, "top_p":0.9 }

response=request.post(url,data=data)

it fails with an error. rest of the stuff semingly works but this one is ^^

blenderman94 commented 2 months ago

nevermind. i just had to change to post(url,json=data) and print(response.text)

LostRuins commented 2 months ago

Alright as you got it working I will close this issue. Please reopen if there are problems.