{"id":13767318,"url":"https://github.com/humanagent/Talk-To-Lens","last_synced_at":"2025-05-10T22:31:43.525Z","repository":{"id":159883551,"uuid":"634716459","full_name":"humanagent/Talk-To-Lens","owner":"humanagent","description":"Plugin for querying lens database with natural language","archived":false,"fork":false,"pushed_at":"2023-05-02T16:58:52.000Z","size":166,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-01T10:02:23.192Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/humanagent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-05-01T01:59:30.000Z","updated_at":"2023-08-08T09:04:54.000Z","dependencies_parsed_at":"2024-01-11T23:43:15.036Z","dependency_job_id":"48117ead-4cde-4cae-b70d-c3b607b398a4","html_url":"https://github.com/humanagent/Talk-To-Lens","commit_stats":null,"previous_names":["humanagent/talk-to-lens"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanagent%2FTalk-To-Lens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanagent%2FTalk-To-Lens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanagent%2FTalk-To-Lens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanagent%2FTalk-To-Lens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/humanagent","download_url":"https://codeload.github.com/humanagent/Talk-To-Lens/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253492529,"owners_count":21916959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T16:01:07.362Z","updated_at":"2025-05-10T22:31:41.230Z","avatar_url":"https://github.com/humanagent.png","language":"TypeScript","funding_links":[],"categories":["Development"],"sub_categories":["Libraries \u0026 Tools"],"readme":"## Talk To Lens\n\nThis plugins interprets requests to the lens database and transforms text to sql queries for later retrieval in GPT.\n\n### Prerequisites\n\nThis app has no user interface, instead it's meant to use with GhatGPT's UI so therefore you must have access to ChatGPT plugins, which at the moment are still in beta.\n\n### Project setup\n\n1. Clone the repo, install depdendencies:\n\n```sh\ngit clone git@github.com:fabriguespe/Talk-To-Lens.git\n\ncd Talk-To-Lens\n\nyarn # or npm install, pnpm\n```\n\n2. Run the server\n\n```sh\nnpm run build\n# if you modify the yaml file you have to re build\nnpm start\n```\n\n3. Set up your GPT Plugin in the ChatGPT Plugin UI.\n\nWhen prompted for your website domain, type in 'http://localhost:3000'\n\n4. Export the keyfile from bigquery and save it as keyfile.json in the root of the project.\n\n5. Create a openaikey.json \n```\n{\n  \"key\": \"OPENAI KEY\"\n}\n```\n\n### Usage\n\nTested prompts you can try and mix.\n\n```sh\nget me the top post of today\nWho is the most popular user on Lenster based on engaged posts\nGet me 1 cool post from each of the top 3 apps\nGet me details on the user 1234.lens\nFrom which lens application stani.lens posts the most\nList the top 10 lens applications ranked by popularity\nWho commented on the post with id 0x01-0x01c5.\nWho is the user with more comments made to lensprotocol.lens.\nWhat are the hours of more engagement in lens. Ranked by popularity.\nFind 5 posts where Messi is mentioned. Rank them by popularity\n```\n\n### Prompt\n\n\u003e The plugin uses the following engineered prompt. This tables are enough for querying content, profiles, followers, comments, hashtags, dates, apps and reactions. Collect data is excluded in this MVP.\n\n[PROMPT](/PROMPT.md)\n\n### Playground\n\nFor a more advance and fast way to test the prompts you can copy paste the [PROMPT](/PROMPT.md) description into the openai playground.\n\n[Playground](https://platform.openai.com/playground?mode=chat)\n\n### Pre prompting\n\nPre prompting the plugin interaction can be a good way of defining goals and expectations.\n\n```\nI'm about to begin using the Talk to Lens plugin. Please keep the following points in mind for the result of the plugin:\n\n- Display the interpreted question\n- Always return data in table format, if possible.\n- If the data can be represented as a line chart, bar chart, or pie chart, please provide the Python code for creating the corresponding plot. If not, dont mention it.\n- Always display and explain the query used\n```\n\n### Queries used while building the schema prompt\n\n```\nSELECT table_name\nFROM `lens-public-data.polygon.INFORMATION_SCHEMA.TABLES`\n```\n\n```\nSELECT\n  t.table_name AS table_name,\nFROM\n  `lens-public-data.mumbai.INFORMATION_SCHEMA.TABLES` AS t\nJOIN\n  `lens-public-data.mumbai.INFORMATION_SCHEMA.COLUMNS` AS c\nON\n  t.table_name = c.table_name\nORDER BY\n  t.table_name,\n  c.ordinal_position;\n\n```\n\n### Constrains\nBecause some queries can be longer than the token limit, the plugin will return a message saying that the query is too long and will provide the query as a reference and return less results.\n\n### Refining\nAs a proof of concept this was not tested rigorously, but it's a good starting point for a more robust plugin. Next steps would be to experiment with embeddings and trainning the model with example queries. Same query may run unsuccesfully some times but successfully when run again or i would get many network errores on large responses. Im still trying to figure out a more robust plugin response that can handle all cases.\n\n### Resources\nBased on the following resources:\n\n[OpanAI Plugin Docs](https://platform.openai.com/docs/plugins/introduction)\n\n[nextjs-chatgpt-plugin-starter](https://github.com/dabit3/nextjs-chatgpt-plugin-starter) by [dabit3](https://github.com/dabit3)\n\n[lens-bigquery-with-node.js](https://github.com/dabit3/lens-bigquery-with-node.js) by [dabit3](https://github.com/dabit3)\n\n[Lens BigQuery Docs](https://docs.lens.xyz/docs/public-big-query)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanagent%2FTalk-To-Lens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhumanagent%2FTalk-To-Lens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanagent%2FTalk-To-Lens/lists"}