TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

RAG API + OpenAI compatibility

3 点作者 pkhodiyar大约 1 个月前

1 comment

pkhodiyar大约 1 个月前
Hey HN,<p>We’ve just rolled out an OpenAI-Compatible Endpoint at CustomGPT.ai that should make it super easy to try Retrieval-Augmented Generation (RAG) in your existing OpenAI-based code.<p>Now, hundreds of tools in the OpenAI ecosystem can add RAG capabilities with minimal changes.<p>Docs here - <a href="https:&#x2F;&#x2F;docs.customgpt.ai&#x2F;reference&#x2F;customgptai-openai-sdk-compatibility" rel="nofollow">https:&#x2F;&#x2F;docs.customgpt.ai&#x2F;reference&#x2F;customgptai-openai-sdk-c...</a><p>All you do is: 1. Swap your api_key to the CustomGPT one, 2. Change the base_url to our endpoint. And thats it.<p>You can keep using your OpenAI Python SDK code. Under the hood, we handle context retrieval from your project knowledge sources before generating a final answer.<p>We support the chat.completions endpoint with the same request&#x2F;response structure. If you call an unsupported endpoint, we return a 404 or 501.<p>This opens up the entire ecosystem of OpenAI-compatible tools, frameworks, and services for your RAG workflows. Everything else—conversation format, message handling, etc.—remains the same.<p>Check out a quick Python snippet:<p>from openai import OpenAI client = OpenAI( api_key=&quot;CUSTOMGPT_API_KEY&quot;, base_url=&quot;<a href="https:&#x2F;&#x2F;app.customgpt.ai&#x2F;api&#x2F;v1&#x2F;projects&#x2F;{project_id}&#x2F;" rel="nofollow">https:&#x2F;&#x2F;app.customgpt.ai&#x2F;api&#x2F;v1&#x2F;projects&#x2F;{project_id}&#x2F;</a>&quot; ) response = client.chat.completions.create( model=&quot;gpt-4&quot;, # We&#x27;ll ignore the model param and use your project&#x27;s default messages=[ {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: &quot;You are a helpful assistant.&quot;}, {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Who are you?&quot;} ], ) print(response.choices[0].message.content)<p>We’re ignoring certain OpenAI parameters like model and temperature. If you try to call an endpoint we don’t support, you’ll get a 404 or 501. Otherwise, your code runs pretty much the same.<p>We built this because we kept hearing people say, “I’d like to try CustomGPT.ai for better context retrieval, but I already have so much code in the OpenAI ecosystem.” Hopefully this bridges the gap. Feedback and PR requests are welcome. Let us know how it goes!<p>Hope this helps folks who’ve been on the fence about trying RAG but don’t want to break everything they already have running!<p>If you have any question regrading the implementation, please ask below