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 · 2 comments
Open

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

aseelert opened this issue Sep 26, 2024 · 2 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
   }'
Copy link

This issue has been automatically marked as stale because it has not had activity within 90 days. It will be automatically closed if no further activity occurs within 30 days.

@github-actions github-actions bot added the stale label Dec 26, 2024
@bbrowning
Copy link
Contributor

We are working on adding a new Pipeline block that uses the chat completions API. However, I don't think there's a definite date to move all the existing Pipelines in data generation over to chat completions versus completions. I agree that ideally we'd only use the chat completions API, but an audit of our completions usage needs to be done to ensure that would work. Today we handling the prompt templates client-side for most of data generation, where the chat completions API handles that server-side via chat templates which doesn't let us directly change how we format prompts based on client-side needs per completion request.

@github-actions github-actions bot removed the stale label Jan 7, 2025
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

2 participants