This repository has been archived by the owner on Feb 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from defenseunicorns/completions-endpoint
feat: renamed generate endpoint to completion
- Loading branch information
Showing
42 changed files
with
1,418 additions
and
1,008 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,7 @@ __pycache__ | |
.vscode/ | ||
venv | ||
.DS_Store | ||
dist/ | ||
dist/ | ||
|
||
# Go binaries | ||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import openai | ||
|
||
openai.api_base = "http://localhost:8080/openai" | ||
openai.api_key = "removed" | ||
|
||
prompt = """<|im_start|>system | ||
You are an AI assistant that answers participates in chat discussions in an honest, concise, friendly way.<|im_end|> | ||
<|im_start|>user | ||
Write two sequences composed of 3 'A's and 2 'B's such that there are no two successive identical letter. Be consice.<|im_end|> | ||
<|im_assistant|> | ||
""" | ||
|
||
# prompt = """ | ||
# <|im_start|>system | ||
# You are an AI assistant that follows instruction extremely well. Your role is to accept some input and summarize it. For example: | ||
|
||
# User: Summarize the main idea in the following text: | ||
# The rapid growth of technology has led to significant advancements in various industries. From communication and transportation to healthcare and education, technology has played a crucial role in improving our lives. However, we must also be cautious of the potential negative effects, such as job loss due to automation and privacy concerns. | ||
|
||
# Assistant: Technology's rapid growth has positively impacted various industries but also raises concerns about job loss and privacy. | ||
# <|im_end|> | ||
# <|im_start|>user | ||
# Summarize the main idea in the following text: | ||
# Few-shot prompting is a technique used to guide large language models (LLMs), like GPT-3, towards generating desired outputs by providing them with a few examples of input-output pairs. While few-shot prompting has shown promising results, there are limitations to this approach. This method allows for in-context learning by conditioning the model using examples, guiding it to produce better responses.<|im_end|><|im_assistant|> | ||
# """ | ||
|
||
response = openai.Completion.create( | ||
# model="text-davinci-003", | ||
model="ctransformers", | ||
prompt=prompt, | ||
max_tokens=700, | ||
temperature=0.3, | ||
stream=True, # this time, we set stream=True, | ||
) | ||
|
||
for event in response: | ||
print(event.choices[0].text, end="", flush=True) | ||
print("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.