Skip to content

Commit

Permalink
legacy_weave_subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtruong committed Aug 24, 2024
1 parent e31ede0 commit 21dd0bd
Show file tree
Hide file tree
Showing 552 changed files with 15,001 additions and 14,943 deletions.
2 changes: 1 addition & 1 deletion examples/prompts/llm_monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ There are two main ways to authenticate OpenAI API calls so you can view them in
### OpenAI API

1. Set your OPENAI_API_KEY in your environment/script/notebook (e.g. via `os.environ["OPENAI_API_KEY"]`).
2. Import openai as follows: `from weave.legacy.monitoring import openai`.
2. Import openai as follows: `from weave.legacy.weave.monitoring import openai`.
3. Make calls via the OpenAI SDK as usual.

See details and create an interactive board in the [OpenAI monitoring notebook](./openai_client_quickstart.ipynb).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"metadata": {},
"outputs": [],
"source": [
"from weave.legacy.monitoring import openai, init_monitor\n",
"from weave.legacy.weave.monitoring import openai, init_monitor\n",
"m = init_monitor(f\"{WB_ENTITY}/{WB_PROJECT}/{STREAM_NAME}\")\n",
"\n",
"# specifying a single model for simplicity\n",
Expand Down Expand Up @@ -245,7 +245,7 @@
"metadata": {},
"outputs": [],
"source": [
"from weave.legacy.monitoring.openai import message_from_stream\n",
"from weave.legacy.weave.monitoring.openai import message_from_stream\n",
"r = openai.ChatCompletion.create(model=OPENAI_MODEL, messages=[\n",
" {\"role\": \"system\", \"content\": \"You are a robot and only speak in robot, like beep bloop bop.\"},\n",
" {\"role\": \"user\", \"content\": \"Tell me a 50-word story.\"},\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@
"outputs": [],
"source": [
"import openai\n",
"from weave.legacy.monitoring import openai as openaimon\n",
"from weave.legacy.monitoring import init_monitor\n",
"from weave.legacy.weave.monitoring import openai as openaimon\n",
"from weave.legacy.weave.monitoring import init_monitor\n",
"\n",
"m = init_monitor(f\"{WB_ENTITY}/{WB_PROJECT}/{STREAM_NAME}\")\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"outputs": [],
"source": [
"import weave\n",
"from weave.legacy.monitoring import StreamTable\n",
"from weave.legacy.weave.monitoring import StreamTable\n",
"from weave.stream_data_interfaces import TraceSpanDict"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"source": [
"import weave\n",
"import time\n",
"from weave.legacy.monitoring import init_monitor"
"from weave.legacy.weave.monitoring import init_monitor"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"source": [
"import langchain\n",
"import weave\n",
"from weave.legacy.monitoring.langchain import WeaveTracer"
"from weave.legacy.weave.monitoring.langchain import WeaveTracer"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions integration_test/cypress/e2e/interactive/blank.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import weave
from weave.legacy.show import show_url
from weave.legacy.weave.show import show_url

weave.use_fixed_server_port()
obj = [
1,
2,
3,
] # weave.legacy.panels.Board({}, [weave.legacy.panels.BoardPanel(weave.legacy.panels.Table([1, 2, 3]))])
] # weave.legacy.weave.panels.Board({}, [weave.legacy.weave.panels.BoardPanel(weave.legacy.weave.panels.Table([1, 2, 3]))])
blank = weave.save(obj)

print(show_url(obj))
9 changes: 5 additions & 4 deletions integration_test/cypress/e2e/interactive/distribution.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import random

import weave
from weave.legacy import panels
from weave.legacy.show import show_url
from weave.legacy.weave import panels
from weave.legacy.weave.show import show_url

# Weave package now defaults to eager mode, but lazy mode required for this example notebook for now.
weave.use_lazy_execution()
from weave.legacy.ecosystem import wandb
from weave.legacy.weave.ecosystem import wandb

weave.use_fixed_server_port()

Expand Down Expand Up @@ -38,7 +38,8 @@
{},
[
panels.BoardPanel(
panel, layout=weave.legacy.panels.BoardPanelLayout(x=0, y=0, w=24, h=12)
panel,
layout=weave.legacy.weave.panels.BoardPanelLayout(x=0, y=0, w=24, h=12),
)
],
)
Expand Down
10 changes: 5 additions & 5 deletions integration_test/cypress/e2e/interactive/scatter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import random

import weave
from weave.legacy.ecosystem import wandb
from weave.legacy.show import show_url
from weave.legacy.weave.ecosystem import wandb
from weave.legacy.weave.show import show_url

weave.use_fixed_server_port()

Expand All @@ -19,14 +19,14 @@
]
)

panel: weave.legacy.panels.Group = weave.legacy.panels.Group(
panel: weave.legacy.weave.panels.Group = weave.legacy.weave.panels.Group(
items={
"scatter": wandb.Scatter( # type: ignore
data, x_fn=lambda item: item["a"], y_fn=lambda item: item["b"]
),
"table": lambda scatter: weave.legacy.panels.LabeledItem(
"table": lambda scatter: weave.legacy.weave.panels.LabeledItem(
label="Selected items",
item=weave.legacy.panels.Group(
item=weave.legacy.weave.panels.Group(
style="height: 400px;",
preferHorizontal=True,
items={"table": scatter.selected()},
Expand Down
Loading

0 comments on commit 21dd0bd

Please sign in to comment.