-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicole White
committed
Oct 23, 2023
1 parent
eea57a2
commit 28535ce
Showing
5 changed files
with
911 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!-- banner start --> | ||
<p align="center"> | ||
<img src="https://app.autoblocks.ai/images/logo.png" width="300px"> | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="https://docs.autoblocks.ai/">Documentation</a> | ||
| | ||
<a href="https://app.autoblocks.ai/">Application</a> | ||
| | ||
<a href="https://www.autoblocks.ai/">Home</a> | ||
</p> | ||
|
||
<p align="center"> | ||
:bangbang: | ||
Make sure you've read the <a href="/README.md#getting-started">getting started</a> section in the main README. | ||
</p> | ||
<!-- banner end --> | ||
|
||
## Install dependencies: | ||
|
||
```bash | ||
poetry install | ||
``` | ||
|
||
## Run the script | ||
|
||
```bash | ||
poetry run python main.py | ||
``` | ||
|
||
## View logs in Autoblocks | ||
|
||
After you run the script, you can view your trace on the [explore page](https://app.autoblocks.ai/explore). |
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,36 @@ | ||
import dotenv | ||
|
||
# Environment variables need to be loaded before we import | ||
# trace_openai and openai | ||
dotenv.load_dotenv("../../.env") | ||
|
||
from autoblocks.vendor.openai import trace_openai | ||
import openai | ||
|
||
|
||
def main(): | ||
# Call at the entrypoint to your application | ||
trace_openai() | ||
print("Automatically tracing all calls to OpenAI...") | ||
|
||
print("Calling OpenAI...") | ||
openai.ChatCompletion.create( | ||
messages=[ | ||
{ | ||
"role": "system", | ||
"content": "You are a helpful assistant. You answer questions about a software product named Acme." | ||
}, | ||
{ | ||
"role": "user", | ||
"content": "How do I sign up?" | ||
} | ||
], | ||
model="gpt-3.5-turbo", | ||
temperature=0.7, | ||
) | ||
print("Finished calling OpenAI") | ||
print("View the trace at https://app.autoblocks.ai/explore") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.