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

Added cost estimation. #23

Merged
merged 2 commits into from
Oct 4, 2023
Merged

Added cost estimation. #23

merged 2 commits into from
Oct 4, 2023

Conversation

emeryberger
Copy link
Member

No description provided.

@emeryberger emeryberger merged commit 4f8e3e3 into main Oct 4, 2023
2 checks passed
try:
completion = openai.ChatCompletion.create(
model=model,
request_timeout=30,
messages=[{"role": "user", "content": user_prompt}],
)
text = completion.choices[0].message.content
input_tokens = completion.usage.prompt_tokens
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, do you know how this compares to the previous input_tokens from tiktoken? They should be equal.

@nicovank nicovank deleted the cost_estimates branch October 4, 2023 08:57
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

Successfully merging this pull request may close these issues.

2 participants