From a1ad06ac6bceae5c2802d8333f5b0168e452d8d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20Hvilsh=C3=B8j?= Date: Tue, 17 Dec 2024 14:19:07 +0100 Subject: [PATCH] fix: fix line numbers because of ruff format --- docs/editor_agents/examples/index.md | 42 ++++++++++++++-------------- docs/task_agents/examples/index.md | 4 +-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/editor_agents/examples/index.md b/docs/editor_agents/examples/index.md index 9aed0ac..229bcef 100644 --- a/docs/editor_agents/examples/index.md +++ b/docs/editor_agents/examples/index.md @@ -139,13 +139,13 @@ First, we import dependencies and set up the Project: Make sure to insert your Project's hash here. -[agent.py](../../code_examples/gcp/frame_classification.py) lines:1-14 +[agent.py](../../code_examples/gcp/frame_classification.py) lines:1-15 Next, we create a data model and a system prompt based on the Project Ontology that will tell Claude how to structure its response: -[agent.py](../../code_examples/gcp/frame_classification.py) lines:17-28 +[agent.py](../../code_examples/gcp/frame_classification.py) lines:18-29 @@ -316,14 +316,14 @@ Next, we create a data model and a system prompt based on the Project Ontology t We also need an Anthropic API client to communicate with Claude: -[agent.py](../../code_examples/gcp/frame_classification.py) lines:31-32 +[agent.py](../../code_examples/gcp/frame_classification.py) lines:32-33 Finally, we define our editor agent: -[agent.py](../../code_examples/gcp/frame_classification.py) lines:35-66 +[agent.py](../../code_examples/gcp/frame_classification.py) lines:36-65 The agent: @@ -597,7 +597,7 @@ For this, you will need to have your `` ready. -[agent.py](../../code_examples/gcp/object_classification.py) lines:1-13 +[agent.py](../../code_examples/gcp/object_classification.py) lines:1-14 @@ -605,7 +605,7 @@ Now that we have the project, we can extract the generic ontology object as well -[agent.py](../../code_examples/gcp/object_classification.py) lines:14-18 +[agent.py](../../code_examples/gcp/object_classification.py) lines:15-19 @@ -621,7 +621,7 @@ is only allowed to choose between the object types that are not of the generic o -[agent.py](../../code_examples/gcp/object_classification.py) lines:20-29 +[agent.py](../../code_examples/gcp/object_classification.py) lines:22-30 @@ -905,7 +905,7 @@ With the system prompt ready, we can instantiate an api client for Claude. -[agent.py](../../code_examples/gcp/object_classification.py) lines:31-33 +[agent.py](../../code_examples/gcp/object_classification.py) lines:33-34 @@ -913,7 +913,7 @@ Now, let's define the editor agent. -[agent.py](../../code_examples/gcp/object_classification.py) lines:36-45 +[agent.py](../../code_examples/gcp/object_classification.py) lines:38-46 @@ -927,7 +927,7 @@ Notice how the `crop` variable has a convenient `b64_encoding` method to produce -[agent.py](../../code_examples/gcp/object_classification.py) lines:46-59 +[agent.py](../../code_examples/gcp/object_classification.py) lines:47-60 @@ -938,7 +938,7 @@ If successful, the old generic object can be removed and the newly classified ob -[agent.py](../../code_examples/gcp/object_classification.py) lines:61-81 +[agent.py](../../code_examples/gcp/object_classification.py) lines:63-80 @@ -946,7 +946,7 @@ Finally, we'll save the labels with Encord. -[agent.py](../../code_examples/gcp/object_classification.py) lines:83-85 +[agent.py](../../code_examples/gcp/object_classification.py) lines:83-84 @@ -1047,7 +1047,7 @@ Let us go through the code section by section. First, we import dependencies and setup the FastAPI app with CORS middleware: -[main.py](../../code_examples/fastapi/frame_classification.py) lines:1-22 +[main.py](../../code_examples/fastapi/frame_classification.py) lines:1-25 The CORS middleware is crucial as it allows the Encord platform to make requests to your API. @@ -1055,19 +1055,19 @@ The CORS middleware is crucial as it allows the Encord platform to make requests Next, we set up the Project and create a data model based on the Ontology: -[main.py](../../code_examples/fastapi/frame_classification.py) lines:24-28 +[main.py](../../code_examples/fastapi/frame_classification.py) lines:28-30 We create the system prompt that tells Claude how to structure its response: -[main.py](../../code_examples/fastapi/frame_classification.py) lines:30-41 +[main.py](../../code_examples/fastapi/frame_classification.py) lines:33-45 Finally, we define the endpoint to handle the classification: -[main.py](../../code_examples/fastapi/frame_classification.py) lines:44-71 +[main.py](../../code_examples/fastapi/frame_classification.py) lines:48-78 The endpoint: @@ -1079,7 +1079,7 @@ The endpoint: 5. Parses Claude's response into classification instances 6. Adds the classifications to the label row and saves it -### Testing the Agent** +### Testing the Agent **STEP 1: Run the FastAPI Server** With the agent laid down, we can run it and test it. @@ -1155,25 +1155,25 @@ Let's walk through the key components. First, we setup the FastAPI app and CORS middleware: -[main.py](../../code_examples/fastapi/object_classification.py) lines:1-22 +[main.py](../../code_examples/fastapi/object_classification.py) lines:1-23 Then we setup the client, Project, and extract the generic Ontology object: -[main.py](../../code_examples/fastapi/object_classification.py) lines:24-30 +[main.py](../../code_examples/fastapi/object_classification.py) lines:26-32 We create the data model and system prompt for Claude: -[main.py](../../code_examples/fastapi/object_classification.py) lines:32-43 +[main.py](../../code_examples/fastapi/object_classification.py) lines:34-47 Finally, we define our object classification endpoint: -[main.py](../../code_examples/fastapi/object_classification.py) lines:46-84 +[main.py](../../code_examples/fastapi/object_classification.py) lines:50-97 The endpoint: diff --git a/docs/task_agents/examples/index.md b/docs/task_agents/examples/index.md index e39660f..403456a 100644 --- a/docs/task_agents/examples/index.md +++ b/docs/task_agents/examples/index.md @@ -148,7 +148,7 @@ Suppose you have a _fake_ model like this one, which predicts labels, bounding b -[Fake model predictions](../../code_examples/tasks/prelabel_videos.py) lines:28-51 +[Fake model predictions](../../code_examples/tasks/prelabel_videos.py) lines:29-52 @@ -176,7 +176,7 @@ Create a pre-labeling agent using the following code as a template: -[prelabel_video.py](../../code_examples/tasks/prelabel_videos.py) lines:10-78 +[prelabel_video.py](../../code_examples/tasks/prelabel_videos.py) lines:10-77