writing-skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
executor-service-patternsBuild Jina Executor services, endpoints, DocArray schemas, Deployments, dynamic batching, templates, and Executor troubleshooting.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill when a task involves writing a Jina Executor, exposing @requests endpoints, serving a single service with Deployment, configuring uses_with or endpoint aliases, creating an Executor project, or debugging service startup/runtime errors.
from jina import Executor, Deployment, requests
from docarray import BaseDoc, DocList
class TextDoc(BaseDoc):
text: str = ""
class UppercaseExecutor(Executor):
@requests(on="/uppercase")
def uppercase(self, docs: DocList[TextDoc], **kwargs) -> DocList[TextDoc]:
for doc in docs:
doc.text = doc.text.upper()
return docs
with Deployment(uses=UppercaseExecutor, port=12345) as dep:
out = dep.post(on="/uppercase", inputs=DocList[TextDoc]([TextDoc(text="hello")]), return_type=DocList[TextDoc])
print(out[0].text)
For production, move the Executor into a module, define YAML, and start with jina deployment --uses deployment.yml.
Flow.