Skip to content

Commit

Permalink
Merge branch 'main' into deps/gha/taiki-e-install-action-2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
vilkinsons authored Dec 11, 2024
2 parents 85b73cf + e41519d commit 389fd75
Show file tree
Hide file tree
Showing 381 changed files with 5,451 additions and 3,608 deletions.
8 changes: 5 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,18 @@ HASH_TEMPORAL_VISIBILITY_PG_DATABASE=temporal_visibility
HASH_GRAPH_PG_USER=graph
HASH_GRAPH_PG_PASSWORD=graph
HASH_GRAPH_PG_DATABASE=graph
HASH_GRAPH_LOG_LEVEL=trace,h2=info,tokio_util=debug,tower=info,tonic=debug,hyper=info,tokio_postgres=info,rustls=info,tarpc=warn
HASH_GRAPH_LOG_LEVEL=info

HASH_GRAPH_TYPE_FETCHER_HOST=localhost
HASH_GRAPH_TYPE_FETCHER_PORT=4455

HASH_GRAPH_REALTIME_PG_USER=realtime
HASH_GRAPH_REALTIME_PG_PASSWORD=realtime

HASH_GRAPH_API_HOST=127.0.0.1
HASH_GRAPH_API_PORT=4000
HASH_GRAPH_HTTP_HOST=127.0.0.1
HASH_GRAPH_HTTP_PORT=4000
HASH_GRAPH_RPC_HOST=127.0.0.1
HASH_GRAPH_RPC_PORT=4002
HASH_GRAPH_TEST_API_HOST=127.0.0.1
HASH_GRAPH_TEST_API_PORT=4001

Expand Down
3 changes: 3 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ HASH_TEMPORAL_PG_DATABASE=dev_temporal
HASH_TEMPORAL_VISIBILITY_PG_DATABASE=dev_temporal_visibility
HASH_GRAPH_PG_DATABASE=dev_graph

HASH_GRAPH_RPC_ENABLED=true
HASH_RPC_ENABLED=true

# For locally-running minio instance
AWS_REGION=local
AWS_S3_UPLOADS_ENDPOINT=http://localhost:9000
Expand Down
7 changes: 0 additions & 7 deletions apps/hash-ai-worker-ts/.eslintrc.cjs

This file was deleted.

6 changes: 4 additions & 2 deletions apps/hash-ai-worker-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ The service uses the following environment variables:
- `HASH_TEMPORAL_SERVER_PORT`: The port that the Temporal server is running on (defaults to `7233`).
- `OPENAI_API_KEY`: The OpenAI API key that is made available to workflows and activities.
- `ANTHROPIC_API_KEY`: The Anthropic API key that is made available to workflows and activities.
- `HASH_GRAPH_API_HOST`: The host address that the HASH Graph API is running on, e.g. `graph`, `127.0.0.1`
- `HASH_GRAPH_API_PORT`: The port that the HASH Graph API is running on, e.g. `4000`
- `HASH_GRAPH_HTTP_HOST`: The host address that the HASH Graph service is running on, e.g. `graph`, `127.0.0.1`
- `HASH_GRAPH_HTTP_PORT`: The port that the HASH Graph HTTP service is running on, e.g. `4000`
- `HASH_GRAPH_RPC_HOST`: The host address that the HASH Graph RPC service is running on, e.g. `graph`, `127.0.0.1`
- `HASH_GRAPH_RPC_PORT`: The port that the HASH Graph RPC service is running on, e.g. `4002`
- `INTERNAL_API_HOST`: The host for the internal API, required if the internal API is not running locally for workflows making use of the `getWebSearchResultsActivity` activity
- `INTERNAL_API_KEY`: The API key used to authenticate with the internal API, required for workflows making use of the `getWebSearchResultsActivity` activity
- `HASH_VAULT_HOST`: The host address (including protocol) that the Vault server is running on, e.g. `http://127.0.0.1`
Expand Down
3 changes: 3 additions & 0 deletions apps/hash-ai-worker-ts/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createBase } from "@local/eslint/deprecated";

export default createBase(import.meta.dirname);
4 changes: 2 additions & 2 deletions apps/hash-ai-worker-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"typescript": "5.6.3"
},
"devDependencies": {
"@local/eslint-config": "0.0.0-private",
"@local/eslint": "0.0.0-private",
"@local/tsconfig": "0.0.0-private",
"@sentry/cli": "^2.39.1",
"@types/dedent": "0.7.2",
Expand All @@ -110,7 +110,7 @@
"@types/papaparse": "5.3.15",
"@types/sanitize-html": "2.13.0",
"@vitest/coverage-istanbul": "2.1.8",
"eslint": "8.57.0",
"eslint": "9.16.0",
"rimraf": "6.0.1",
"typescript": "5.6.3",
"vite-tsconfig-paths": "5.1.4",
Expand Down
5 changes: 2 additions & 3 deletions apps/hash-ai-worker-ts/scripts/bundle-workflow-code.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { writeFile } from "node:fs/promises";
import { createRequire } from "node:module";
import * as path from "node:path";
import { dirname } from "node:path";
import path from "node:path";
import { fileURLToPath } from "node:url";

import { bundleWorkflowCode } from "@temporalio/worker";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __dirname = path.dirname(__filename);

const require = createRequire(import.meta.url);

Expand Down
4 changes: 2 additions & 2 deletions apps/hash-ai-worker-ts/scripts/compare-llm-response.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mkdirSync, writeFileSync } from "node:fs";
import { dirname } from "node:path";
import path from "node:path";
import { fileURLToPath } from "node:url";

import { type OwnedById } from "@local/hash-graph-types/web";
Expand All @@ -14,7 +14,7 @@ import { getAliceUserAccountId } from "../src/shared/testing-utilities/get-alice
import type { CompareLlmResponseConfig } from "./compare-llm-response/types.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __dirname = path.dirname(__filename);

const configDirectory = `${__dirname}/compare-llm-response/var/config`;

Expand Down
4 changes: 2 additions & 2 deletions apps/hash-ai-worker-ts/scripts/sanitize-html.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mkdirSync, writeFileSync } from "node:fs";
import path, { dirname } from "node:path";
import path from "node:path";
import { fileURLToPath } from "node:url";

import { getWebPageActivity } from "../src/activities/get-web-page-activity.js";
Expand All @@ -12,7 +12,7 @@ import { getWebPageActivity } from "../src/activities/get-web-page-activity.js";
*/

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __dirname = path.dirname(__filename);

const url = process.argv[2];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,11 @@ const callModel = async (
: dedent(`
The Python code ran successfully.
The stdout from your code was: ${stdout}
The following artifacts were generated:\n${artifacts.join("\n")}
The following artifacts were generated:\n${
// @todo: https://linear.app/hash/issue/H-3769/investigate-new-eslint-errors
// eslint-disable-next-line @typescript-eslint/no-base-to-string
artifacts.join("\n")
}
Please now review the code used and whether it correctly operates on the context data.
If you spot errors in how the code attempts to access the code data, submit another code file with the corrections.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const getFileFromUrlAction: FlowActionActivity = async ({ inputs }) => {
}

// @todo look for an existing file with the same originalUrl in the graph, and update it if found?
const operation = "create" as const;
const operation = "create";

const fileEntity = createFileEntityFromUrlStatus.entity.toJSON();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createWriteStream } from "node:fs";
import { mkdir, unlink } from "node:fs/promises";
import { dirname, join } from "node:path";
import path from "node:path";
import { Readable } from "node:stream";
import { finished } from "node:stream/promises";
import type { ReadableStream } from "node:stream/web";
Expand Down Expand Up @@ -47,9 +47,9 @@ import { getLlmAnalysisOfDoc } from "./infer-metadata-from-document-action/get-l
import type { FlowActionActivity } from "./types.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __dirname = path.dirname(__filename);

const baseFilePath = join(__dirname, "/var/tmp_files");
const baseFilePath = path.join(__dirname, "/var/tmp_files");

export const inferMetadataFromDocumentAction: FlowActionActivity = async ({
inputs,
Expand Down Expand Up @@ -200,6 +200,8 @@ export const inferMetadataFromDocumentAction: FlowActionActivity = async ({
resolve(pdfData);
});

// @todo: https://linear.app/hash/issue/H-3769/investigate-new-eslint-errors
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
pdfParser.loadPDF(filePath).catch((err) => reject(err));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
readFileSync,
writeFileSync,
} from "node:fs";
import { dirname, join } from "node:path";
import path from "node:path";
import { fileURLToPath } from "node:url";

import { expect, test } from "vitest";
Expand All @@ -16,9 +16,9 @@ import { researchEntitiesAction } from "./research-entities-action.js";
import type { CoordinatingAgentState } from "./research-entities-action/shared/coordinators.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __dirname = path.dirname(__filename);

const baseDirectoryPath = join(__dirname, "/var/persisted-state");
const baseDirectoryPath = path.join(__dirname, "/var/persisted-state");

export const retrievePreviousState = (params: {
testName: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "../../../../shared/testing-utilities/mock-get-flow-context.js";

import { dirname, join } from "node:path";
import path from "node:path";
import { fileURLToPath } from "node:url";

import dedent from "dedent";
Expand Down Expand Up @@ -32,7 +32,7 @@ const ftse350Metric: MetricDefinition = {
The user prompt provided to the LLM is: "${ftse350MetricPrompt}".
The text provided to the LLM is the HTML of a web-page containing a table of
FTSE350 constituents, paginated across multiple pages.
The LLM must extract all the paginated links from the FTSE350 constituents page, because
the links must be followed to extract the full list of FTSE350 constituents.
Expand Down Expand Up @@ -118,7 +118,7 @@ const marksAndSpencersAnnualInvestorsReport: MetricDefinition = {
The text provided to the LLM is the HTML of the Marks and Spencers investors page, which
includes links to a variety of documents, including the annual investor report published
by the company every year.
To satisfy the prompt, the LLM must extract the link to the latest annual investor report PDF
published by Marks and Spencers, which is https://corporate.marksandspencer.com/sites/marksandspencer/files/2024-06/M-and-S-2024-Annual-Report.pdf.
Expand Down Expand Up @@ -201,7 +201,7 @@ const graphicsCardSpecificationMetric: MetricDefinition = {
To satisfy the prompt, the LLM must extract the link to the specification page of
the NVIDIA GeForce RTX 4090 graphics card, which is https://www.techpowerup.com/gpu-specs/geforce-rtx-4090.c3889.
The score in this metric is calculated as 1 if the correct link is extracted, and 0 otherwise.
`),
executeMetric: async (params) => {
Expand Down Expand Up @@ -267,9 +267,9 @@ const metrics: MetricDefinition[] = [
];

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __dirname = path.dirname(__filename);

const baseDirectoryPath = join(
const baseDirectoryPath = path.join(
__dirname,
"/var/extract-links-from-text-testing",
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ const getLinkFollowerNextToolCallsSystemPrompt = dedent(`
- complete: complete the research task if the gathered claims fulfill the task
- exploreLinks: call this tool to explore additional links to gather more claims that may fulfill the task
- terminate: terminate the research task if it cannot be progressed further
If you already have enough claims to meet the research brief, call 'complete'.
If you already have enough claims to meet the research brief, call 'complete'.
Don't follow more links unless it is required to meet the goal of the research task.
</TaskDescription>
Balance any need to gather more claims with the need to complete the task in a timely manner.
Consider the research task and the claims already gathered when making your decision.
`);
Expand Down Expand Up @@ -116,9 +116,7 @@ Now decide what to do next. If you have gathered enough information about entiti
};
};

const toolNames = ["exploreLinks", "complete", "terminate"] as const;

type ToolName = (typeof toolNames)[number];
type ToolName = "exploreLinks" | "complete" | "terminate";

const suggestionForNextStepsDefinition = {
type: "string",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { access, mkdir } from "node:fs/promises";
import { dirname, join } from "node:path";
import path from "node:path";
import { fileURLToPath } from "node:url";

import type { Subtype } from "@local/advanced-types/subtype";
Expand All @@ -20,9 +20,9 @@ export type SimpleStorageContext = Subtype<
>;

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __dirname = path.dirname(__filename);

const baseFilePath = join(__dirname, "/var/tmp_files");
const baseFilePath = path.join(__dirname, "/var/tmp_files");

export const generateSimpleStorageContextFilePaths = (params: {
hash: string;
Expand Down
Loading

0 comments on commit 389fd75

Please sign in to comment.