Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace v1/completions with v1/chat/completions #290

Open
aseelert opened this issue Sep 26, 2024 · 0 comments
Open

replace v1/completions with v1/chat/completions #290

aseelert opened this issue Sep 26, 2024 · 0 comments

Comments

@aseelert
Copy link

Currently the legacy v1 API calls are used, so there are a lot of limits in terms of modes and the TPM of them.
https://platform.openai.com/docs/api-reference/completions/create

there should be a check for endpoint https://api.openai.com/v1/completions or https://api.openai.com/v1/chat/completions

as currently the SDG fails with just using the newer type:

packages/instructlab/sdg/pipeline.py", line 203, in _generate_single
    raise PipelineBlockError(
instructlab.sdg.pipeline.PipelineBlockError: 
PipelineBlockError(<class 'instructlab.sdg.llmblock.LLMBlock'>/gen_contexts): Error code: 400 - 
{'error': {'message': 
"Missing required parameter: 'messages'.", 
'type': 'invalid_request_error', 
'param': 'messages',
'code': 'missing_required_parameter'}}
curl https://api.openai.com/v1/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "Say this is a test",
    "max_tokens": 7,
    "temperature": 0
  }'

vs new:

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
     "model": "gpt-4o-mini",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant