deno_python icon indicating copy to clipboard operation
deno_python copied to clipboard

Trouble with coroutines

Open elimydlarz opened this issue 1 year ago • 0 comments

I'm using this Python library and it suggests that a minimal use looks something like this:

from graphiti_core import Graphiti

graphiti = Graphiti("bolt://localhost:7687", "neo4j", "password")

results = await graphiti.search('Who was the California Attorney General?')

Here's what I'm doing:

import { python } from "@denosaurs/python";

const { Graphiti } = await python.import("graphiti_core");

const graphiti = await Graphiti(
  GRAPH_DATABASE_URL,
  GRAPH_DATABASE_USER,
  GRAPH_DATABASE_PASS,
);

const search = async (query: string) => {
  const result = await graphiti.search(query);
  console.debug(result);
};

await search("Test search");

As I understand it this should be functionally equivalent, but the result of search is <coroutine object Graphiti.search at 0x11e2ac040> - it seems like using await is not properly resolving the coroutine.

elimydlarz avatar Oct 26 '24 08:10 elimydlarz