(
self,
api_key: str,
base_url: str,
organization: Optional[str] = None,
project: Optional[str] = None,
max_retries: int = 2,
timeout: Optional[float] = None,
)
| 81 | |
| 82 | class Resource: |
| 83 | def __init__( |
| 84 | self, |
| 85 | api_key: str, |
| 86 | base_url: str, |
| 87 | organization: Optional[str] = None, |
| 88 | project: Optional[str] = None, |
| 89 | max_retries: int = 2, |
| 90 | timeout: Optional[float] = None, |
| 91 | ) -> None: |
| 92 | # # client args |
| 93 | self.client_args: ClientArgs = { |
| 94 | "api_key": api_key, |
| 95 | "base_url": self._enforce_trailing_slash(base_url), |
| 96 | "organization": organization, |
| 97 | "project": project, |
| 98 | "max_retries": max_retries, |
| 99 | "timeout": timeout, |
| 100 | } |
| 101 | |
| 102 | # priority items |
| 103 | self._last_used_time: float = time.time() |
| 104 | self._request_count: int = 0 |
| 105 | self._prompt_tokens: int = 0 |
| 106 | self._completion_tokens: int = 0 |
| 107 | self._total_tokens: int = 0 |
| 108 | # self._client = OpenAI(api_key=self.api_key, base_url=self.base_url) |
| 109 | |
| 110 | def __lt__(self, other: "Resource") -> bool: |
| 111 | """Compare two resources based on request rate, token usage and price |
nothing calls this directly
no test coverage detected