stubs.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. from __future__ import annotations
  2. class Model():
  3. def __getitem__(self, item):
  4. return getattr(self, item)
  5. class ChatCompletion(Model):
  6. def __init__(self, content: str, finish_reason: str):
  7. self.choices = [ChatCompletionChoice(ChatCompletionMessage(content, finish_reason))]
  8. class ChatCompletionChunk(Model):
  9. def __init__(self, content: str, finish_reason: str):
  10. self.choices = [ChatCompletionDeltaChoice(ChatCompletionDelta(content, finish_reason))]
  11. class ChatCompletionMessage(Model):
  12. def __init__(self, content: str, finish_reason: str):
  13. self.content = content
  14. self.finish_reason = finish_reason
  15. class ChatCompletionChoice(Model):
  16. def __init__(self, message: ChatCompletionMessage):
  17. self.message = message
  18. class ChatCompletionDelta(Model):
  19. def __init__(self, content: str, finish_reason: str):
  20. self.content = content
  21. self.finish_reason = finish_reason
  22. class ChatCompletionDeltaChoice(Model):
  23. def __init__(self, delta: ChatCompletionDelta):
  24. self.delta = delta
  25. class Image(Model):
  26. url: str
  27. def __init__(self, url: str) -> None:
  28. self.url = url
  29. class ImagesResponse(Model):
  30. data: list[Image]
  31. def __init__(self, data: list) -> None:
  32. self.data = data