Skip to content

Commit

Permalink
Merge branch 'master' into molliean/toggle-button-group-common-component
Browse files Browse the repository at this point in the history
  • Loading branch information
molliean authored Nov 20, 2024
2 parents 1027fdd + 7aa0140 commit 375aa98
Show file tree
Hide file tree
Showing 120 changed files with 5,438 additions and 730 deletions.
8 changes: 8 additions & 0 deletions docs/docs/guides/tracking/ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,11 @@ A Weave op is a versioned function that automatically logs all calls.
```
</TabItem>
</Tabs>

### Control call link output

If you want to suppress the printing of call links during logging, you can use the `WEAVE_PRINT_CALL_LINK` environment variable to `false`. This can be useful if you want to reduce output verbosity and reduce clutter in your logs.

```bash
export WEAVE_PRINT_CALL_LINK=false
```
14 changes: 7 additions & 7 deletions docs/intro_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"\n",
"client = OpenAI()\n",
"response = client.chat.completions.create(\n",
" model=\"gpt-3.5-turbo-1106\",\n",
" model=\"gpt-4o-mini\",\n",
" messages=[\n",
" {\n",
" \"role\": \"system\",\n",
Expand Down Expand Up @@ -241,7 +241,7 @@
"\n",
" stripped = strip_user_input(user_input)\n",
" response = client.chat.completions.create(\n",
" model=\"gpt-3.5-turbo-1106\",\n",
" model=\"gpt-4o-mini\",\n",
" messages=[\n",
" {\n",
" \"role\": \"system\",\n",
Expand Down Expand Up @@ -303,7 +303,7 @@
"\n",
" stripped = strip_user_input(user_input)\n",
" response = client.chat.completions.create(\n",
" model=\"gpt-3.5-turbo-1106\",\n",
" model=\"gpt-4o-mini\",\n",
" messages=[\n",
" {\n",
" \"role\": \"system\",\n",
Expand Down Expand Up @@ -427,7 +427,7 @@
"\n",
"\n",
"corrector = OpenAIGrammarCorrector(\n",
" openai_model_name=\"gpt-3.5-turbo-1106\",\n",
" openai_model_name=\"gpt-4o-mini\",\n",
" system_message=\"You are a grammar checker, correct the following user input.\",\n",
")\n",
"\n",
Expand Down Expand Up @@ -469,8 +469,8 @@
" },\n",
" {\"user_input\": \" I write good \", \"expected\": \"I write well\"},\n",
" {\n",
" \"user_input\": \" GPT-3 is smartest AI model. \",\n",
" \"expected\": \"GPT-3 is the smartest AI model.\",\n",
" \"user_input\": \" GPT-4 is smartest AI model. \",\n",
" \"expected\": \"GPT-4 is the smartest AI model.\",\n",
" },\n",
" ],\n",
")\n",
Expand Down Expand Up @@ -516,7 +516,7 @@
"weave.init(PROJECT)\n",
"\n",
"corrector = OpenAIGrammarCorrector(\n",
" openai_model_name=\"gpt-3.5-turbo-1106\",\n",
" openai_model_name=\"gpt-4o-mini\",\n",
" system_message=\"You are a grammar checker, correct the following user input.\",\n",
")\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencies = [
"numpy>1.21.0", # Used in box.py and scorer.py (should be made optional)
"rich", # Used for special formatting of tables (should be made optional)
"gql[aiohttp,requests]", # Used exclusively in wandb_api.py
"jsonschema>=4.23.0", # Used by scorers for field validation
]

[project.optional-dependencies]
Expand Down Expand Up @@ -90,7 +91,6 @@ test = [
"clickhouse_connect==0.7.0",
"fastapi>=0.110.0",
"sqlparse==0.5.0",
"jsonschema>=4.23.0",

# Integration Tests
"pytest-recording>=0.13.2",
Expand Down Expand Up @@ -222,7 +222,7 @@ module = "weave_query.*"
ignore_errors = true

[tool.bumpversion]
current_version = "0.51.20-dev0"
current_version = "0.51.22-dev0"
parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
Expand Down
9 changes: 9 additions & 0 deletions tests/integrations/google_ai_studio/google_ai_studio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def assert_correct_summary(summary: dict, trace_name: str):
assert summary["weave"]["latency_ms"] > 0


@pytest.mark.skip(
reason="This test depends on a non-deterministic external service provider"
)
@pytest.mark.flaky(reruns=5, reruns_delay=2)
@pytest.mark.skip_clickhouse_client
def test_content_generation(client):
Expand All @@ -69,6 +72,9 @@ def test_content_generation(client):
assert_correct_summary(call.summary, trace_name)


@pytest.mark.skip(
reason="This test depends on a non-deterministic external service provider"
)
@pytest.mark.flaky(reruns=5, reruns_delay=2)
@pytest.mark.skip_clickhouse_client
def test_content_generation_stream(client):
Expand All @@ -95,6 +101,9 @@ def test_content_generation_stream(client):
assert_correct_summary(call.summary, trace_name)


@pytest.mark.skip(
reason="This test depends on a non-deterministic external service provider"
)
@pytest.mark.flaky(reruns=5, reruns_delay=2)
@pytest.mark.asyncio
@pytest.mark.skip_clickhouse_client
Expand Down
8 changes: 4 additions & 4 deletions tests/trace/test_annotation_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def test_human_feedback_basic(client):
description="A numerical field with a range of -1 to 1",
json_schema={
"type": "number",
"min": -1,
"max": 1,
"minimum": -1,
"maximum": 1,
},
unique_among_creators=True,
op_scope=None,
Expand Down Expand Up @@ -49,8 +49,8 @@ def test_human_feedback_basic(client):
assert objects.objs[1].val["op_scope"] == ["weave:///entity/project/op/name:digest"]
assert objects.objs[0].val["json_schema"] == {
"type": "number",
"min": -1,
"max": 1,
"minimum": -1,
"maximum": 1,
}
assert objects.objs[1].val["json_schema"] == {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions wb_schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ type User implements Node {
photoUrl: String
deletedAt: DateTime
teams(before: String, after: String, first: Int, last: Int): EntityConnection
admin: Boolean
}

type UserConnection {
Expand Down
24 changes: 12 additions & 12 deletions weave-js/src/common/css/color.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
* Keep these colors in sync with what is in tailwind.config.js
*/
export const WHITE = '#FFFFFF';
export const MOONBEAM = '#EDE8FF';
export const OBLIVION = '#15181F';
export const MOONBEAM = '#F1EFF8';
export const OBLIVION = '#0D0F12';

export const MOON_50 = '#FAFAFA';
export const MOON_100 = '#F5F6F7';
export const MOON_150 = '#EDEFF2';
export const MOON_200 = '#E4E6EB';
export const MOON_250 = '#DADEE3';
export const MOON_300 = '#D3D7DE';
export const MOON_350 = '#C2C6CF';
export const MOON_400 = '#AEB3BD';
export const MOON_450 = '#8E949E';
export const MOON_50 = '#FDFDFD';
export const MOON_100 = '#F8F8F8';
export const MOON_150 = '#F0F0F0';
export const MOON_200 = '#E8E8E9';
export const MOON_250 = '#DFE0E2';
export const MOON_300 = '#D4D5D9';
export const MOON_350 = '#C5C7CC';
export const MOON_400 = '#B1B4B9';
export const MOON_450 = '#8F949E';
export const MOON_500 = '#79808A';
export const MOON_550 = '#676D78';
export const MOON_600 = '#565C66';
export const MOON_650 = '#4B535C';
export const MOON_700 = '#3F464F';
export const MOON_750 = '#343A42';
export const MOON_750 = '#363C44';
export const MOON_800 = '#2B3038';
export const MOON_850 = '#20242B';
export const MOON_900 = '#1A1D24';
Expand Down
3 changes: 3 additions & 0 deletions weave-js/src/common/hooks/useViewerInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const VIEWER_QUERY = gql`
viewer {
id
username
admin
teams {
edges {
node {
Expand All @@ -28,6 +29,7 @@ type UserInfo = {
id: string;
username: string;
teams: string[];
admin: boolean;
};
type UserInfoResponseLoading = {
loading: true;
Expand Down Expand Up @@ -71,6 +73,7 @@ export const useViewerInfo = (): UserInfoResponse => {
id,
username,
teams,
admin: userInfo.admin,
},
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Typography from '@mui/material/Typography';
import {useNodeValue} from '@wandb/weave/react';
import {parseRefMaybe, useNodeValue} from '@wandb/weave/react';
import React, {FC, useMemo} from 'react';
import {useParams} from 'react-router-dom';

import {callsTableFilter, callsTableNode, callsTableOpCounts} from './callTree';
import {Browse2RootObjectVersionItemParams} from './CommonLib';
import {parseRefMaybe, SmallRef} from './SmallRef';
import {SmallRef} from './SmallRef';

export const Browse2RootObjectVersionOutputOf: FC<{uri: string}> = ({uri}) => {
const params = useParams<Browse2RootObjectVersionItemParams>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
isWandbArtifactRef,
isWeaveObjectRef,
ObjectRef,
parseRef,
refUri,
} from '@wandb/weave/react';
import React, {FC} from 'react';
Expand Down Expand Up @@ -201,11 +200,3 @@ export const SmallRef: FC<{
</Link>
);
};

export const parseRefMaybe = (s: string): ObjectRef | null => {
try {
return parseRef(s);
} catch (e) {
return null;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as globals from '@wandb/weave/common/css/globals.styles';
import * as _ from 'lodash';
import React, {FC} from 'react';

import {parseRefMaybe} from '../../../../react';
import {StatusChip} from '../Browse3/pages/common/StatusChip';
import {Call} from './callTree';
import {DisplayControlChars} from './CommonLib';
Expand All @@ -13,7 +14,7 @@ import {
OpenAIChatInputView,
OpenAIChatOutputView,
} from './openai';
import {parseRefMaybe, SmallRef} from './SmallRef';
import {SmallRef} from './SmallRef';

const ObjectView: FC<{obj: any}> = ({obj}) => {
if (_.isPlainObject(obj)) {
Expand Down
17 changes: 14 additions & 3 deletions weave-js/src/components/PagePanelComponents/Home/Browse3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ import {CallPage} from './Browse3/pages/CallPage/CallPage';
import {CallsPage} from './Browse3/pages/CallsPage/CallsPage';
import {
ALWAYS_PIN_LEFT_CALLS,
DEFAULT_COLUMN_VISIBILITY_CALLS,
DEFAULT_FILTER_CALLS,
DEFAULT_PIN_CALLS,
DEFAULT_SORT_CALLS,
Expand Down Expand Up @@ -736,7 +735,7 @@ const CallsPageBinding = () => {
try {
return JSON.parse(query.cols);
} catch (e) {
return DEFAULT_COLUMN_VISIBILITY_CALLS;
return {};
}
}, [query.cols]);
const setColumnVisibilityModel = (newModel: GridColumnVisibilityModel) => {
Expand Down Expand Up @@ -1143,11 +1142,13 @@ const Browse3Breadcrumbs: FC = props => {

export const TableRowSelectionContext = React.createContext<{
rowIdsConfigured: boolean;
rowIdInTable: (id: string) => boolean;
setRowIds?: (rowIds: string[]) => void;
getNextRowId?: (currentId: string) => string | null;
getPreviousRowId?: (currentId: string) => string | null;
}>({
rowIdsConfigured: false,
rowIdInTable: (id: string) => false,
setRowIds: () => {},
getNextRowId: () => null,
getPreviousRowId: () => null,
Expand All @@ -1158,6 +1159,10 @@ const TableRowSelectionProvider: FC<{children: React.ReactNode}> = ({
}) => {
const [rowIds, setRowIds] = useState<string[]>([]);
const rowIdsConfigured = useMemo(() => rowIds.length > 0, [rowIds]);
const rowIdInTable = useCallback(
(currentId: string) => rowIds.includes(currentId),
[rowIds]
);

const getNextRowId = useCallback(
(currentId: string) => {
Expand All @@ -1183,7 +1188,13 @@ const TableRowSelectionProvider: FC<{children: React.ReactNode}> = ({

return (
<TableRowSelectionContext.Provider
value={{rowIdsConfigured, setRowIds, getNextRowId, getPreviousRowId}}>
value={{
rowIdsConfigured,
rowIdInTable,
setRowIds,
getNextRowId,
getPreviousRowId,
}}>
{children}
</TableRowSelectionContext.Provider>
);
Expand Down
Loading

0 comments on commit 375aa98

Please sign in to comment.