tensorzero 0.0.0__tar.gz → 0.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,10 +10,10 @@ Cargo.lock
10
10
  # These are backup files generated by rustfmt
11
11
  **/*.rs.bk
12
12
 
13
- # MSVC Windows builds of rustc generate these, which store debugging information
14
13
  *.pdb
15
14
  .envrc
16
15
  .python-version
16
+ *.env
17
17
 
18
18
  # VScode settings
19
19
  .vscode/
@@ -25,3 +25,16 @@ Cargo.lock
25
25
  __pycache__/
26
26
  *.py[cod]
27
27
  *$py.class
28
+
29
+ # Environment variables
30
+ .env
31
+ .envrc
32
+
33
+ # Python
34
+ .ipynb_checkpoints/
35
+ dist/
36
+ .venv/
37
+
38
+ # Misc
39
+ .ruff_cache/
40
+ credentials/
@@ -1,9 +1,8 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tensorzero
3
- Version: 0.0.0
3
+ Version: 0.0a1
4
4
  Summary: The Python client for TensorZero
5
5
  Author-email: Viraj Mehta <viraj@tensorzero.com>, Gabriel Bianconi <gabriel@tensorzero.com>
6
- License-File: LICENSE
7
6
  Requires-Python: >=3.10
8
7
  Requires-Dist: httpx>=0.27.0
9
8
  Description-Content-Type: text/markdown
@@ -23,9 +22,9 @@ pip install tensorzero
23
22
  ### Non-Streaming Inference
24
23
 
25
24
  ```python
26
- from tensorzero import AsyncTensorZero
25
+ from tensorzero import AsyncTensorZeroGateway
27
26
 
28
- with AsyncTensorZero("http://localhost:3000") as client:
27
+ with AsyncTensorZeroGateway("http://localhost:3000") as client:
29
28
  result = await client.inference(
30
29
  function_name="basic_test",
31
30
  input={
@@ -41,9 +40,9 @@ print(output[0].text) # Prints the text of the first content block returned by
41
40
  ### Streaming Inference
42
41
 
43
42
  ```python
44
- from tensorzero import AsyncTensorZero
43
+ from tensorzero import AsyncTensorZeroGateway
45
44
 
46
- async with AsyncTensorZero() as client:
45
+ async with AsyncTensorZeroGateway("http://localhost:3000") as client:
47
46
  stream = await client.chat.completions.create(
48
47
  function_name="basic_test",
49
48
  input={
@@ -13,9 +13,9 @@ pip install tensorzero
13
13
  ### Non-Streaming Inference
14
14
 
15
15
  ```python
16
- from tensorzero import AsyncTensorZero
16
+ from tensorzero import AsyncTensorZeroGateway
17
17
 
18
- with AsyncTensorZero("http://localhost:3000") as client:
18
+ with AsyncTensorZeroGateway("http://localhost:3000") as client:
19
19
  result = await client.inference(
20
20
  function_name="basic_test",
21
21
  input={
@@ -31,9 +31,9 @@ print(output[0].text) # Prints the text of the first content block returned by
31
31
  ### Streaming Inference
32
32
 
33
33
  ```python
34
- from tensorzero import AsyncTensorZero
34
+ from tensorzero import AsyncTensorZeroGateway
35
35
 
36
- async with AsyncTensorZero() as client:
36
+ async with AsyncTensorZeroGateway("http://localhost:3000") as client:
37
37
  stream = await client.chat.completions.create(
38
38
  function_name="basic_test",
39
39
  input={
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tensorzero"
3
- version = "0.0.0"
3
+ version = "0.0.a1"
4
4
  description = "The Python client for TensorZero"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -1,4 +1,4 @@
1
- from .client import AsyncTensorZero
1
+ from .client import AsyncTensorZeroGateway
2
2
  from .types import (
3
3
  ChatInferenceResponse,
4
4
  ContentBlock,
@@ -6,6 +6,7 @@ from .types import (
6
6
  InferenceChunk,
7
7
  InferenceResponse,
8
8
  JsonInferenceOutput,
9
+ JsonInferenceResponse,
9
10
  Text,
10
11
  TextChunk,
11
12
  ToolCall,
@@ -14,13 +15,14 @@ from .types import (
14
15
  )
15
16
 
16
17
  __all__ = [
18
+ "AsyncTensorZeroGateway",
17
19
  "ChatInferenceResponse",
18
20
  "ContentBlock",
19
21
  "FeedbackResponse",
20
22
  "InferenceChunk",
21
23
  "InferenceResponse",
22
24
  "JsonInferenceOutput",
23
- "AsyncTensorZero",
25
+ "JsonInferenceResponse",
24
26
  "Text",
25
27
  "TextChunk",
26
28
  "ToolCall",
@@ -4,7 +4,7 @@ TensorZero Client
4
4
  This module provides an asynchronous client for interacting with the TensorZero gateway.
5
5
  It includes functionality for making inference requests and sending feedback.
6
6
 
7
- The main class, AsyncTensorZero, offers methods for:
7
+ The main class, AsyncTensorZeroGateway, offers methods for:
8
8
  - Initializing the client with a base URL
9
9
  - Making inference requests (with optional streaming)
10
10
  - Sending feedback on episodes or inferences
@@ -28,24 +28,26 @@ from .types import (
28
28
  FeedbackResponse,
29
29
  InferenceChunk,
30
30
  InferenceResponse,
31
+ TensorZeroError,
31
32
  parse_inference_chunk,
32
33
  parse_inference_response,
33
34
  )
34
35
 
35
36
 
36
- class AsyncTensorZero:
37
- def __init__(self, base_url: str):
37
+ class AsyncTensorZeroGateway:
38
+ def __init__(self, base_url: str, *, timeout: Optional[float] = None):
38
39
  """
39
40
  Initialize the TensorZero client.
40
41
 
41
42
  :param base_url: The base URL of the TensorZero gateway. Example:"http://localhost:3000"
42
43
  """
43
44
  self.base_url = base_url
44
- self.client = httpx.AsyncClient()
45
+ self.client = httpx.AsyncClient(timeout=timeout)
45
46
  self.logger = logging.getLogger(__name__)
46
47
 
47
48
  async def inference(
48
49
  self,
50
+ *,
49
51
  function_name: str,
50
52
  input: Dict[str, Any],
51
53
  episode_id: Optional[UUID] = None,
@@ -111,7 +113,10 @@ class AsyncTensorZero:
111
113
  if parallel_tool_calls is not None:
112
114
  data["parallel_tool_calls"] = parallel_tool_calls
113
115
  response = await self.client.post(url, json=data)
114
- response.raise_for_status()
116
+ try:
117
+ response.raise_for_status()
118
+ except httpx.HTTPStatusError as e:
119
+ raise TensorZeroError(response) from e
115
120
  if not stream:
116
121
  return parse_inference_response(response.json())
117
122
  else:
@@ -119,6 +124,7 @@ class AsyncTensorZero:
119
124
 
120
125
  async def feedback(
121
126
  self,
127
+ *,
122
128
  metric_name: str,
123
129
  value: Any,
124
130
  inference_id: Optional[UUID] = None,
@@ -157,7 +163,10 @@ class AsyncTensorZero:
157
163
  data["inference_id"] = str(inference_id)
158
164
  url = urljoin(self.base_url, "feedback")
159
165
  response = await self.client.post(url, json=data)
160
- response.raise_for_status()
166
+ try:
167
+ response.raise_for_status()
168
+ except httpx.HTTPStatusError as e:
169
+ raise TensorZeroError(response) from e
161
170
  feedback_result = FeedbackResponse(**response.json())
162
171
  return feedback_result
163
172
 
@@ -2,6 +2,8 @@ from dataclasses import dataclass
2
2
  from typing import Any, Dict, List, Optional, Union
3
3
  from uuid import UUID
4
4
 
5
+ import httpx
6
+
5
7
  # Types for non-streaming inference responses
6
8
 
7
9
 
@@ -12,20 +14,22 @@ class Usage:
12
14
 
13
15
 
14
16
  @dataclass
15
- class Text:
16
- text: str
17
+ class ContentBlock:
18
+ type: str
17
19
 
18
20
 
19
21
  @dataclass
20
- class ToolCall:
21
- name: str
22
- arguments: Dict[str, Any]
23
- id: str
24
- parsed_name: Optional[str]
25
- parsed_arguments: Optional[Dict[str, Any]]
22
+ class Text(ContentBlock):
23
+ text: str
26
24
 
27
25
 
28
- ContentBlock = Union[Text, ToolCall]
26
+ @dataclass
27
+ class ToolCall(ContentBlock):
28
+ arguments: Optional[Dict[str, Any]]
29
+ id: str
30
+ name: Optional[str]
31
+ raw_arguments: Dict[str, Any]
32
+ raw_name: str
29
33
 
30
34
 
31
35
  @dataclass
@@ -39,7 +43,7 @@ class ChatInferenceResponse:
39
43
  inference_id: UUID
40
44
  episode_id: UUID
41
45
  variant_name: str
42
- output: List[ContentBlock]
46
+ content: List[ContentBlock]
43
47
  usage: Usage
44
48
 
45
49
 
@@ -56,12 +60,12 @@ InferenceResponse = Union[ChatInferenceResponse, JsonInferenceResponse]
56
60
 
57
61
 
58
62
  def parse_inference_response(data: Dict[str, Any]) -> InferenceResponse:
59
- if "output" in data and isinstance(data["output"], list):
63
+ if "content" in data and isinstance(data["content"], list):
60
64
  return ChatInferenceResponse(
61
65
  inference_id=UUID(data["inference_id"]),
62
66
  episode_id=UUID(data["episode_id"]),
63
67
  variant_name=data["variant_name"],
64
- output=[parse_content_block(block) for block in data["output"]],
68
+ content=[parse_content_block(block) for block in data["content"]],
65
69
  usage=Usage(**data["usage"]),
66
70
  )
67
71
  elif "output" in data and isinstance(data["output"], dict):
@@ -79,14 +83,15 @@ def parse_inference_response(data: Dict[str, Any]) -> InferenceResponse:
79
83
  def parse_content_block(block: Dict[str, Any]) -> ContentBlock:
80
84
  block_type = block["type"]
81
85
  if block_type == "text":
82
- return Text(text=block["text"])
86
+ return Text(text=block["text"], type=block_type)
83
87
  elif block_type == "tool_call":
84
88
  return ToolCall(
85
- name=block["name"],
86
- arguments=block["arguments"],
89
+ arguments=block.get("arguments"),
87
90
  id=block["id"],
88
- parsed_name=block.get("parsed_name"),
89
- parsed_arguments=block.get("parsed_arguments"),
91
+ name=block.get("name"),
92
+ raw_arguments=block["raw_arguments"],
93
+ raw_name=block["raw_name"],
94
+ type=block_type,
90
95
  )
91
96
  else:
92
97
  raise ValueError(f"Unknown content block type: {block}")
@@ -96,7 +101,12 @@ def parse_content_block(block: Dict[str, Any]) -> ContentBlock:
96
101
 
97
102
 
98
103
  @dataclass
99
- class TextChunk:
104
+ class ContentBlockChunk:
105
+ type: str
106
+
107
+
108
+ @dataclass
109
+ class TextChunk(ContentBlockChunk):
100
110
  # In the possibility that multiple text messages are sent in a single streaming response,
101
111
  # this `id` will be used to disambiguate them
102
112
  id: str
@@ -104,15 +114,12 @@ class TextChunk:
104
114
 
105
115
 
106
116
  @dataclass
107
- class ToolCallChunk:
108
- name: str
117
+ class ToolCallChunk(ContentBlockChunk):
109
118
  # This is the tool call ID that many LLM APIs use to associate tool calls with tool responses
110
119
  id: str
111
- # `arguments` will come as partial JSON
112
- arguments: str
113
-
114
-
115
- ContentBlockChunk = Union[TextChunk, ToolCallChunk]
120
+ # `raw_arguments` will come as partial JSON
121
+ raw_arguments: str
122
+ raw_name: str
116
123
 
117
124
 
118
125
  @dataclass
@@ -160,10 +167,13 @@ def parse_inference_chunk(chunk: Dict[str, Any]) -> InferenceChunk:
160
167
  def parse_content_block_chunk(block: Dict[str, Any]) -> ContentBlockChunk:
161
168
  block_type = block["type"]
162
169
  if block_type == "text":
163
- return TextChunk(id=block["id"], text=block["text"])
170
+ return TextChunk(id=block["id"], text=block["text"], type=block_type)
164
171
  elif block_type == "tool_call":
165
172
  return ToolCallChunk(
166
- name=block["name"], id=block["id"], arguments=block["arguments"]
173
+ id=block["id"],
174
+ raw_arguments=block["raw_arguments"],
175
+ raw_name=block["raw_name"],
176
+ type=block_type,
167
177
  )
168
178
  else:
169
179
  raise ValueError(f"Unknown content block type: {block}")
@@ -173,3 +183,12 @@ def parse_content_block_chunk(block: Dict[str, Any]) -> ContentBlockChunk:
173
183
  @dataclass
174
184
  class FeedbackResponse:
175
185
  feedback_id: UUID
186
+
187
+
188
+ # Custom TensorZero error type
189
+ class TensorZeroError(Exception):
190
+ def __init__(self, response: httpx.Response):
191
+ self.response = response
192
+
193
+ def __str__(self):
194
+ return f"TensorZeroError (status code {self.response.status_code}): {self.response.text}"
@@ -22,19 +22,18 @@ from uuid import UUID
22
22
  import pytest
23
23
  import pytest_asyncio
24
24
  from tensorzero import (
25
- AsyncTensorZero,
25
+ AsyncTensorZeroGateway,
26
+ ChatInferenceResponse,
26
27
  FeedbackResponse,
27
- Text,
28
- TextChunk,
29
- ToolCall,
30
- ToolCallChunk,
28
+ JsonInferenceResponse,
31
29
  )
30
+ from tensorzero.types import TensorZeroError
32
31
  from uuid_extensions import uuid7
33
32
 
34
33
 
35
34
  @pytest_asyncio.fixture
36
35
  async def client():
37
- async with AsyncTensorZero("http://localhost:3000") as client:
36
+ async with AsyncTensorZeroGateway("http://localhost:3000") as client:
38
37
  yield client
39
38
 
40
39
 
@@ -48,11 +47,12 @@ async def test_basic_inference(client):
48
47
  },
49
48
  )
50
49
  assert result.variant_name == "test"
51
- output = result.output
52
- assert len(output) == 1
53
- assert isinstance(output[0], Text)
50
+ assert isinstance(result, ChatInferenceResponse)
51
+ content = result.content
52
+ assert len(content) == 1
53
+ assert content[0].type == "text"
54
54
  assert (
55
- output[0].text
55
+ content[0].text
56
56
  == "Megumin gleefully chanted her spell, unleashing a thunderous explosion that lit up the sky and left a massive crater in its wake."
57
57
  )
58
58
  usage = result.usage
@@ -102,7 +102,7 @@ async def test_inference_streaming(client):
102
102
  assert variant_name == "test"
103
103
  if i + 1 < len(chunks):
104
104
  assert len(chunk.content) == 1
105
- assert isinstance(chunk.content[0], TextChunk)
105
+ assert chunk.content[0].type == "text"
106
106
  assert chunk.content[0].text == expected_text[i]
107
107
  else:
108
108
  assert len(chunk.content) == 0
@@ -125,14 +125,15 @@ async def test_tool_call_inference(client):
125
125
  },
126
126
  )
127
127
  assert result.variant_name == "variant"
128
- output = result.output
129
- assert len(output) == 1
130
- assert isinstance(output[0], ToolCall)
131
- assert output[0].name == "get_temperature"
132
- assert output[0].id == "0"
133
- assert output[0].arguments == '{"location":"Brooklyn","units":"celsius"}'
134
- assert output[0].parsed_name == "get_temperature"
135
- assert output[0].parsed_arguments == {"location": "Brooklyn", "units": "celsius"}
128
+ assert isinstance(result, ChatInferenceResponse)
129
+ content = result.content
130
+ assert len(content) == 1
131
+ assert content[0].type == "tool_call"
132
+ assert content[0].raw_name == "get_temperature"
133
+ assert content[0].id == "0"
134
+ assert content[0].raw_arguments == '{"location":"Brooklyn","units":"celsius"}'
135
+ assert content[0].name == "get_temperature"
136
+ assert content[0].arguments == {"location": "Brooklyn", "units": "celsius"}
136
137
  usage = result.usage
137
138
  assert usage.input_tokens == 10
138
139
  assert usage.output_tokens == 10
@@ -154,14 +155,15 @@ async def test_malformed_tool_call_inference(client):
154
155
  variant_name="bad_tool",
155
156
  )
156
157
  assert result.variant_name == "bad_tool"
157
- output = result.output
158
- assert len(output) == 1
159
- assert isinstance(output[0], ToolCall)
160
- assert output[0].name == "get_temperature"
161
- assert output[0].id == "0"
162
- assert output[0].arguments == '{"location":"Brooklyn","units":"Celsius"}'
163
- assert output[0].parsed_name == "get_temperature"
164
- assert output[0].parsed_arguments is None
158
+ assert isinstance(result, ChatInferenceResponse)
159
+ content = result.content
160
+ assert len(content) == 1
161
+ assert content[0].type == "tool_call"
162
+ assert content[0].raw_name == "get_temperature"
163
+ assert content[0].id == "0"
164
+ assert content[0].raw_arguments == '{"location":"Brooklyn","units":"Celsius"}'
165
+ assert content[0].name == "get_temperature"
166
+ assert content[0].arguments is None
165
167
  usage = result.usage
166
168
  assert usage.input_tokens == 10
167
169
  assert usage.output_tokens == 10
@@ -203,10 +205,10 @@ async def test_tool_call_streaming(client):
203
205
  assert variant_name == "variant"
204
206
  if i + 1 < len(chunks):
205
207
  assert len(chunk.content) == 1
206
- assert isinstance(chunk.content[0], ToolCallChunk)
207
- assert chunk.content[0].name == "get_temperature"
208
+ assert chunk.content[0].type == "tool_call"
209
+ assert chunk.content[0].raw_name == "get_temperature"
208
210
  assert chunk.content[0].id == "0"
209
- assert chunk.content[0].arguments == expected_text[i]
211
+ assert chunk.content[0].raw_arguments == expected_text[i]
210
212
  else:
211
213
  assert len(chunk.content) == 0
212
214
  assert chunk.usage.input_tokens == 10
@@ -221,7 +223,7 @@ async def test_json_streaming(client):
221
223
  function_name="json_success",
222
224
  input={
223
225
  "system": {"assistant_name": "Alfred Pennyworth"},
224
- "messages": [{"role": "user", "content": "Hello, world!"}],
226
+ "messages": [{"role": "user", "content": {"country": "Japan"}}],
225
227
  },
226
228
  stream=True,
227
229
  )
@@ -263,16 +265,17 @@ async def test_json_streaming(client):
263
265
 
264
266
 
265
267
  @pytest.mark.asyncio
266
- async def test_json_sucess(client):
268
+ async def test_json_success(client):
267
269
  result = await client.inference(
268
270
  function_name="json_success",
269
271
  input={
270
272
  "system": {"assistant_name": "Alfred Pennyworth"},
271
- "messages": [{"role": "user", "content": "Hello, world!"}],
273
+ "messages": [{"role": "user", "content": {"country": "Japan"}}],
272
274
  },
273
275
  stream=False,
274
276
  )
275
277
  assert result.variant_name == "test"
278
+ assert isinstance(result, JsonInferenceResponse)
276
279
  assert result.output.raw == '{"answer":"Hello"}'
277
280
  assert result.output.parsed == {"answer": "Hello"}
278
281
  assert result.usage.input_tokens == 10
@@ -290,6 +293,7 @@ async def test_json_failure(client):
290
293
  stream=False,
291
294
  )
292
295
  assert result.variant_name == "test"
296
+ assert isinstance(result, JsonInferenceResponse)
293
297
  assert (
294
298
  result.output.raw
295
299
  == "Megumin gleefully chanted her spell, unleashing a thunderous explosion that lit up the sky and left a massive crater in its wake."
@@ -331,4 +335,12 @@ async def test_feedback_invalid_input(client):
331
335
  )
332
336
 
333
337
 
334
- # Add more tests as needed for edge cases, error handling, etc.
338
+ @pytest.mark.asyncio
339
+ async def test_tensorzero_error(client):
340
+ with pytest.raises(TensorZeroError) as excinfo:
341
+ await client.inference(function_name="not_a_function", input={"messages": []})
342
+
343
+ assert (
344
+ str(excinfo.value)
345
+ == 'TensorZeroError (status code 404): {"error":"Unknown function: not_a_function"}'
346
+ )
tensorzero-0.0.0/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
File without changes