{% extends shell('app') %} {% block title %}{{ _('Your session') }}{% endblock %} {% macro badge(part, value, progress=none) %}{% if value == 'ready' %}{{ _('Ready') }}{% elif value == 'failed' %}{{ _('Failed') }}{% elif progress is not none %}{{ progress }} %{% else %}{{ _('Starting…') }}{% endif %}{% endmacro %} {% block content %} {# reservations gives where to change the booking (longer, shorter); an older one without it gives nothing and the links are left out. #} {% set change_url = reservations_change_url(reservation) if reservations_change_url is defined else none %}
{{ reservation.model if reservation.mode == 'model' else _('JupyterLab with the GPU') }} · {{ nodes_label(reservation.node_list) if nodes_label is defined else reservation.nodes }} · {{ _('%(gb)s GB', gb=reservation.memory_gb) }} · {{ _('until %(time)s', time=pretty(reservation.end, false)) }}{% if change_url %} · {{ _('change') }}{% endif %}
{{ _('This session continues session %(num)s: its files are in your home.', num=resumed) }}
{% endif %} {% if reservation.node_list|length > 1 %}{{ _('Only the first machine of the booking is used.') }}
{% endif %}models-readonly/{{ m.name }} |
{{ '%.1f'|format(m.gib) if m.gib else '—' }} | {{ kind }} |
{{ _('OpenAI-compatible. Already set in JupyterLab as OPENAI_BASE_URL, OPENAI_API_KEY and MODEL.') }}
{{ base_url }}{{ api_key }}{{ reservation.model }}curl {{ base_url }}/embeddings \
-H "Authorization: Bearer {{ api_key }}" \
-H "Content-Type: application/json" \
-d '{"model": "{{ reservation.model }}", "input": ["Hola", "Buenos días"]}'
from openai import OpenAI
client = OpenAI(base_url="{{ base_url }}", api_key="{{ api_key }}")
result = client.embeddings.create(
model="{{ reservation.model }}",
input=["Hola", "Buenos días"],
)
print(len(result.data[0].embedding))
{% else %}
curl {{ base_url }}/chat/completions \
-H "Authorization: Bearer {{ api_key }}" \
-H "Content-Type: application/json" \
-d '{"model": "{{ reservation.model }}", "messages": [{"role": "user", "content": "Hola"}]}'
from openai import OpenAI
client = OpenAI(base_url="{{ base_url }}", api_key="{{ api_key }}")
reply = client.chat.completions.create(
model="{{ reservation.model }}",
messages=[{"role": "user", "content": "Hola"}],
)
print(reply.choices[0].message.content)
{% endif %}
storage {{ _('your storage: it stays') }}models-readonly {{ _('downloaded models, read only') }}storage/past-sessions/ {{ _('the rest of your home, at %(time)s', time=pretty(reservation.end, false)) }}