You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import instructor
from litellm import completion
from pydantic import BaseModel
class User(BaseModel):
name: str
age: int
client = instructor.from_litellm(completion)
instructor_resp, raw_completion = client.chat.completions.create_with_completion(
model="claude-3-5-sonnet-20240620",
max_tokens=1024,
messages=[
{
"role": "user",
"content": "Extract Jason is 25 years old.",
}
],
response_model=User,
)
print(raw_completion._hidden_params["response_cost"])
#> 0.00189
Additionally, the LiteLLM call and the instructor call will not cost the same since we need to make a function call in the first one and then we're just doing a normal chat completion call in the second.
**Bug
Excecuting the following code ...
Results in:
Would like to like more precision in instructor cost response when supporting litellm API
The text was updated successfully, but these errors were encountered: