返回:
ChatCompletion(id='chatcmpl-1q5XOYFI7yDUqVQGeeIjCcLqjYIu6', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='Hi there! How can I assist you today?', role='assistant', function_call=None, tool_calls=None))], created=1716312783.982, model='gpt-3.5-turbo', object='chat.completion.chunk', system_fingerprint='fp_qKfzmqhaR4', usage=CompletionUsage(completion_tokens=10, prompt_tokens=2, total_tokens=12))
Hi there! How can I assist you today?
例行检查
问题描述 测试某三方渠道时,前端界面提示: 错误:json: cannot unmarshal number 1716313435.779 into Go struct field OpenAIProviderChatResponse.created of type int64![屏幕截图_22-5-2024_14026_one-api-llll koyeb app](https://github.com/MartialBE/one-api/assets/120313253/d81a7023-104a-44f3-a23f-894076119504)
复现步骤 三方渠道信息: URL:https://api.convoai.tech KEY:sk-cppjulr5nxs7y9hrd9xvvq6usxjncjkk7aw6xkjdxh1po5 测试模型:gpt-3.5-turbo 预期结果 单独在pyhton文件中调用openai库时返回正常
.py from openai import OpenAI
client = OpenAI( base_url="https://api.convoai.tech/v1", api_key="sk-cppjulr5nxs7y9hrd9xvvq6usxjncjkk7aw6xkjdxh1po5", ) response = client.chat.completions.create( model="gpt-3.5-turbo", messages=[ { "role": "user", "content": "Hello!" } ], ) print(response) print(response.choices[0].message.content)
返回: ChatCompletion(id='chatcmpl-1q5XOYFI7yDUqVQGeeIjCcLqjYIu6', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='Hi there! How can I assist you today?', role='assistant', function_call=None, tool_calls=None))], created=1716312783.982, model='gpt-3.5-turbo', object='chat.completion.chunk', system_fingerprint='fp_qKfzmqhaR4', usage=CompletionUsage(completion_tokens=10, prompt_tokens=2, total_tokens=12)) Hi there! How can I assist you today?
对比其他正常渠道和报错信息,估计是这个渠道返回的created是浮点数报错了