forked from phoenix/litellm-mirror
543 lines
17 KiB
Python
543 lines
17 KiB
Python
from litellm.types.utils import (
|
|
ChatCompletionDeltaToolCall,
|
|
Delta,
|
|
Function,
|
|
ModelResponse,
|
|
StreamingChoices,
|
|
)
|
|
|
|
chunks = [
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="To answer",
|
|
role="assistant",
|
|
function_call=None,
|
|
tool_calls=None,
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" your", role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" question about",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=None,
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" how", role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" many rows are in the ",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=None,
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="'users' table, I",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=None,
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="'ll", role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" need to", role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" run", role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" a SQL query.",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=None,
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" Let", role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" me", role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" ", role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="do that for",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=None,
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content=" you.", role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=[
|
|
ChatCompletionDeltaToolCall(
|
|
id="toolu_01H3AjkLpRtGQrof13CBnWfK",
|
|
function=Function(arguments="", name="sql_query"),
|
|
type="function",
|
|
index=1,
|
|
)
|
|
],
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=[
|
|
ChatCompletionDeltaToolCall(
|
|
id=None,
|
|
function=Function(arguments="", name=None),
|
|
type="function",
|
|
index=1,
|
|
)
|
|
],
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656356,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=[
|
|
ChatCompletionDeltaToolCall(
|
|
id=None,
|
|
function=Function(arguments='{"', name=None),
|
|
type="function",
|
|
index=1,
|
|
)
|
|
],
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656357,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=[
|
|
ChatCompletionDeltaToolCall(
|
|
id=None,
|
|
function=Function(arguments='query": ', name=None),
|
|
type="function",
|
|
index=1,
|
|
)
|
|
],
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656357,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=[
|
|
ChatCompletionDeltaToolCall(
|
|
id=None,
|
|
function=Function(arguments='"SELECT C', name=None),
|
|
type="function",
|
|
index=1,
|
|
)
|
|
],
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656357,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=[
|
|
ChatCompletionDeltaToolCall(
|
|
id=None,
|
|
function=Function(arguments="OUNT(*", name=None),
|
|
type="function",
|
|
index=1,
|
|
)
|
|
],
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656357,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=[
|
|
ChatCompletionDeltaToolCall(
|
|
id=None,
|
|
function=Function(arguments=") ", name=None),
|
|
type="function",
|
|
index=1,
|
|
)
|
|
],
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656357,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=[
|
|
ChatCompletionDeltaToolCall(
|
|
id=None,
|
|
function=Function(arguments="FROM use", name=None),
|
|
type="function",
|
|
index=1,
|
|
)
|
|
],
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656357,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason=None,
|
|
index=0,
|
|
delta=Delta(
|
|
content="",
|
|
role=None,
|
|
function_call=None,
|
|
tool_calls=[
|
|
ChatCompletionDeltaToolCall(
|
|
id=None,
|
|
function=Function(arguments='rs;"}', name=None),
|
|
type="function",
|
|
index=1,
|
|
)
|
|
],
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656357,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
ModelResponse(
|
|
id="chatcmpl-634a6ad3-483a-44a1-8cdd-3befbeb4ac2f",
|
|
choices=[
|
|
StreamingChoices(
|
|
finish_reason="tool_calls",
|
|
index=0,
|
|
delta=Delta(
|
|
content=None, role=None, function_call=None, tool_calls=None
|
|
),
|
|
logprobs=None,
|
|
)
|
|
],
|
|
created=1722656357,
|
|
model="claude-3-5-sonnet-20240620",
|
|
object="chat.completion.chunk",
|
|
system_fingerprint=None,
|
|
),
|
|
]
|