dx2102 commited on
Commit
883c5b4
1 Parent(s): 12f3633

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +3 -3
server.py CHANGED
@@ -16,7 +16,7 @@ app = fastapi.FastAPI()
16
 
17
  top_n = 50
18
 
19
- @functools.lru_cache(maxsize=2*1024*1024*1024//(80 + top_n*8))
20
  def lru_search(query):
21
  query_embed = vo.embed([query], model="voyage-large-2-instruct", input_type="query").embeddings[0]
22
  similarities = np.dot(embed, query_embed)
@@ -29,7 +29,7 @@ def lru_search(query):
29
  @app.get("/search")
30
  def search(query: str):
31
  # if query is too long, throw an error
32
- if len(query) > 80:
33
  raise fastapi.HTTPException(status_code=400, detail="Query is too long")
34
  top, sim = lru_search(query)
35
 
@@ -105,7 +105,7 @@ def read_root():
105
  `
106
  if (result.comment.trim() !== '') {
107
  const comment = resultDiv.querySelector('#comment')
108
- comment.innerHTML = marked.marked(`/-- ${result.comment.trim()} -/`)
109
  comment.classList.add('bg-gray-50', 'text-gray-900', 'px-2', 'py-1', 'mt-0.5', 'rounded-lg')
110
  }
111
  resultsDiv.appendChild(resultDiv)
 
16
 
17
  top_n = 50
18
 
19
+ @functools.lru_cache(maxsize=2*1024*1024*1024//(400 + top_n*8))
20
  def lru_search(query):
21
  query_embed = vo.embed([query], model="voyage-large-2-instruct", input_type="query").embeddings[0]
22
  similarities = np.dot(embed, query_embed)
 
29
  @app.get("/search")
30
  def search(query: str):
31
  # if query is too long, throw an error
32
+ if len(query) > 400:
33
  raise fastapi.HTTPException(status_code=400, detail="Query is too long")
34
  top, sim = lru_search(query)
35
 
 
105
  `
106
  if (result.comment.trim() !== '') {
107
  const comment = resultDiv.querySelector('#comment')
108
+ comment.innerHTML = `/-- ${marked.marked(result.comment.trim())} -/`
109
  comment.classList.add('bg-gray-50', 'text-gray-900', 'px-2', 'py-1', 'mt-0.5', 'rounded-lg')
110
  }
111
  resultsDiv.appendChild(resultDiv)