Skip to content

Commit

Permalink
Merge pull request #26 from philschmid/agent-example
Browse files Browse the repository at this point in the history
Add Agent example & Fix stop sequences
  • Loading branch information
philschmid authored Aug 8, 2023
2 parents c2a77e5 + fbc1648 commit 9147046
Show file tree
Hide file tree
Showing 4 changed files with 364 additions and 11 deletions.
19 changes: 10 additions & 9 deletions docs/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ Here are some examples to help you get started with the easyllm library:

## Hugging Face

| Example | Description |
| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [Detailed ChatCompletion Example](chat-completion-api) | Shows how to use the ChatCompletion API to have a conversational chat with the model. |
| [Example how to stream chat requests](stream-chat-completions) | Demonstrates streaming multiple chat requests to efficiently chat with the model. |
| [Example how to stream text requests](stream-text-completions) | Shows how to stream multiple text completion requests. |
| [Detailed Completion Example](text-completion-api) | Uses the TextCompletion API to generate text with the model. |
| [Create Embeddings](get-embeddings) | Embeds text into vector representations using the model. |
| [Hugging Face Inference Endpoints Example](inference-endpoints-example) | Example on how to use custom endpoints, e.g. Inference Endpoints or localhost. |
| [Retrieval Augmented Generation using Llama 2](llama2-rag-example) | Example on how to use Llama 2 70B for in-context retrival augmentation |
| Example | Description |
| ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [Detailed ChatCompletion Example](chat-completion-api) | Shows how to use the ChatCompletion API to have a conversational chat with the model. |
| [Example how to stream chat requests](stream-chat-completions) | Demonstrates streaming multiple chat requests to efficiently chat with the model. |
| [Example how to stream text requests](stream-text-completions) | Shows how to stream multiple text completion requests. |
| [Detailed Completion Example](text-completion-api) | Uses the TextCompletion API to generate text with the model. |
| [Create Embeddings](get-embeddings) | Embeds text into vector representations using the model. |
| [Hugging Face Inference Endpoints Example](inference-endpoints-example) | Example on how to use custom endpoints, e.g. Inference Endpoints or localhost. |
| [Retrieval Augmented Generation using Llama 2](llama2-rag-example) | Example on how to use Llama 2 70B for in-context retrival augmentation |
| [Llama 2 70B Agent/Tool use example ](llama2-agent-example) | Example on how to use Llama 2 70B to interace with tools and could be used as an agent |

The examples cover the main functionality of the library - chat, text completion, and embeddings. Let me know if you would like me to modify or expand the index page in any way.
4 changes: 2 additions & 2 deletions easyllm/clients/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def create(
# create stop sequences
if isinstance(request.stop, list):
stop = stop_sequences + request.stop
if isinstance(request.stop, str):
elif isinstance(request.stop, str):
stop = stop_sequences + [request.stop]
else:
stop = stop_sequences
Expand Down Expand Up @@ -348,7 +348,7 @@ def create(
# create stop sequences
if isinstance(request.stop, list):
stop = stop_sequences + request.stop
if isinstance(request.stop, str):
elif isinstance(request.stop, str):
stop = stop_sequences + [request.stop]
else:
stop = stop_sequences
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,4 @@ nav:
- examples/get-embeddings.ipynb
- examples/inference-endpoints-example.ipynb
- examples/llama2-rag-example.ipynb
- examples/llama2-agent-example.ipynb
Loading

0 comments on commit 9147046

Please sign in to comment.