Skip to content

Commit

Permalink
fix: update litellm changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanleomk committed Feb 2, 2025
1 parent d1708b5 commit 4ac0f56
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/integrations/litellm.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class User(BaseModel):
age: int

# Create structured output
user = client.completion(
user = client.chat.completions.create(
model="gpt-3.5-turbo", # Can use any supported model
messages=[
{"role": "user", "content": "Extract: Jason is 25 years old"},
Expand All @@ -52,12 +52,14 @@ import asyncio
# Enable instructor patches for async
client = instructor.from_litellm(acompletion)


class User(BaseModel):
name: str
age: int


async def extract_user():
user = await client.acompletion(
user = await client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": "Extract: Jason is 25 years old"},
Expand All @@ -66,9 +68,11 @@ async def extract_user():
)
return user


# Run async function
user = asyncio.run(extract_user())
print(user) # User(name='Jason', age=25)

```

## Cost Calculation
Expand Down

0 comments on commit 4ac0f56

Please sign in to comment.