openai-java
openai-java copied to clipboard
OpenAi GPT API for Java. Including all API from OpenAI except deprecated. It especially includes stream client and jtokkit with function calculation. Including Baidu AI.
使用Parallel function calling,会返回多个role为tool的message。 调用模型为gpt-4-1106-preview 第一次tool calling 先不讨论,因为一般人不会用流式调用第一次tool calls, 第二次tool calls调用prompt比官方多了1。 例子: ``` { "messages": [ { "role": "system", "content": "你是一个数学达人" }, { "role": "user", "content": "两道计算题 20+70; 30x100" }, {...
与openai返回的token对比发现,几乎各chat模型都有计算方式错误或结果偏差,于是我自己从零建模和编写了token计算工具 你的部分token计算代码有严重错误,这里列举部分: - vision base64读取 - vision图片缩放 - function call、functions - tool call、tools - 0301/0314与0613版本计算差异 - 多个参数(model、functions)组合使用对token计算的影响 - 应使用`encodeOrdinary`来跳过special tokens 由于精力有限我无法在开源代码上提交修改,本issue只是告知绝大部分token计算都有误,请你自己有精力时研究下
Great project i can't use because i use Java 8: java: cannot access xyz.felh.openai.chat.ChatMessage bad class file: lib/jtokkit/core-4.0.2024080901.jar!/xyz/felh/openai/chat/ChatMessage.class class file has wrong version 65.0, should be 52.0 Please remove or...
Hi developer, when will a update to the newest chatgpt api come? :)
If definitions is used, the function token cannot be calculated successfully This is widely used in structured-outputs , you can see the document https://platform.openai.com/docs/guides/structured-outputs/definitions-are-supported