Skip to content

Commit

Permalink
Merge branch 'master' into andrew/tidy-tsi
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtruong authored Aug 19, 2024
2 parents 1d0020a + d87cfbd commit 566b06f
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 29 deletions.
1 change: 0 additions & 1 deletion docs/docs/tutorial-tracing_2.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ In the [Track LLM inputs & outputs](/quickstart) tutorial, the basics of trackin
In this tutorial you will learn how to:
- **Track data** as it flows though your application
- **Track metadata** at call time
- **Export data** that was logged to Weave

## Tracking nested function calls

Expand Down
12 changes: 12 additions & 0 deletions weave-js/src/common/components/elements/LegacyWBIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export interface LegacyWBIconProps {
style?: any;

'data-test'?: any;

role?: string;
ariaHidden?: string;
ariaLabel?: string;
}

const LegacyWBIconComp = React.forwardRef<HTMLElement, LegacyWBIconProps>(
Expand All @@ -42,6 +46,10 @@ const LegacyWBIconComp = React.forwardRef<HTMLElement, LegacyWBIconProps>(
onMouseLeave,
style,
'data-test': dataTest,
role,
title,
ariaHidden,
ariaLabel,
},
ref
) => {
Expand All @@ -59,6 +67,10 @@ const LegacyWBIconComp = React.forwardRef<HTMLElement, LegacyWBIconProps>(
onMouseLeave,
style,
'data-test': dataTest,
role,
title,
'aria-hidden': ariaHidden,
'aria-label': ariaLabel,
};
if (ref == null) {
return <Icon {...passProps} className={className} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export const flattenObjectPreservingWeaveTypes = (obj: {
[key: string]: any;
}) => {
return flattenObject(obj, '', {}, (key, value) => {
return typeof value !== 'object' || value == null || value._type == null;
return (
typeof value !== 'object' ||
value == null ||
value._type !== 'CustomWeaveType'
);
});
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {ErrorPanel} from '@wandb/weave/components/ErrorPanel';
import React, {FC, useContext} from 'react';

import {Button} from '../../../Button';
import {useClosePeek, WeaveflowPeekContext} from './context';

export const NotFoundPanel: FC<{title: string}> = ({title}) => {
const close = useClosePeek();
const {isPeeking} = useContext(WeaveflowPeekContext);
return (
<div style={{display: 'flex', flexDirection: 'column', height: '100%'}}>
<div style={{alignSelf: 'flex-end', margin: 10}}>
{isPeeking && <Button icon="close" variant="ghost" onClick={close} />}
</div>
<div style={{flex: 1}}>
<ErrorPanel title={title} subtitle="" subtitle2="" />
</div>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Box from '@mui/material/Box';
import {ErrorPanel} from '@wandb/weave/components/ErrorPanel';
import {Loading} from '@wandb/weave/components/Loading';
import {useViewTraceEvent} from '@wandb/weave/integrations/analytics/useViewEvents';
import React, {FC, useCallback} from 'react';
Expand All @@ -9,12 +8,9 @@ import {makeRefCall} from '../../../../../../util/refs';
import {Button} from '../../../../../Button';
import {Tailwind} from '../../../../../Tailwind';
import {Browse2OpDefCode} from '../../../Browse2/Browse2OpDefCode';
import {
TRACETREE_PARAM,
useClosePeek,
useWeaveflowCurrentRouteContext,
} from '../../context';
import {TRACETREE_PARAM, useWeaveflowCurrentRouteContext} from '../../context';
import {FeedbackGrid} from '../../feedback/FeedbackGrid';
import {NotFoundPanel} from '../../NotFoundPanel';
import {isEvaluateOp} from '../common/heuristics';
import {CenteredAnimatedLoader} from '../common/Loader';
import {SimplePageLayoutWithHeader} from '../common/SimplePageLayout';
Expand All @@ -26,15 +22,13 @@ import {CallDetails} from './CallDetails';
import {CallOverview} from './CallOverview';
import {CallSummary} from './CallSummary';
import {CallTraceView, useCallFlattenedTraceTree} from './CallTraceView';

export const CallPage: FC<{
entity: string;
project: string;
callId: string;
path?: string;
}> = props => {
const {useCall} = useWFHooks();
const close = useClosePeek();

const call = useCall({
entity: props.entity,
Expand All @@ -45,16 +39,7 @@ export const CallPage: FC<{
if (call.loading) {
return <CenteredAnimatedLoader />;
} else if (call.result === null) {
return (
<div style={{display: 'flex', flexDirection: 'column', height: '100%'}}>
<div style={{alignSelf: 'flex-end', margin: 10}}>
<Button icon="close" variant="ghost" onClick={close} />
</div>
<div style={{flex: 1}}>
<ErrorPanel title="Call not found" subtitle="" subtitle2="" />
</div>
</div>
);
return <NotFoundPanel title="Call not found" />;
}
return <CallPageInnerVertical {...props} call={call.result} />;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const CallSummary: React.FC<{
);

return (
<div style={{padding: 8}}>
<div style={{padding: 8, overflow: 'auto'}}>
<SimpleKeyValueTable
data={{
Operation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, {useMemo} from 'react';

import {maybePluralizeWord} from '../../../../../core/util/string';
import {LoadingDots} from '../../../../LoadingDots';
import {NotFoundPanel} from '../NotFoundPanel';
import {CustomWeaveTypeProjectContext} from '../typeViews/CustomWeaveTypeDispatcher';
import {WeaveCHTableSourceRefContext} from './CallPage/DataTableView';
import {ObjectViewerSection} from './CallPage/ObjectViewerSection';
Expand Down Expand Up @@ -59,7 +60,7 @@ export const ObjectVersionPage: React.FC<{
if (objectVersion.loading) {
return <CenteredAnimatedLoader />;
} else if (objectVersion.result == null) {
return <div>Object not found</div>;
return <NotFoundPanel title="Object not found" />;
}
return (
<ObjectVersionPageInner {...props} objectVersion={objectVersion.result} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {useMemo} from 'react';

import {LoadingDots} from '../../../../LoadingDots';
import {NotFoundPanel} from '../NotFoundPanel';
import {OpCodeViewer} from '../OpCodeViewer';
import {
CallsLink,
Expand Down Expand Up @@ -35,7 +36,7 @@ export const OpVersionPage: React.FC<{
if (opVersion.loading) {
return <CenteredAnimatedLoader />;
} else if (opVersion.result == null) {
return <div>Op version not found</div>;
return <NotFoundPanel title="Op not found" />;
}
return <OpVersionPageInner opVersion={opVersion.result} />;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,13 @@ const useOpVersion = (
};
}

if (opVersionRes.obj == null) {
return {
loading: false,
result: null,
};
}

const returnedResult = convertTraceServerObjectVersionToOpSchema(
opVersionRes.obj
);
Expand Down Expand Up @@ -812,6 +819,13 @@ const useObjectVersion = (
};
}

if (objectVersionRes.obj == null) {
return {
loading: false,
result: null,
};
}

const returnedResult: ObjectVersionSchema =
convertTraceServerObjectVersionToSchema(objectVersionRes.obj);

Expand Down
2 changes: 1 addition & 1 deletion weave/frontend/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion weave/frontend/sha1.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions weave/init_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,17 @@ def _print_version_check() -> None:
if use_message:
print(use_message)

orig_module = wandb._wandb_module
wandb._wandb_module = "weave"
weave_messages = wandb.sdk.internal.update.check_available(weave.__version__)
wandb._wandb_module = orig_module
weave_messages = None
if hasattr(weave, "_wandb_module"):
try:
orig_module = wandb._wandb_module # type: ignore
wandb._wandb_module = "weave" # type: ignore
weave_messages = wandb.sdk.internal.update.check_available(
weave.__version__
)
wandb._wandb_module = orig_module # type: ignore
except Exception:
weave_messages = None

if weave_messages:
use_message = (
Expand Down

0 comments on commit 566b06f

Please sign in to comment.