diff --git a/docs/v4/http/index.html b/docs/v4/http/index.html index 3529c76..556757f 100644 --- a/docs/v4/http/index.html +++ b/docs/v4/http/index.html @@ -45,21 +45,6 @@
spin_sdk.http
-async def copy(bytes: bytes, tx: componentize_py_async_support.streams.ByteStreamWriter)
-async def copy(bytes:bytes, tx:ByteStreamWriter):
- with tx:
- if bytes is not None:
- await tx.write_all(bytes)
-
async def send(request: Request) ‑> Response
Send an HTTP request and return a response or raise an error
+def strip_forbidden_headers(headers: MutableMapping[str, str]) ‑> MutableMapping[str, str]
+def strip_forbidden_headers(headers:MutableMapping[str, str]) -> MutableMapping[str, str]:
+ """
+ Strips forbidden headers for requests and responses originating from guest apps, per wasmtime/Spin
+ """
+ # See https://github.com/bytecodealliance/wasmtime/blob/e9e1665c5ef150d618bd8c21fb355c063596d6f7/crates/wasi-http/src/lib.rs#L42-L52
+ for header in [
+ "connection",
+ "keep-alive",
+ "proxy-authenticate",
+ "proxy-authorization",
+ "proxy-connection",
+ "transfer-encoding",
+ "upgrade",
+ "host",
+ "http2-settings"
+ ]:
+ try:
+ del headers[header]
+ except KeyError:
+ pass
+ return headers
+Strips forbidden headers for requests and responses originating from guest apps, per wasmtime/Spin
spin_sdk.llm
-def generate_embeddings(model: str, text: Sequence[str]) ‑> EmbeddingsResult
+def generate_embeddings(model: str, text: List[str]) ‑> EmbeddingsResult
def generate_embeddings(model: str, text: Sequence[str]) -> spin_llm.EmbeddingsResult:
+def generate_embeddings(model: str, text: List[str]) -> spin_llm.EmbeddingsResult:
"""
A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
@@ -83,8 +83,7 @@ Functions
A `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_llm_2_0_0.Error_InvalidInput(str))` will be raised if an invalid input is provided.
"""
- options = InferencingParams
- return spin_llm.infer(model, prompt, options)
+ return infer_with_options(model, prompt, None)
A componentize_py_types.Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.
A componentize_py_types.Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.
A componentize_py_types.Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.
A componentize_py_types.Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.
spin_sdk.variables
-async def get(key: str)
+async def get(key: str) ‑> str
async def get(key: str):
+async def get(key: str) -> str:
"""
Gets the value of the given key
"""