Skip to content

Commit

Permalink
Demo tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
uogbuji committed Mar 21, 2024
1 parent ea587e1 commit 836e6e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions demo/chat_web_selects.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ async def async_main(oapi, sites, verbose, limit, chunk_size, chunk_overlap, que
done, _ = await asyncio.wait(
tasks, return_when=asyncio.FIRST_COMPLETED)

# proper cleanup of indicator task, which will still be pending/running
indicator_task.cancel()

# Instance of openai.openai_object.OpenAIObject, with lots of useful info
retval = next(iter(done)).result()
if verbose:
Expand Down
4 changes: 4 additions & 0 deletions pylib/llm_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ class llama_cpp_http(llm_wrapper):
>>> llm_api = llama_cpp_http(base_url='http://localhost:8000')
>>> resp = asyncio.run(llm_api('Knock knock!', min_p=0.05))
>>> resp['content']
'''
def __init__(self, base_url, apikey=None, model=None, **kwargs):
'''
Expand All @@ -369,6 +370,9 @@ async def __call__(self, prompt, req='/completion', timeout=30.0, apikey=None, *
'''
Invoke the LLM with a completion request
Other endpoints are available vit `req`, e.g. /v1/models, /v1/chat/completions, etc.
With `/completion--header`, for a stream of preficted tokens with other token probability
Args:
prompt (str): Prompt to send to the LLM
Expand Down

0 comments on commit 836e6e4

Please sign in to comment.