Skip to content

Commit

Permalink
Rename files
Browse files Browse the repository at this point in the history
  • Loading branch information
lexiforest committed Apr 30, 2024
1 parent 5a17cf9 commit 636552b
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 7 deletions.
File renamed without changes.
36 changes: 29 additions & 7 deletions ragbear/_entry.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from contextlib import suppress
from typing import List, Literal, Optional, TypedDict, Union
from .query.prompts import format_query
from .model import get_openai_client
from .database.remote.duckduckgo import get_duckduckgo_results

from .index.remote.duckduckgo import get_duckduckgo_results
from .model import get_openai_client
from .synthesis.prompts import format_query

with suppress(ImportError):
pass
Expand All @@ -20,6 +20,29 @@ class SourceVendorType(TypedDict):
RewriteType = Literal["query2doc"]


class Bear:

def __init__(
self,
model: str = "llama2",
base_url: str = "http://localhost:11434/v1/",
api_key: Optional[str] = "ollama",
source: Optional[SourceType] = None,
rerank: Optional[RerankType] = None,
rewrite: Optional[RewriteType] = None,
template: Optional[str] = None,
embedding_model: Optional[str] = None,
): ...

def answer(self): ...

def __enter__(self): ...

def __exit__(self): ...

def __del__(self): ...


def query(
prompt: str,
*,
Expand All @@ -30,7 +53,7 @@ def query(
rerank: Optional[RerankType] = None,
rewrite: Optional[RewriteType] = None,
template: Optional[str] = None,
embedding_model: Optional[str] = None
embedding_model: Optional[str] = None,
):
"""Query the LLM, and return the summarized result.
Expand All @@ -51,12 +74,11 @@ def query(
chat_completion = client.chat.completions.create(
messages=[
{
'role': 'user',
'content': query,
"role": "user",
"content": query,
}
],
model=model,
)
# print(chat_completion)

return chat_completion.choices[0].message.content
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
Empty file added ragbear/postprocess/__init__.py
Empty file.
File renamed without changes.

0 comments on commit 636552b

Please sign in to comment.