Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

vectorspace function#978

deathbeam started this conversation inFunctions
Discussion options

require('CopilotChat.config').functions.vectorspace= {description='Semantic search through workspace using vector embeddings. Find relevant code with natural language queries.',schema= {type='object',properties= {query= {type='string',description='The search query to find relevant code snippets.',            },max= {type='integer',description='Maximum number of results to return.',default=10,            },        },required= {'query'},    },resolve=function(input,source)localutils=require('CopilotChat.utils')localembeddings=utils.curl_post('http://localhost:8000/query', {json_request=true,json_response=true,body= {dir=source.cwd(),text=input.query,max=tonumber(input.maxor10),            }        }).bodyutils.schedule_main()returnvim.iter(embeddings)            :map(function(embedding)embedding.filetype=utils.filetype(embedding.filename)returnembeddingend)            :filter(function(embedding)returnembedding.filetypeend)            :map(function(embedding)return {uri='file://'..embedding.filename,name=embedding.filename,mimetype=utils.filetype_to_mimetype(utils.filetype(embedding.filename)),data=embedding.text,                }end)            :totable()end,}

This is example on how to run my toy self hosted vector database indexing solution:

https://github.com/deathbeam/vectorspace

You need to have it installed and running, so

pipx run python-vectorspace==0.0.6

It will then listed onlocalhost:8000

It will automatically start indexing and watching chat source buffer working dir when you use the context for first time, so first time there might not be any results.

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
functionconfig.functions extension
1 participant
@deathbeam

[8]ページ先頭

©2009-2025 Movatter.jp