Skip to main content
You can check the progress of the job by opening the Progress Bar page view, and use the Job UUID to identify the job at your Coop account. If you also passed a remote_inference_description and/or remote_inference_visibility setting to the run() method (as we do below) you can also use those to identify the job at Coop. See the Job UUID and URL that are returned in the job status table (this table is returned when any job is run remotely). Note that the Results UUID and Results URL are not automatically updated when the job completes:
from edsl import QuestionFreeText, Model

m = Model("gemini-1.5-flash")

q = QuestionFreeText(
    question_name = "poem",
    question_text = "Please write me a heartfelt poem for Valentine's Day."
)

r = q.by(m).run(
    background = True, # optional
    remote_inference_description = "A poem for Valentine's Day", # optional
    remote_inference_results_visibility = "public" # optional
)

Status updates

You can also check for updates by calling the fetch() method on the results object that you are generating. By default, this will check for results once every second. You can specify a different polling interval by passing the number of seconds for the interval. For example, while the job above is running we check for results every 2.0 seconds until they are returned:

r.fetch(polling_interval = 2.0)
Waiting for remote job to complete… Waiting for remote job to complete…
Results observations: 1; agents: 1; models: 1; scenarios: 1; questions: 1; Survey question names: ['poem'];
poemscenario_indexagent_indexagent_nameagent_instructiontemperaturetopKtopPmaxOutputTokensmodel_indexstopSequencesinference_servicemodelpoem_user_promptpoem_system_promptpoem_costpoem_raw_model_responsepoem_one_usd_buysiterationpoem_question_textpoem_question_optionspoem_question_typepoem_commentpoem_generated_tokenspoem_cache_usedpoem_cache_key
0The world is hushed, a winter’s grace, But in my heart, a sunlit space. Where thoughts of you, a warming fire, Ignite a love, a pure desire. No diamond’s gleam, no rose’s hue, Can match the joy I find in you. Your laughter’s song, a sweet refrain, Erases sorrow, heals all pain. Your gentle touch, a whispered plea, Awakens depths I long to see. Within your eyes, a universe, Where love’s own story finds its verse. So let this day, with hearts entwined, A testament to love we find. A bond so strong, a sacred vow, My love for you, I pledge it now. And as the stars begin to gleam, I whisper softly, “My sweet dream, My Valentine, my heart’s delight, You fill my world with purest light.”00Agent_0You are answering questions as if you were a human. Do not break character.0.5000001120480[]googlegemini-1.5-flashPlease write me a heartfelt poem for Valentine’s Day.nan0.000061{'candidates': [{'content': {'parts': [{'text': 'The world is hushed, a winter's grace,nBut in my heart, a sunlit space.nWhere thoughts of you, a warming fire,nIgnite a love, a pure desire.nnNo diamond's gleam, no rose's hue,nCan match the joy I find in you.nYour laughter's song, a sweet refrain,nErases sorrow, heals all pain.nnYour gentle touch, a whispered plea,nAwakens depths I long to see.nWithin your eyes, a universe,nWhere love's own story finds its verse.nnSo let this day, with hearts entwined,nA testament to love we find.nA bond so strong, a sacred vow,nMy love for you, I pledge it now.nnAnd as the stars begin to gleam,nI whisper softly, "My sweet dream,nMy Valentine, my heart's delight,nYou fill my world with purest light."n'}], 'role': 'model'}, 'finish_reason': 1, 'safety_ratings': [{'category': 8, 'probability': 1, 'blocked': False}, {'category': 10, 'probability': 1, 'blocked': False}, {'category': 7, 'probability': 1, 'blocked': False}, {'category': 9, 'probability': 1, 'blocked': False}], 'avg_logprobs': -0.1592810521671428, 'token_count': 0, 'grounding_attributions': []}], 'usage_metadata': {'prompt_token_count': 12, 'candidates_token_count': 201, 'total_token_count': 213, 'cached_content_token_count': 0}, 'model_version': 'gemini-1.5-flash'}16339.8725130Please write me a heartfelt poem for Valentine’s Day.nanfree_textnanThe world is hushed, a winter’s grace, But in my heart, a sunlit space. Where thoughts of you, a warming fire, Ignite a love, a pure desire. No diamond’s gleam, no rose’s hue, Can match the joy I find in you. Your laughter’s song, a sweet refrain, Erases sorrow, heals all pain. Your gentle touch, a whispered plea, Awakens depths I long to see. Within your eyes, a universe, Where love’s own story finds its verse. So let this day, with hearts entwined, A testament to love we find. A bond so strong, a sacred vow, My love for you, I pledge it now. And as the stars begin to gleam, I whisper softly, “My sweet dream, My Valentine, my heart’s delight, You fill my world with purest light.”True29877e4e1cd8969e4bd3507f301033f1
Now we can select and analyze the results as usual:
r.select("model", "answer.*")
model.modelanswer.poem
0gemini-1.5-flashThe world is hushed, a winter’s grace, But in my heart, a sunlit space. Where thoughts of you, a warming fire, Ignite a love, a pure desire. No diamond’s gleam, no rose’s hue, Can match the joy I find in you. Your laughter’s song, a sweet refrain, Erases sorrow, heals all pain. Your gentle touch, a whispered plea, Awakens depths I long to see. Within your eyes, a universe, Where love’s own story finds its verse. So let this day, with hearts entwined, A testament to love we find. A bond so strong, a sacred vow, My love for you, I pledge it now. And as the stars begin to gleam, I whisper softly, “My sweet dream, My Valentine, my heart’s delight, You fill my world with purest light.”
Here we post/update this notebook at Coop:

from edsl import Notebook

nb = Notebook(path = "run_background.ipynb")

if refresh := False:
    nb.push(
        description = "Run a remote survey in the background",
        alias = "run-background-notebook",
        visibility = "public"
    )
else:
    nb.patch("https://www.expectedparrot.com/content/RobinHorton/run-background-notebook", value = nb)
I